[PATCH 1/6] Enforce libata's 15 partition maximum for scsi disks.

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

 



---
 storage/devices.py    |    4 ++++
 storage/devicetree.py |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 0 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 080cd7f..d01fcc7 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -798,6 +798,10 @@ class DiskDevice(StorageDevice):
         if not self.mediaPresent:
             raise DeviceError("cannot commit to disk %s which has no media" % self.name)
 
+        if self.name.startswith("sd") and \
+           self.partedDisk.lastPartitionNumber > 15:
+            raise DeviceError("disk %s has too many partitions" % self.name)
+
         self.setupParents()
         self.setup()
 
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 8c41c50..3b3db92 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -21,6 +21,7 @@
 #
 
 import os
+import sys
 import block
 import re
 
@@ -30,6 +31,7 @@ from deviceaction import *
 import formats
 from udev import *
 from iutil import log_method_call
+from constants import productName
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -117,6 +119,35 @@ def getLUKSPassphrase(intf, device, globalPassphrase):
 
     return (passphrase, isglobal)
 
+def handleDiskWithTooManyPartitions(intf, device):
+    """ Ask user how to handle disk with too many partitions.
+
+        Choices are to ignore the disk or to exit the installer.
+
+        A return value of True indicates the user wants to continue with
+        installation without using this device.
+    """
+    str = None
+    if device.name.startswith('sd'):
+        # SCSI disks can't have more than 15 partitions (libata limit)
+        str = _("The drive %s has more than 15 partitions on it."
+                "The SCSI subsystem in the Linux kernel does not "
+                "allow for more than 15 partitons at this time.  You "
+                "will not be able to make changes to the partitioning "
+                "of this disk or use any partitions beyond %s15 "
+                "in %s") % (device.path, device.path, productName)
+
+    if str:
+        rc = intf.messageWindow(_("Warning"), str,
+                            type="custom",
+                            custom_buttons = [_("_Reboot"),
+                                              _("_Ignore")],
+                            custom_icon="warning")
+        if rc == 0:
+            sys.exit(0)
+        else:
+            return True
+
 # Don't really know where to put this.
 def questionInitializeDisk(intf=None, name=None):
     retVal = False # The less destructive default
@@ -1088,6 +1119,13 @@ class DeviceTree(object):
             self.addIgnoredDisk(name)
             return
 
+        # check for more than 15 partitions (libata limit)
+        if device.name.startswith('sd') and device.mediaPresent and \
+           device.partedDisk.lastPartitionNumber > 15 and \
+           handleDiskWithTooManyPartitions(self.intf, device):
+            self.addIgnoredDisk(name)
+            return
+
         self._addDevice(device)
         return device
 
-- 
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