[PATCH 07/11] Let blkid/udev tell us which devices contain disklabels.

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

 



They will also tell us what type.
---
 pyanaconda/storage/devicetree.py |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/pyanaconda/storage/devicetree.py b/pyanaconda/storage/devicetree.py
index bc7d248..27963e8 100644
--- a/pyanaconda/storage/devicetree.py
+++ b/pyanaconda/storage/devicetree.py
@@ -1028,9 +1028,11 @@ class DeviceTree(object):
         device.originalFormat = device.format
 
     def handleUdevDiskLabelFormat(self, info, device):
-        log_method_call(self, device=device.name)
-        # if there is preexisting formatting on the device use it
-        if getFormat(udev_device_get_format(info)).type is not None:
+        disklabel_type = info.get("PART_TABLE_TYPE")
+        log_method_call(self, device=device.name, label_type=disklabel_type)
+        # if there is no disklabel on the device
+        if disklabel_type is None and \
+           getFormat(udev_device_get_format(info)).type is not None:
             log.debug("device %s does not contain a disklabel" % device.name)
             return
 
@@ -1051,15 +1053,12 @@ class DeviceTree(object):
             try:
                 format = getFormat("disklabel",
                                    device=device.path,
+                                   labelType=disklabel_type,
                                    exists=True)
             except InvalidDiskLabelError:
+                log.warning("disklabel detected but not usable on %s"
+                            % device.name)
                 pass
-            else:
-                if format.partitions:
-                    # parted's checks for disklabel presence are less than
-                    # rigorous, so we will assume that detected disklabels
-                    # with no partitions are spurious
-                    device.format = format
             return
 
         # if the disk contains protected partitions we will not wipe the
@@ -1101,6 +1100,8 @@ class DeviceTree(object):
                                                               description,
                                                               device.size)
 
+        # we're going to pass the "best" disklabel type into the DiskLabel
+        # constructor, but it only has meaning for non-existent disklabels.
         labelType = self.platform.bestDiskLabelType(device)
 
         try:
-- 
1.7.3.4

_______________________________________________
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