]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: add supplemental information to device object in LSOFetcher
authorJoseph Sawaya <jsawaya@redhat.com>
Mon, 19 Jul 2021 13:26:03 +0000 (09:26 -0400)
committerJoseph Sawaya <jsawaya@redhat.com>
Tue, 17 Aug 2021 14:50:27 +0000 (10:50 -0400)
This commit adds the PV name, node name, vendor and model to the Device object
created in the LSOFetcher device method, this information is useful for adding
OSDs.

Signed-off-by: Joseph Sawaya <jsawaya@redhat.com>
src/pybind/mgr/rook/rook_cluster.py

index 8d8855918797819877773d5c8a287702247f2db2..161377c1ac2ebcbf28aa238baea5b355835a3cb9 100644 (file)
@@ -185,11 +185,18 @@ class LSOFetcher(DefaultFetcher):
     def device(self, i: Any) -> Tuple[str, Device]:
         node = i.metadata.labels['kubernetes.io/hostname']
         device_discovery = self.lso_devices[i.metadata.annotations['storage.openshift.com/device-id']]
+        pv_name = i.metadata.name
+        vendor: str = device_discovery['model'].split()[0] if len(device_discovery['model'].split()) >= 1 else ''
+        model: str = ' '.join(device_discovery['model'].split()[1:]) if len(device_discovery['model'].split()) > 1 else ''
         device = Device(
             path = device_discovery['path'],
             sys_api = dict(
                     size = device_discovery['size'],
-                    rotational = '1' if device_discovery['property']=='Rotational' else '0'
+                    rotational = '1' if device_discovery['property']=='Rotational' else '0',
+                    node = node,
+                    pv_name = pv_name,
+                    model = model,
+                    vendor = vendor
                 ),
             available = device_discovery['status']['state']=='Available',
             device_id = device_discovery['deviceID'].split('/')[-1],