Use hacluster.add_location()

This change removes the workaround that was needed when the hacluster
interface didn't have a method to define colocations.

Related-Bug: #1880644
Change-Id: I4236cb4784062807d53381380d9d161ce2f450ee
This commit is contained in:
Felipe Reyes 2022-02-04 14:27:02 -03:00
parent 95f0be842f
commit f2d9ed3709
1 changed files with 6 additions and 16 deletions

View File

@ -117,23 +117,13 @@ def cluster_connected(hacluster):
hacluster.add_systemd_service('manila-share',
'manila-share',
clone=False)
hacluster.add_colocation('ganesha_with_vip', 'inf',
('res_nfs_ganesha_nfs_ganesha',
'grp_ganesha_vips'))
hacluster.add_colocation('manila_with_vip', 'inf',
('res_manila_share_manila_share',
'grp_ganesha_vips'))
this_charm.configure_ha_resources(hacluster)
# This is a bit of a nasty hack to ensure that we can colocate the
# services to make manila + ganesha colocate. This can be tidied up
# once
# https://bugs.launchpad.net/charm-interface-hacluster/+bug/1880644
# is resolved
import relations.hacluster.interface_hacluster.common as hacluster_common # noqa
crm = hacluster_common.CRM()
crm.colocation('ganesha_with_vip',
'inf',
'res_nfs_ganesha_nfs_ganesha',
'grp_ganesha_vips')
crm.colocation('manila_with_vip',
'inf',
'res_manila_share_manila_share',
'grp_ganesha_vips')
hacluster.manage_resources(crm)
reactive.set_flag('ha-resources-exposed')
this_charm.assess_status()