From f5cfd59a804654188cf1243255e51999c96feb81 Mon Sep 17 00:00:00 2001 From: Chris MacNaughton Date: Fri, 10 Mar 2023 19:35:10 +0000 Subject: [PATCH] Requiring that a bundle defines more than one OSD is unecessary While the disk replacement rests are good for the OSD charm, and it's useful to have more disks by default in that case, requiring extra disk for all applications that tun the Ceph tests is an unreasonable burden, requiring additional changed just to accommodate the OSD charm tests. This change updates to check if we have enough disks available before running the disk replacement tests. --- zaza/openstack/charm_tests/ceph/tests.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/zaza/openstack/charm_tests/ceph/tests.py b/zaza/openstack/charm_tests/ceph/tests.py index 44708fd..ac29ce6 100644 --- a/zaza/openstack/charm_tests/ceph/tests.py +++ b/zaza/openstack/charm_tests/ceph/tests.py @@ -563,13 +563,14 @@ class CephTest(test_utils.BaseCharmTest): self.assertEqual(results['osd-ids'], osd_id) zaza_model.run_on_unit(unit, 'partprobe') - def remove_one_osd(self, unit): + def remove_one_osd(self, unit, block_devs): """Remove one device from osd unit. :param unit: Unit name where the osd device is to be removed from. :type unit: str + :params block_devs: list of block devices on the scpecified unit + :type block_devs: list[str] """ - block_devs = self.get_osd_devices_on_unit(unit) # Should have more than 1 OSDs to take one out and test. self.assertGreater(len(block_devs), 1) @@ -593,10 +594,17 @@ class CephTest(test_utils.BaseCharmTest): # Remove one of the two disks. logging.info('Removing single disk from each OSD') for unit in osds: - device_info = self.remove_one_osd(unit) + block_devs = self.get_osd_devices_on_unit(unit) + if len(block_devs) < 2: + continue + device_info = self.remove_one_osd(unit, block_devs) block_dev = device_info['block-device'] logging.info("Removing device %s from unit %s" % (block_dev, unit)) osd_info[unit] = device_info + if not osd_info: + raise unittest.SkipTest( + 'Skipping OSD replacement Test, no spare devices added') + logging.debug('Removed OSD Info: {}'.format(osd_info)) zaza_model.wait_for_application_states()