]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: adds a lvs property to the Device class
authorAndrew Schoen <aschoen@redhat.com>
Wed, 26 Sep 2018 20:53:26 +0000 (15:53 -0500)
committerAndrew Schoen <aschoen@redhat.com>
Mon, 15 Oct 2018 16:55:48 +0000 (11:55 -0500)
Signed-off-by: Andrew Schoen <aschoen@redhat.com>
(cherry picked from commit 3dae3247adc1b96ca688ec81cec03180d5943823)

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

index a5b106adfc28982e025564d40a8862aa7ccce9cf..0457d5a1989a3720487b0d5d8cf144b24cf9934a 100644 (file)
@@ -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