From 81f498d255de80583972f6ed0f7e7504a42e822c Mon Sep 17 00:00:00 2001 From: Andrew Schoen Date: Wed, 26 Sep 2018 14:29:41 -0500 Subject: [PATCH] ceph-volume: add vg_name to the Device class Signed-off-by: Andrew Schoen (cherry picked from commit 619810c0ef48c1f19db8821a33f9c48cc11a0161) --- src/ceph-volume/ceph_volume/util/device.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ceph-volume/ceph_volume/util/device.py b/src/ceph-volume/ceph_volume/util/device.py index 56902858de404..a5b106adfc289 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.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: -- 2.39.5