[master/rhel7] Refresh swap suggestion once we know which disks to use

Brian C. Lane bcl at redhat.com
Thu Oct 10 15:13:47 UTC 2013


From: Vratislav Podzimek <vpodzime at redhat.com>

Related: rhbz##1016673

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/gui/spokes/storage.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index bdfb3e3..43b1bf6 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -51,12 +51,13 @@ from pyanaconda.ui.gui.spokes.lib.resize import ResizeDialog
 from pyanaconda.ui.gui.categories.system import SystemCategory
 from pyanaconda.ui.gui.utils import enlightbox
 
-from pyanaconda.kickstart import doKickstartStorage
+from pyanaconda.kickstart import doKickstartStorage, getAvailableDiskSpace
 from blivet import empty_device
 from blivet.size import Size
 from blivet.devices import MultipathDevice
 from blivet.errors import StorageError
 from blivet.platform import platform
+from blivet.devicelibs import swap as swap_lib
 from pyanaconda.threads import threadMgr, AnacondaThread
 from pyanaconda.product import productName
 from pyanaconda.flags import flags
@@ -406,6 +407,13 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         # user may have set up before now.
         self.storage.config.clearNonExistent = self.data.autopart.autopart
 
+        # refresh the autopart swap size suggestion with currently selected disks
+        for request in self.storage.autoPartitionRequests:
+            if request.fstype == "swap":
+                disk_space = getAvailableDiskSpace(self.storage)
+                request.size = swap_lib.swapSuggestion(disk_space=disk_space)
+                break
+
     def execute(self):
         # Spawn storage execution as a separate thread so there's no big delay
         # going back from this spoke to the hub while StorageChecker.run runs.
-- 
1.8.3.1



More information about the anaconda-patches mailing list