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

Vratislav Podzimek vpodzime at redhat.com
Thu Oct 10 14:26:52 UTC 2013


Related: rhbz##1016673

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

diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index bdfb3e3..f85c37b 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,16 @@ class StorageSpoke(NormalSpoke, StorageChecker):
         # user may have set up before now.
         self.storage.config.clearNonExistent = self.data.autopart.autopart
 
+        # refresh swap size suggestion with currently selected disks
+        swap_request = None
+        for request in self.storage.autoPartitionRequests:
+            if request.fstype == "swap":
+                swap_request = request
+                break
+
+        disk_space = getAvailableDiskSpace(self.storage)
+        swap_request.size = swap_lib.swapSuggestion(disk_space=disk_space)
+
     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.7.11.7



More information about the anaconda-patches mailing list