[PATCH 3/3] Check for disklabels on unpartitionable devices. (#539482)

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

 



If an unpartitionable device contains a disklabel we ignore any
partitions on that device, but we want to show that the device
does contain a partition table in UI.
---
 storage/devicetree.py |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/storage/devicetree.py b/storage/devicetree.py
index 6c956fc..e0b98b6 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1144,7 +1144,11 @@ class DeviceTree(object):
 
         # Check that the disk has partitions. If it does not, we must have
         # reinitialized the disklabel.
-        if not getattr(disk.format, "partitions", None):
+        #
+        # Also ignore partitions on devices we do not support partitioning
+        # of, like logical volumes.
+        if not getattr(disk.format, "partitions", None) or \
+           not disk.partitionable:
             log.debug("ignoring partition %s" % name)
             return
 
@@ -1340,6 +1344,18 @@ class DeviceTree(object):
             log.warning("aborting disklabel handler for %s" % device.name)
             return
 
+        # special handling for unsupported partitioned devices
+        if not device.partitionable:
+            try:
+                format = getFormat("disklabel",
+                                   device=device.path,
+                                   exists=True)
+            except InvalidDiskLabelError:
+                pass
+            else:
+                device.format = format
+            return
+
         # if the disk contains protected partitions we will not wipe the
         # disklabel even if clearpart --initlabel was specified
         if not self.clearPartDisks or device.name in self.clearPartDisks:
@@ -1711,11 +1727,12 @@ class DeviceTree(object):
         # Now, if the device is a disk, see if there is a usable disklabel.
         # If not, see if the user would like to create one.
         # XXX ignore disklabels on multipath or biosraid member disks
-        if device.partitionable and not \
-           (udev_device_is_biosraid(info) or
-            udev_device_is_multipath_member(info)):
+        if not udev_device_is_biosraid(info) and \
+           not udev_device_is_multipath_member(info):
             self.handleUdevDiskLabelFormat(info, device)
-            if device.partitioned or self.isIgnored(info):
+            if device.partitioned or self.isIgnored(info) or \
+               (not device.partitionable and
+                device.format.type == "disklabel"):
                 # If the device has a disklabel, or the user chose not to
                 # create one, we are finished with this device. Otherwise
                 # it must have some non-disklabel formatting, in which case
-- 
1.6.5.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