]> git.apps.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>
Wed, 6 Feb 2019 05:18:25 +0000 (06:18 +0100)
Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit 05ac680cb37fd15fdeadaea86780bf1b4f2d566a)

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

index 06f90cd374417a7fef172e9d1a185b2f19a9d235..2e99d2b7497d981819a6b11c163facb76a2f7cb0 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)