From: Jan Fajerski Date: Tue, 4 Dec 2018 16:00:59 +0000 (+0100) Subject: ceph-volume: add partition support to Device X-Git-Tag: v12.2.12~113^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f2ba4cb23b459d17ff2009f9d94c97c505a25ffb;p=ceph.git ceph-volume: add partition support to Device Signed-off-by: Jan Fajerski (cherry picked from commit 05ac680cb37fd15fdeadaea86780bf1b4f2d566a) --- diff --git a/src/ceph-volume/ceph_volume/util/device.py b/src/ceph-volume/ceph_volume/util/device.py index 06f90cd37441..2e99d2b7497d 100644 --- a/src/ceph-volume/ceph_volume/util/device.py +++ b/src/ceph-volume/ceph_volume/util/device.py @@ -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)