[PATCH 1/2] Don't remove an inconsistent lvm partition from the devicetree (#496638)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a PV partition is part of an inconsistent VG, and the user chooses
to ignore it we currently remove it from the devicetree, but since
partition_gui.py populate() uses parted on the disk to find out about
the partitions, it will still see it and then backtrace when it cannot
find it in the devicetree.

This patch fixes this by instead making the partition immutable. Note
that I've put the reason for it being immutable in the new immutableDevices
array, so that if we have similar cases in the future we can use
immutableDevices for that too. We might even want to move some of our
existing cases there.
---
 storage/__init__.py   |    4 ++++
 storage/devicetree.py |   15 +++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 5b6e0f6..c05d9a4 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -537,6 +537,10 @@ class Storage(object):
                     msg += "%s: %s" % (dev, reasons[dev])
                 return msg
 
+        for i in self.devicetree.immutableDevices:
+            if i[0] == device.name:
+                return i[1]
+
         return False
 
     def deviceDeps(self, device):
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 996e702..85bef4b 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -205,6 +205,7 @@ class DeviceTree(object):
         self._ignoredDisks = []
         for disk in ignored:
             self.addIgnoredDisk(disk)
+        self.immutableDevices = []
         lvm.lvm_cc_resetFilter()
 
     def addIgnoredDisk(self, disk):
@@ -1537,7 +1538,12 @@ class DeviceTree(object):
                     lvm.lvm_cc_addFilterRejectRegexp(device.name)
                     lvm.blacklistVG(device.name)
                     for parent in device.parents:
-                        self._removeDevice(parent, moddisk=False)
+                        if parent.type == "partition":
+                            self.immutableDevices.append([parent.name,
+                                _("This partition is part of an inconsistent LVM Volume Group.")])
+                        else:
+                            self._removeDevice(parent, moddisk=False)
+                            self.addIgnoredDisk(parent.name)
                         lvm.lvm_cc_addFilterRejectRegexp(parent.name)
 
                 return
@@ -1575,7 +1581,12 @@ class DeviceTree(object):
                     lvm.blacklistVG(device.vg.name)
                     # ignore all the pvs
                     for parent in device.vg.parents:
-                        self._removeDevice(parent, moddisk=False)
+                        if parent.type == "partition":
+                            self.immutableDevices.append([parent.name,
+                                _("This partition is part of an inconsistent LVM Volume Group.")])
+                        else:
+                            self._removeDevice(parent, moddisk=False)
+                            self.addIgnoredDisk(parent.name)
                         lvm.lvm_cc_addFilterRejectRegexp(parent.name)
                 return
 
-- 
1.6.2

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux