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

[PATCH] filled in hasFreeDiskSpace



This is for defect 683632.  This was tested on the Fedora 15 beta.

---
 pyanaconda/storage/partitioning.py |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/storage/partitioning.py b/pyanaconda/storage/partitioning.py
index bddca32..5bd2acd 100644
--- a/pyanaconda/storage/partitioning.py
+++ b/pyanaconda/storage/partitioning.py
@@ -1643,14 +1643,24 @@ def hasFreeDiskSpace(storage, exclusiveDisks=None):
        the disks.  False otherwise.
 
     """
-    # FIXME: This function needs to be implemented.  It is used, at least, by
-    # iw/partition_gui.py.  It should be implemented after the new
-    # doPartitioning code is commited for fedora 13.  Since it returns True
-    # the user will always be able to access the create partition screen. If
-    # no partition can be created, the user will go back to the previous
-    # storage state after seeing a warning message.
-    return True
 
+    hasFreeSpace = False
+    disks = storage.partitioned
+
+    if exclusiveDisks:
+        disks = [d for d in disks if d.name in exclusiveDisks]
+
+    for disk in disks:
+        if storage.config.clearPartDisks and \
+           (disk.name not in storage.config.clearPartDisks):
+            continue
+
+        for part in disk.format.partedDisk.getFreeSpacePartitions():
+            if part.getSize(unit="MB") >= 100:
+                hasFreeSpace = True
+                break
+
+    return hasFreeSpace
 
 def lvCompare(lv1, lv2):
     """ More specifically defined lvs come first.
-- 
1.7.1


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