]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common: allow crush device class to be set from osd service spec 46792/head
authorCory Snyder <csnyder@iland.com>
Wed, 1 Jun 2022 09:39:11 +0000 (05:39 -0400)
committerAdam King <adking@redhat.com>
Wed, 22 Jun 2022 00:11:21 +0000 (20:11 -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)

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

index dd8724267777820547d1d720d542865d49c36725..6f96b2f6de8725438f45e9271b3993e2d144dda1 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,
@@ -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
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"