[blivet:master 04/20] Do not calculate Sizes unless they are needed.

mulhern amulhern at redhat.com
Tue Dec 23 23:42:17 UTC 2014


Signed-off-by: mulhern <amulhern at redhat.com>
---
 blivet/devicelibs/swap.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/blivet/devicelibs/swap.py b/blivet/devicelibs/swap.py
index 4e31cdb..28c8d2a 100644
--- a/blivet/devicelibs/swap.py
+++ b/blivet/devicelibs/swap.py
@@ -137,23 +137,20 @@ def swapSuggestion(quiet=False, hibernation=False, disk_space=None):
     if not quiet:
         log.info("Detected %s of memory", mem)
 
-    two_GiB = Size("2GiB")
-    four_GiB = Size("4GiB")
-    eight_GiB = Size("8GiB")
     sixtyfour_GiB = Size("64 GiB")
 
     #chart suggested in the discussion with other teams
-    if mem < two_GiB:
+    if mem < Size("2 GiB"):
         swap = 2 * mem
 
-    elif mem < eight_GiB:
+    elif mem < Size("8 GiB"):
         swap = mem
 
     elif mem < sixtyfour_GiB:
         swap = mem / 2
 
     else:
-        swap = four_GiB
+        swap = Size("4 GiB")
 
     if hibernation:
         if mem <= sixtyfour_GiB:
-- 
1.9.3



More information about the anaconda-patches mailing list