]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: update DefaultFetcher device path to look at local and fix bug 42318/head
authorJoseph Sawaya <jsawaya@redhat.com>
Tue, 3 Aug 2021 14:02:30 +0000 (10:02 -0400)
committerJoseph Sawaya <jsawaya@redhat.com>
Tue, 3 Aug 2021 14:02:30 +0000 (10:02 -0400)
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 <jsawaya@redhat.com>
src/pybind/mgr/rook/rook_cluster.py

index dc16b7f3a3d925ae932e519cd9b8822c4a90baa1..22dc661d5c43d7cc4c67a29178444f7f03d1b173 100644 (file)
@@ -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(