[PATCH 2/4] Make sure inconsistencies dont screw us up.

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

 



I have seen instances where Udev says that there is a valid format on
top of a device that has partitions.  This is due to left over metadata
from other installs.  In these cases we will prefer the partitions.
---
 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 2963726..319c5af 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1568,6 +1568,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.warning("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