From 90bba5cf5592a02fb0c9deb4e70603dfc31a3a63 Mon Sep 17 00:00:00 2001 From: Joseph Sawaya Date: Mon, 19 Jul 2021 09:26:03 -0400 Subject: [PATCH] mgr/rook: add supplemental information to device object in LSOFetcher 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 --- src/pybind/mgr/rook/rook_cluster.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index 8d88559187978..161377c1ac2eb 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -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], -- 2.39.5