From f09bc087b3e50f9399f1e946f051d5355bf3f752 Mon Sep 17 00:00:00 2001 From: Luciano Lo Giudice Date: Tue, 12 Apr 2022 17:30:25 -0300 Subject: [PATCH] Setup loop devices early on in the Ceph tests There appears to be a race condition between the loop device creation and its actual usage. In order to prevent that, this PR setups these devices during the test initialization instead of right before using them in the 'add-disk' tests. --- zaza/openstack/charm_tests/ceph/tests.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zaza/openstack/charm_tests/ceph/tests.py b/zaza/openstack/charm_tests/ceph/tests.py index 379c330..64856ed 100644 --- a/zaza/openstack/charm_tests/ceph/tests.py +++ b/zaza/openstack/charm_tests/ceph/tests.py @@ -186,6 +186,11 @@ class CephTest(test_utils.OpenStackBaseTest): def setUpClass(cls): """Run the ceph's common class setup.""" super(CephTest, cls).setUpClass() + cls.loop_devs = {} # Maps osd -> loop device + for osd in (x.entity_id for x in zaza_model.get_units('ceph-osd')): + zaza_model.add_storage(osd, 'cache-devices', 'cinder', 10) + loop_dev = zaza_utils.add_loop_device(osd, 10).get('Stdout') + cls.loop_devs[osd] = loop_dev def osd_out_in(self, services): """Run OSD out and OSD in tests. @@ -565,8 +570,7 @@ class CephTest(test_utils.OpenStackBaseTest): osds = [x.entity_id for x in zaza_model.get_units('ceph-osd')] params = [] for unit in osds: - zaza_model.add_storage(unit, 'cache-devices', 'cinder', 10) - loop_dev = zaza_utils.add_loop_device(unit, 10).get('Stdout') + loop_dev = self.loop_devs[unit] params.append({'unit': unit, 'device': loop_dev}) action_obj = zaza_model.run_action( unit_name=unit,