]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix is_ceph_disk_member() 47406/head
authorGuillaume Abrioux <gabrioux@redhat.com>
Tue, 26 Jul 2022 14:24:31 +0000 (16:24 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 2 Aug 2022 09:39:37 +0000 (11:39 +0200)
`dev['NAME']` can't match `part` given that it's the name of the
parent device being compared to the partition name.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
(cherry picked from commit 24899a1f8d77bc3c10ef158bb463349d615f7c57)

src/ceph-volume/ceph_volume/util/device.py

index d54c0d56e11b80ff2b14d844de2a328884ab8ccc..86249894e54170f469e6e6e64c27674c3d32e0ce 100644 (file)
@@ -420,11 +420,14 @@ class Device(object):
         # If we come from Devices(), self.lsblk_all is set already.
         # Otherwise, we have to grab the data.
         details = self.lsblk_all or disk.lsblk_all()
+        _is_member = False
         if self.sys_api.get("partitions"):
             for part in self.sys_api.get("partitions").keys():
                 for dev in details:
-                    if dev['NAME'] == part:
-                        return is_member(dev)
+                    if part.startswith(dev['NAME']):
+                        if is_member(dev):
+                            _is_member = True
+                return _is_member
         else:
             return is_member(self.disk_api)
         raise RuntimeError(f"Couln't check if device {self.path} is a ceph-disk member.")