]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common: allow crush device class to be set from osd service spec 46555/head
authorCory Snyder <csnyder@iland.com>
Wed, 1 Jun 2022 09:39:11 +0000 (05:39 -0400)
committerAdam King <adking@redhat.com>
Tue, 7 Jun 2022 16:58:50 +0000 (12:58 -0400)
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 <csnyder@iland.com>
(cherry picked from commit c2f314ab8c187b54f12c04ec26034d451bd82273)

Conflicts:
src/python-common/ceph/deployment/drive_group.py

src/python-common/ceph/deployment/drive_group.py
src/python-common/ceph/deployment/translate.py

index fac97e6efe49bb9d10f1c75b4485e292e0057e9d..dc36a60d9b07d4b2288ec7e27695fb8a4c214324 100644 (file)
@@ -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,
@@ -241,6 +242,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
index 20d36908cac7be7c97b526ea816de0b31dc0eb7d..2d373732c04f1fb44881901aa0e8aaae842c025e 100644 (file)
@@ -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"