From: Joseph Sawaya Date: Tue, 3 Aug 2021 14:02:30 +0000 (-0400) Subject: mgr/rook: update DefaultFetcher device path to look at local and fix bug X-Git-Tag: v17.1.0~1144^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8635ded8e773b866875ffd11f3a115434dc9d77c;p=ceph.git 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 --- 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(