From 0ca305f6c85a8a55091007041c2df3767027e73e Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Wed, 27 Sep 2023 10:20:55 -0300 Subject: [PATCH 1/2] swift-proxy: wait for model to settle after running action Let the units run all the hooks before attempting to check if the ring is synced, because the action set-weight triggers the hook swift-storage-relation-changed in the swift-storage units which it's the one in charge of getting the new ring data. --- zaza/openstack/charm_tests/swift/tests.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/zaza/openstack/charm_tests/swift/tests.py b/zaza/openstack/charm_tests/swift/tests.py index 7c731b6b7..605b275c1 100644 --- a/zaza/openstack/charm_tests/swift/tests.py +++ b/zaza/openstack/charm_tests/swift/tests.py @@ -125,6 +125,13 @@ def test_904_set_weight_action_and_validate_rebalance(self): 'search-value': self.TEST_SEARCH_TARGET, 'weight': self.TEST_WEIGHT_INITIAL}) self.assertEqual(action.status, "completed") + # let everything settle, because after the set-weight action the + # swift-storage units need to get run swift-storage-relation-changed to + # get the new ring + logging.info("Waiting for model to settle.") + zaza.model.wait_for_agent_status() + zaza.model.block_until_all_units_idle() + self.assertTrue( swift_utils.is_ring_synced('swift-proxy', 'object', self.TEST_EXPECTED_RING_HOSTS)) From 13a728d262901ea1ca521b625be1d2a780e8ebc3 Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Wed, 27 Sep 2023 23:31:00 -0300 Subject: [PATCH 2/2] Add logging --- zaza/openstack/utilities/swift.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zaza/openstack/utilities/swift.py b/zaza/openstack/utilities/swift.py index cea0a3342..1a87afc8a 100644 --- a/zaza/openstack/utilities/swift.py +++ b/zaza/openstack/utilities/swift.py @@ -366,4 +366,8 @@ def is_ring_synced(proxy_app, ring, expected_hosts, model_name=None): result = zaza.model.run_on_leader(proxy_app, cmd, model_name=model_name) expected = ('{num}/{num} hosts matched, 0 error[s] while checking hosts.' ''.format(num=expected_hosts)) + logging.info('Cmd: %s', str(cmd)) + logging.info('Stdout: %s', result['Stdout']) + logging.info('Stderr: %s', result.get('Stderr', '')) + logging.info('Expected: %s', expected) return bool(result['Stdout'].strip('\n') == expected)