Re: [PATCH] Enforce limits on the number of partitions on a disk.

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

 



On Thursday, May 28 2009, David Lehman said:
> @@ -120,6 +122,31 @@ def getLUKSPassphrase(intf, device, globalPassphrase):
>  
>      return (passphrase, isglobal)
>  
> +def handleDiskMaxPartitionsExceeded(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.
> +    """
> +    maxPartitionCount = device.partedDisk.maxPrimaryPartitionCount + \
> +                        device.partedDisk.getMaxLogicalPartitions()
> +    str = _("The drive %s has more than %d partitions on it,"
> +            "which is the maximum number of partitions for disk of "
> +            "this type. You will not be able to make changes to the "
> +            "partitioning of this disk or use any partitions beyond "
> +            "%s%d in %s") % (device.path, maxPartitionCount, device.name,
> +                             maxPartitionCount, productName)

This isn't entirely accurate -- if you're ignoring the disk, then we
can't mount it either, can we?

> @@ -1114,6 +1141,16 @@ class DeviceTree(object):
>              self.addIgnoredDisk(name)
>              return
>  
> +        # make sure the disk does not have more partitions than are supported
> +        if device.mediaPresent:
> +            maxPartitionCount = device.partedDisk.maxPrimaryPartitionCount + \
> +                                device.partedDisk.getMaxLogicalPartitions()
> +
> +            if len(device.partedDisk.partitions) > maxPartitionCount and \
> +               handleDiskMaxPartitionsExceeded(self.intf, device):
> +                self.addIgnoredDisk(name)
> +                return

Does disk.partitions still contain the weird metadata partitions (which
would then throw off this count)?

Jeremy

_______________________________________________
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