[PATCH 3/3] Make sure inconsistencies don't screw us up.

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

 



I have seen instances where Udev says there is an lvm format in device
and also asserts that there is dmraid format in device# (the partition).
This tries to verify that all the parents of partitions (disks)  don't have
formats.
---
 storage/devicetree.py       |   12 ++++++++++++
 storage/formats/__init__.py |    4 ++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 8bc6aa7..f671dee 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1563,6 +1563,18 @@ class DeviceTree(object):
         for leaf in self.leaves:
             leafInconsistencies(leaf)
 
+        # Automatically handle the cases where we find a format on a
+        # disk with partitions.  I trust that the partitions list
+        # avoids the ignored devices.
+        for part in self.getDevicesByInstance(PartitionDevice):
+            if part.parents[0].format.type is not None:
+                format = formats.getFormat(None)
+                disk = part.parents[0]
+                log.debug("Automatically corrected fomrat error on %s. "
+                        "Changed from %s to %s." %
+                        (disk.name, disk.format, format))
+                disk.format = format
+
     def populate(self):
         """ Locate all storage devices. """
         # each iteration scans any devices that have appeared since the
diff --git a/storage/formats/__init__.py b/storage/formats/__init__.py
index e68684c..ac70afa 100644
--- a/storage/formats/__init__.py
+++ b/storage/formats/__init__.py
@@ -269,6 +269,10 @@ class DeviceFormat(object):
         log_method_call(self, device=self.device,
                         type=self.type, status=self.status)
 
+        # No action when the interface has not been implemented
+        if self.__class__.__name__== "DeviceFormat":
+            return
+
         if not self.exists:
             raise FormatSetupError("format has not been created")
 
-- 
1.6.0.6

_______________________________________________
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