From: Cory Snyder Date: Wed, 1 Jun 2022 09:39:11 +0000 (-0400) Subject: python-common: allow crush device class to be set from osd service spec X-Git-Tag: v18.0.0~777^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=c2f314ab8c187b54f12c04ec26034d451bd82273;p=ceph-ci.git 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 --- diff --git a/src/python-common/ceph/deployment/drive_group.py b/src/python-common/ceph/deployment/drive_group.py index dd872426777..6f96b2f6de8 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 20d36908cac..2d373732c04 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"