]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: add vg_name to the Device class
authorAndrew Schoen <aschoen@redhat.com>
Wed, 26 Sep 2018 19:29:41 +0000 (14:29 -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 619810c0ef48c1f19db8821a33f9c48cc11a0161)

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

index 56902858de40498b629bef64e753ad1ccca5decb..a5b106adfc28982e025564d40a8862aa7ccce9cf 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.vg_name = None
         self.pvs_api = []
         self.disk_api = {}
         self.blkid_api = {}
@@ -25,6 +26,7 @@ class Device(object):
         if lv:
             self.lv_api = lv
             self.abspath = lv.lv_path
+            self.vg_name = lv.vg_name
         else:
             dev = disk.lsblk(self.path)
             self.blkid_api = disk.blkid(self.path)
@@ -61,6 +63,8 @@ class Device(object):
                 return self._is_lvm_member
             has_vgs = [pv.vg_name for pv in pvs if pv.vg_name]
             if has_vgs:
+                # a pv can only be in one vg, so this should be safe
+                self.vg_name = has_vgs[0]
                 self._is_lvm_member = True
                 self.pvs_api = pvs
             else: