]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: add partition support to Device
authorJan Fajerski <jfajerski@suse.com>
Tue, 4 Dec 2018 16:00:59 +0000 (17:00 +0100)
committerJan Fajerski <jfajerski@suse.com>
Tue, 11 Dec 2018 14:31:05 +0000 (15:31 +0100)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
src/ceph-volume/ceph_volume/util/device.py

index 8507251ee6f381ab9be8e4526881af136a527e51..667bb97f2569c1481103a9ab86de7e67205f454a 100644 (file)
@@ -110,6 +110,14 @@ class Device(object):
         if not sys_info.devices:
             sys_info.devices = disk.get_devices()
         self.sys_api = sys_info.devices.get(self.abspath, {})
+        if not self.sys_api:
+            # if no device was found check if we are a partition
+            partname = self.abspath.split('/')[-1]
+            for device, info in sys_info.devices.items():
+                part = info['partitions'].get(partname, {})
+                if part:
+                    self.sys_api = part
+                    break
 
         # start with lvm since it can use an absolute or relative path
         lv = lvm.get_lv_from_argument(self.path)