On Wed, 2013-05-15 at 10:43 -0700, Brian C. Lane wrote:
From: "Brian C. Lane" <bcl(a)redhat.com>
This matches the logic used by Anaconda's isys total_memory function.
Looks okay to me.
---
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
##