From b12cebb93bd7312f93e4b545178b20da36cc368b Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 26 Sep 2018 15:53:26 -0500 Subject: [PATCH] ceph-volume: adds a lvs property to the Device class Signed-off-by: Andrew Schoen (cherry picked from commit 3dae3247adc1b96ca688ec81cec03180d5943823) --- src/ceph-volume/ceph_volume/util/device.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ceph-volume/ceph_volume/util/device.py b/src/ceph-volume/ceph_volume/util/device.py index a5b106adfc289..0457d5a1989a3 100644 --- a/src/ceph-volume/ceph_volume/util/device.py +++ b/src/ceph-volume/ceph_volume/util/device.py @@ -11,6 +11,7 @@ class Device(object): # LVs can have a vg/lv path, while disks will have /dev/sda self.abspath = path self.lv_api = None + self.lvs = [] self.vg_name = None self.pvs_api = [] self.disk_api = {} @@ -25,6 +26,7 @@ class Device(object): lv = lvm.get_lv_from_argument(self.path) if lv: self.lv_api = lv + self.lvs = [lv] self.abspath = lv.lv_path self.vg_name = lv.vg_name else: @@ -67,6 +69,11 @@ class Device(object): self.vg_name = has_vgs[0] self._is_lvm_member = True self.pvs_api = pvs + for pv in pvs: + if pv.vg_name and pv.lv_uuid: + lv = lvm.get_lv(vg_name=pv.vg_name, lv_uuid=pv.lv_uuid) + if lv: + self.lvs.append(lv) else: # this is contentious, if a PV is recognized by LVM but has no # VGs, should we consider it as part of LVM? We choose not to -- 2.39.5