From 0f6f2b46a347c41a15f7ab2d532efb299f226698 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Fri, 26 Jun 2020 15:29:59 +0200 Subject: [PATCH] py-common/deployment: drop workarounds for old batch This commit drops two workarounds in drive groups for the old batch behaviour. OSDs on LVs no longer need to be created individually by create (related to functional testing) and ceph-volume batch now filters unavailable drives itself. Signed-off-by: Jan Fajerski --- src/pybind/mgr/cephadm/tests/test_cephadm.py | 8 ++++---- src/python-common/ceph/deployment/translate.py | 18 ------------------ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index a474fb151a7dc..82712dd2f1bd8 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -412,8 +412,8 @@ class TestCephadm(object): _run_cephadm.assert_any_call( 'test', 'osd', 'ceph-volume', - ['--config-json', '-', '--', 'lvm', 'prepare', - '--bluestore', '--data', '/dev/sdb', '--no-systemd'], + ['--config-json', '-', '--', 'lvm', 'batch', + '--no-auto', '/dev/sdb', '--yes', '--no-systemd'], env_vars=['CEPH_VOLUME_OSDSPEC_AFFINITY=foo'], error_ok=True, stdin='{"config": "", "keyring": ""}') _run_cephadm.assert_called_with( 'test', 'osd', 'ceph-volume', ['--', 'lvm', 'list', '--format', 'json']) @@ -454,12 +454,12 @@ class TestCephadm(object): "devices, preview, exp_command", [ # no preview and only one disk, prepare is used due the hack that is in place. - (['/dev/sda'], False, "lvm prepare --bluestore --data /dev/sda --no-systemd"), + (['/dev/sda'], False, "lvm batch --no-auto /dev/sda --yes --no-systemd"), # no preview and multiple disks, uses batch (['/dev/sda', '/dev/sdb'], False, "CEPH_VOLUME_OSDSPEC_AFFINITY=test.spec lvm batch --no-auto /dev/sda /dev/sdb --yes --no-systemd"), # preview and only one disk needs to use batch again to generate the preview - (['/dev/sda'], True, "lvm batch --no-auto /dev/sda --report --format json"), + (['/dev/sda'], True, "lvm batch --no-auto /dev/sda --yes --no-systemd --report --format json"), # preview and multiple disks work the same (['/dev/sda', '/dev/sdb'], True, "CEPH_VOLUME_OSDSPEC_AFFINITY=test.spec lvm batch --no-auto /dev/sda /dev/sdb --yes --no-systemd --report --format json"), diff --git a/src/python-common/ceph/deployment/translate.py b/src/python-common/ceph/deployment/translate.py index c2f030d2cb26f..e5d5981662647 100644 --- a/src/python-common/ceph/deployment/translate.py +++ b/src/python-common/ceph/deployment/translate.py @@ -50,24 +50,6 @@ class to_ceph_volume(object): cmd += " --filestore" - # HORRIBLE HACK - if self.spec.objectstore == 'bluestore' and \ - not self.spec.encrypted and \ - not self.spec.osds_per_device and \ - len(data_devices) == 1 and \ - not db_devices and \ - not wal_devices: - cmd = "lvm prepare --bluestore --data %s --no-systemd" % (' '.join(data_devices)) - if self.osd_id_claims: - cmd += " --osd-id {}".format(str(self.osd_id_claims[0])) - if self.preview: - # Like every horrible hack, this has sideffects on other features. - # In this case, 'lvm prepare' has neither a '--report' nor a '--format json' option - # which essentially doesn't allow for a proper previews here. - # Fall back to lvm batch in order to get a preview. - return f"lvm batch --no-auto {' '.join(data_devices)} --report --format json" - return cmd - if self.spec.objectstore == 'bluestore': cmd = "lvm batch --no-auto {}".format(" ".join(data_devices)) -- 2.39.5