_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'])
"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"),
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))