On Thu, 2012-10-25 at 13:04 -0700, Brian C. Lane wrote:
From: "Brian C. Lane" <bcl(a)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.
I have some minor reservations about the case where there is at least
one valid disklabel but it isn't on the boot disk, but I think the
sanityCheck will catch that. This is certainly an improvement over
what's there now. ACK.
---
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()])
required_space = self.payload.spaceRequired
log.debug("disk free: %s fs free: %s sw needs: %s" % (disk_free,