From 6528bb0149720b336c9da7b57eaea048d693871c Mon Sep 17 00:00:00 2001 From: David Lehman Date: Wed, 20 Jun 2018 16:37:24 -0400 Subject: [PATCH] Deactivate incomplete VGs along with everything else. (cherry picked from commit 39637796ca1aa2f03c89b5ec86ac246eecca1570) --- blivet/devices/lvm.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py index 0cb1a2ac..1e9da2a8 100644 --- a/blivet/devices/lvm.py +++ b/blivet/devices/lvm.py @@ -216,15 +216,25 @@ class LVMVolumeGroupDevice(ContainerDevice): if lv.status: return True + # special handling for incomplete VGs + if not self.complete: + try: + lvs_info = blockdev.lvm.lvs(vg_name=self.name) + except blockdev.LVMError: + lvs_info = dict() + + for lv_info in lvs_info.values(): + lv_attr = udev.device_get_lv_attr(lv_info) + if lv_attr and lv_attr[4] == 'a': + return True + + return False + # if any of our PVs are not active then we cannot be for pv in self.pvs: if not pv.status: return False - # if we are missing some of our PVs we cannot be active - if not self.complete: - return False - return True def _pre_setup(self, orig=False): -- 2.20.1