diff --git a/zaza/openstack/charm_tests/manila_ganesha/tests.py b/zaza/openstack/charm_tests/manila_ganesha/tests.py index 2b6fda4..9198e72 100644 --- a/zaza/openstack/charm_tests/manila_ganesha/tests.py +++ b/zaza/openstack/charm_tests/manila_ganesha/tests.py @@ -26,6 +26,7 @@ from zaza.openstack.charm_tests.manila_ganesha.setup import ( import zaza.openstack.utilities.generic as generic_utils import zaza.openstack.charm_tests.manila.tests as manila_tests import zaza.model +import zaza.utilities.juju as zaza_utils_juju class ManilaGaneshaTests(manila_tests.ManilaBaseTest): @@ -50,13 +51,27 @@ class ManilaGaneshaTests(manila_tests.ManilaBaseTest): app for app in zaza.model.sync_deployed() if 'ganesha' in app and 'mysql' not in app] for ganesha in ganeshas: + ganesha_unit = zaza.model.get_units(ganesha)[0] + hacluster_unit = zaza_utils_juju.get_subordinate_units( + [ganesha_unit.entity_id], + charm_name='hacluster') + logging.info('Ganesha in hacluster mode: {}'.format( + bool(hacluster_unit))) + for unit in zaza.model.get_units(ganesha): - # While we really only need to run this on the machine hosting - # nfs-ganesha and manila-share, running it everywhere isn't - # harmful. Pacemaker handles restarting the services - zaza.model.run_on_unit( - unit.entity_id, - "systemctl stop manila-share nfs-ganesha") + if hacluster_unit: + # While we really only need to run this on the machine + # hosting # nfs-ganesha and manila-share, running it + # everywhere isn't harmful. Pacemaker handles restarting + # the services + zaza.model.run_on_unit( + unit.entity_id, + "systemctl stop manila-share nfs-ganesha") + else: + zaza.model.run_on_unit( + unit.entity_id, + "systemctl restart manila-share nfs-ganesha") + return True def _run_nrpe_check_command(self, commands):