From 94e1d8f7ed42de5c5c69f85b7ba7a163b91abb23 Mon Sep 17 00:00:00 2001 From: Camille Rodriguez Date: Fri, 30 Aug 2019 15:01:36 -0400 Subject: [PATCH] Verify instances status before going starting the instances --- zaza/openstack/charm_tests/mysql/tests.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/zaza/openstack/charm_tests/mysql/tests.py b/zaza/openstack/charm_tests/mysql/tests.py index 6c10c64..973c980 100644 --- a/zaza/openstack/charm_tests/mysql/tests.py +++ b/zaza/openstack/charm_tests/mysql/tests.py @@ -276,13 +276,10 @@ class PerconaClusterColdStartTest(PerconaClusterTest): logging.info("Stopping instances: {}".format(self.machines)) for uuid in self.machines: self.nova_client.servers.stop(uuid) - # Unfortunately, juju reports units in workload status "active" - # when they are in fact down. So we have to rely on a simple wait - # and idle check. - logging.debug("Sleep ...") - time.sleep(30) - logging.debug("Wait till model is idle ...") - zaza.model.block_until_all_units_idle() + logging.debug("Wait till all machines are shutoff ...") + for uuid in self.machines: + openstack_utils.resource_reaches_status(self.nova_client.servers, uuid, + expected_status='SHUTOFF', stop_after_attempt=16) # Start nodes self.machines.sort(reverse=True)