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

[PATCH 3/3] filled in hasFreeDiskSpace (#683632)



(cherry picked from commit ac906ab97788ef7c8b5a4422a6d371700ca48948)
---
 storage/partitioning.py |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/storage/partitioning.py b/storage/partitioning.py
index 3f39d18..b9da732 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -1667,14 +1667,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]