From c2f314ab8c187b54f12c04ec26034d451bd82273 Mon Sep 17 00:00:00 2001 From: Cory Snyder Date: Wed, 1 Jun 2022 05:39:11 -0400 Subject: [PATCH] python-common: allow crush device class to be set from osd service spec Adds crush_device_class parameter to DriveGroupSpec so that device class can be set via service specs with cephadm. Fixes: https://tracker.ceph.com/issues/55813 Signed-off-by: Cory Snyder --- src/python-common/ceph/deployment/drive_group.py | 6 +++++- src/python-common/ceph/deployment/translate.py | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/python-common/ceph/deployment/drive_group.py b/src/python-common/ceph/deployment/drive_group.py index dd87242677778..6f96b2f6de872 100644 --- a/src/python-common/ceph/deployment/drive_group.py +++ b/src/python-common/ceph/deployment/drive_group.py @@ -150,7 +150,7 @@ class DriveGroupSpec(ServiceSpec): "data_devices", "db_devices", "wal_devices", "journal_devices", "data_directories", "osds_per_device", "objectstore", "osd_id_claims", "journal_size", "unmanaged", "filter_logic", "preview_only", "extra_container_args", - "data_allocate_fraction", "method" + "data_allocate_fraction", "method", "crush_device_class", ] def __init__(self, @@ -177,6 +177,7 @@ class DriveGroupSpec(ServiceSpec): extra_container_args=None, # type: Optional[List[str]] data_allocate_fraction=None, # type: Optional[float] method=None, # type: Optional[OSDMethod] + crush_device_class=None, # type: Optional[str] ): assert service_type is None or service_type == 'osd' super(DriveGroupSpec, self).__init__('osd', service_id=service_id, @@ -242,6 +243,9 @@ class DriveGroupSpec(ServiceSpec): self.method = method + #: Crush device class to assign to OSDs + self.crush_device_class = crush_device_class + @classmethod def _from_json_impl(cls, json_drive_group): # type: (dict) -> DriveGroupSpec diff --git a/src/python-common/ceph/deployment/translate.py b/src/python-common/ceph/deployment/translate.py index 20d36908cac7b..2d373732c04f1 100644 --- a/src/python-common/ceph/deployment/translate.py +++ b/src/python-common/ceph/deployment/translate.py @@ -109,6 +109,9 @@ class to_ceph_volume(object): cmds[i] += " --yes" cmds[i] += " --no-systemd" + if self.spec.crush_device_class: + cmds[i] += " --crush-device-class {}".format(self.spec.crush_device_class) + if self.preview: cmds[i] += " --report" cmds[i] += " --format json" -- 2.39.5