[PATCH 1/4] check disklabels when calculating free space (#863892)
Vratislav Podzimek
vpodzime at redhat.com
Fri Oct 26 08:45:34 UTC 2012
On Thu, 2012-10-25 at 13:04 -0700, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl at redhat.com>
>
> You need at least one of the platform's disklabels in order for the free
> space on the disk to be useful. If none of the disks labels will work we
> set the free space to 0 and allow the resize dialog to be used to remove
> all the partitions which will relabel the disk.
> ---
> pyanaconda/ui/gui/spokes/storage.py | 20 ++++++++++++++++----
> 1 file changed, 16 insertions(+), 4 deletions(-)
>
> diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
> index 14ea404..7aab762 100644
> --- a/pyanaconda/ui/gui/spokes/storage.py
> +++ b/pyanaconda/ui/gui/spokes/storage.py
> @@ -644,10 +644,22 @@ class StorageSpoke(NormalSpoke, StorageChecker):
> disks = [d for d in self.disks if d.name in self.selected_disks]
> disks_size = sum(Size(spec="%f MB" % d.size) for d in disks)
>
> - free_space = self.storage.getFreeSpace(disks=disks,
> - clearPartType=CLEARPART_TYPE_NONE)
> - disk_free = sum([f[0] for f in free_space.itervalues()])
> - fs_free = sum([f[1] for f in free_space.itervalues()])
> + # Figure out if the existing disk labels will work on this platform
> + # you need to have at least one of the platform's labels in order for
> + # any of the free space to be useful.
> + disk_labels = set([disk.format.labelType for disk in self.disks \
> + if hasattr(disk.format, "labelType")])
> + platform_labels = set(self.storage.platform.diskLabelTypes)
> + if disk_labels and platform_labels.isdisjoint(disk_labels):
> + disk_free = 0
> + fs_free = 0
> + log.debug("Need disklabel: %s have: %s" % (", ".join(platform_labels),
> + ", ".join(disk_labels)))
> + else:
> + free_space = self.storage.getFreeSpace(disks=disks,
> + clearPartType=CLEARPART_TYPE_NONE)
> + disk_free = sum([f[0] for f in free_space.itervalues()])
> + fs_free = sum([f[1] for f in free_space.itervalues()])
Shouldn't this change go directly to storage.getFreeSpace? If nothing
else text mode (in future) will make a use of it too I think.
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list