From: Rongqi Sun Date: Tue, 14 Mar 2023 07:39:05 +0000 (+0800) Subject: ceph-volume: keep batch default status X-Git-Tag: v19.0.0~1274^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=45375b4bcad211d12e1e1b14cb5122605c12f087;p=ceph.git ceph-volume: keep batch default status Signed-off-by: Rongqi Sun --- diff --git a/src/python-common/ceph/deployment/translate.py b/src/python-common/ceph/deployment/translate.py index 01ca02933b6..1d4605d5c50 100644 --- a/src/python-common/ceph/deployment/translate.py +++ b/src/python-common/ceph/deployment/translate.py @@ -95,7 +95,6 @@ class to_ceph_volume(object): db_devices = [x.path for x in self.selection.db_devices()] wal_devices = [x.path for x in self.selection.wal_devices()] - journal_devices = [x.path for x in self.selection.journal_devices()] if not self.selection.data_devices(): return [] @@ -116,79 +115,58 @@ class to_ceph_volume(object): raise ValueError('Number of data devices must match number of ' 'wal devices for raw mode osds') - # For this use case we don't apply any custom crush_device_classes - # Note that filestore is not supported anymore by the DriveGroupSpec - if self.spec.objectstore == 'filestore': - # for lvm batch we can just do all devices in one command - devs: List = sum(list(devices.values()), []) - - cmd = "lvm batch --no-auto" - - cmd += " {}".format(" ".join(devs)) - - if self.spec.journal_size: - cmd += " --journal-size {}".format(self.spec.journal_size) - - if journal_devices: - cmd += " --journal-devices {}".format( - ' '.join(journal_devices)) - - cmd += " --filestore" - cmds.append(cmd) - else: - for d in devices.keys(): - data_devices: Optional[List[str]] = devices.get(d) - if not data_devices: - continue - - if self.spec.method == 'raw': - assert self.spec.objectstore == 'bluestore' - # ceph-volume raw prepare only support 1:1 ratio of data to db/wal devices - # for raw prepare each data device needs its own prepare command - dev_counter = 0 - # reversing the lists as we're assigning db_devices sequentially - db_devices.reverse() - wal_devices.reverse() - - while dev_counter < len(data_devices): - cmd = "raw prepare --bluestore" - cmd += " --data {}".format(data_devices[dev_counter]) - if db_devices: - cmd += " --block.db {}".format(db_devices.pop()) - if wal_devices: - cmd += " --block.wal {}".format(wal_devices.pop()) - if d in self._supported_device_classes: - cmd += " --crush-device-class {}".format(d) - - cmds.append(cmd) - dev_counter += 1 - - elif self.spec.objectstore == 'bluestore': - # for lvm batch we can just do all devices in one command - - cmd = "lvm batch --no-auto {}".format(" ".join(data_devices)) - cmd += " --bluestore" + for d in devices.keys(): + data_devices: Optional[List[str]] = devices.get(d) + if not data_devices: + continue + if self.spec.method == 'raw': + assert self.spec.objectstore == 'bluestore' + # ceph-volume raw prepare only support 1:1 ratio of data to db/wal devices + # for raw prepare each data device needs its own prepare command + dev_counter = 0 + # reversing the lists as we're assigning db_devices sequentially + db_devices.reverse() + wal_devices.reverse() + + while dev_counter < len(data_devices): + cmd = "raw prepare --bluestore" + cmd += " --data {}".format(data_devices[dev_counter]) if db_devices: - cmd += " --db-devices {}".format(" ".join(db_devices)) - + cmd += " --block.db {}".format(db_devices.pop()) if wal_devices: - cmd += " --wal-devices {}".format(" ".join(wal_devices)) - - if self.spec.block_wal_size: - cmd += " --block-wal-size {}".format(self.spec.block_wal_size) - - if self.spec.block_db_size: - cmd += " --block-db-size {}".format(self.spec.block_db_size) - + cmd += " --block.wal {}".format(wal_devices.pop()) if d in self._supported_device_classes: cmd += " --crush-device-class {}".format(d) - cmds.append(cmd) - elif self.spec.objectstore == 'seastore': - cmd = "lvm batch --no-auto {}".format(" ".join(data_devices)) - cmd += " --seastore" cmds.append(cmd) + dev_counter += 1 + + elif self.spec.objectstore == 'bluestore': + # for lvm batch we can just do all devices in one command + + cmd = "lvm batch --no-auto {}".format(" ".join(data_devices)) + + if db_devices: + cmd += " --db-devices {}".format(" ".join(db_devices)) + + if wal_devices: + cmd += " --wal-devices {}".format(" ".join(wal_devices)) + + if self.spec.block_wal_size: + cmd += " --block-wal-size {}".format(self.spec.block_wal_size) + + if self.spec.block_db_size: + cmd += " --block-db-size {}".format(self.spec.block_db_size) + + if d in self._supported_device_classes: + cmd += " --crush-device-class {}".format(d) + cmds.append(cmd) + + elif self.spec.objectstore == 'seastore': + cmd = "lvm batch --no-auto {}".format(" ".join(data_devices)) + cmd += " --seastore" + cmds.append(cmd) for i in range(len(cmds)): if self.spec.encrypted: @@ -222,4 +200,4 @@ class to_ceph_volume(object): cmds[i] += " --report" cmds[i] += " --format json" - return cmds + return cmds \ No newline at end of file