[PATCH 1/4] Try to deactivate lvm on corrupted gpt disks.

David Lehman dlehman at redhat.com
Fri Jan 9 21:32:30 UTC 2015


Since pyparted won't let us use the corrupt gpt disklabel we can't
treat the disk as partitioned, which prevents us from correctly detecting
the lvm on top of it. By deactivating the lvm when this situation arises,
we at least make it possible to clear the disk and do a fresh installation
on it.

Related: rhbz#1144410
---
 blivet/devicetree.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 5bf0a45..41cc42e 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -692,7 +692,13 @@ class DeviceTree(object):
         vg_name = udev.device_get_lv_vg_name(info)
         device = self.getDeviceByName(vg_name)
         if not device:
+            # this means something is messed up, like a corrupt gpt disklabel
+            # that the kernel is perfectly happy with but parted refuses to use
             log.error("failed to find vg '%s' after scanning pvs", vg_name)
+            try:
+                lvm.vgdeactivate(vg_name)
+            except LVMError as e:
+                log.error("failed to deactivate vg: %s", e)
 
         # Don't return the device like we do in the other addUdevFooDevice
         # methods. The device we have here is a vg, not an lv.
-- 
1.9.3



More information about the anaconda-patches mailing list