[blivet] total_memory calculation needs to round up (#962231)

Brian C. Lane bcl at redhat.com
Wed May 15 17:43:00 UTC 2013


From: "Brian C. Lane" <bcl at redhat.com>

This matches the logic used by Anaconda's isys total_memory function.
---
 blivet/util.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/blivet/util.py b/blivet/util.py
index c27d9f3..1c39f56 100644
--- a/blivet/util.py
+++ b/blivet/util.py
@@ -129,6 +129,13 @@ def total_memory():
         if line.startswith("MemTotal:"):
             mem = long(line.split()[1])
 
+    # Because /proc/meminfo only gives us the MemTotal (total physical RAM
+    # minus the kernel binary code), we need to round this up. Assuming
+    # every machine has the total RAM MB number divisible by 128. */
+    mem /= 1024;
+    mem = (mem / 128 + 1) * 128;
+    mem *= 1024;
+
     return mem
 
 ##
-- 
1.8.1.4



More information about the anaconda-patches mailing list