[PATCH 2/5] Add swapSameAsRam and use it for autopartitioning

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

 



Resolves: rhbz#744129
---
 constants.py    |    3 +++
 installclass.py |    2 +-
 iutil.py        |   15 +++++++++++++++
 3 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/constants.py b/constants.py
index 5ccc0f6..119102c 100644
--- a/constants.py
+++ b/constants.py
@@ -93,3 +93,6 @@ TRANSLATIONS_UPDATE_DIR="/tmp/updates/po"
 # number of retries before displaying an error dialog
 YUM_DOWNLOAD_RETRIES = 3
 YUM_DOWNLOAD_DELAY = 3
+
+#see rhbz#744129 for details
+SWAP_SIZE_LIMIT = 128 * 1024
diff --git a/installclass.py b/installclass.py
index a417762..9514097 100644
--- a/installclass.py
+++ b/installclass.py
@@ -191,7 +191,7 @@ class BaseInstallClass(object):
         if bootreq:
             autorequests.extend(bootreq)
 
-        (minswap, maxswap) = iutil.swapSuggestion()
+        (minswap, maxswap) = iutil.swapSameAsRam()
         autorequests.append(PartSpec(fstype="swap", size=minswap, maxSize=maxswap,
                                      grow=True, asVol=True))
 
diff --git a/iutil.py b/iutil.py
index a477172..f7254e2 100644
--- a/iutil.py
+++ b/iutil.py
@@ -479,6 +479,21 @@ def swapSuggestion(quiet=0):
 
     return (minswap, maxswap)
 
+def swapSameAsRam(quiet=0):
+    mem = memInstalled() / 1024
+    mem = ((mem / 16) + 1) * 16
+    if not quiet:
+        log.info("Detected %sM of memory", mem)
+
+    #see #rhbz587152
+    if mem <= SWAP_SIZE_LIMIT:
+        log.info("Swap attempt of %sM to %sM", mem, mem)
+        return (mem, mem)
+    else:
+        log.warning("Cannot create swap of size %sM, using upper bound %sM",
+                    mem, SWAP_SIZE_LIMIT)
+        return (SWAP_SIZE_LIMIT, SWAP_SIZE_LIMIT)
+
 ## Create a directory path.  Don't fail if the directory already exists.
 # @param dir The directory path to create.
 def mkdirChain(dir):
-- 
1.7.4.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux