From 8635ded8e773b866875ffd11f3a115434dc9d77c Mon Sep 17 00:00:00 2001 From: Joseph Sawaya Date: Tue, 3 Aug 2021 10:02:30 -0400 Subject: [PATCH] mgr/rook: update DefaultFetcher device path to look at local and fix bug This commit updates the DefaultFetcher device method's way of getting a device path to look at the PV's local attribute. It also fixes a bug related to a PV not having annotations. Signed-off-by: Joseph Sawaya --- src/pybind/mgr/rook/rook_cluster.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index dc16b7f3a3d9..22dc661d5c43 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -126,7 +126,7 @@ class DefaultFetcher(): if len(terms) == 1 and len(terms[0].match_expressions) == 1 and terms[0].match_expressions[0].key == 'kubernetes.io/hostname' and len(terms[0].match_expressions[0].values) == 1: node = terms[0].match_expressions[0].values[0] size = self.convert_size(i.spec.capacity['storage']) - path = i.spec.host_path.path if i.spec.host_path else ('/dev/' + i.metadata.annotations['storage.openshift.com/device-name']) if i.metadata.annotations['storage.openshift.com/device-name'] else '' + path = i.spec.host_path.path if i.spec.host_path else i.spec.local.path if i.spec.local else ('/dev/' + i.metadata.annotations['storage.openshift.com/device-name']) if i.metadata.annotations and 'storage.openshift.com/device-name' in i.metadata.annotations else '' state = i.spec.volume_mode == 'Block' and i.status.phase == 'Available' pv_name = i.metadata.name device = Device( -- 2.47.3