From 2c15fd83ca7fee063d362b6c85171316b8d3370d Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Mon, 16 Feb 2015 11:41:30 +0100 Subject: [PATCH] Fix memory detection in ironic-discoverd-ramdisk It was actually detecting total _possible_ size, not real one. Change-Id: I9e96e0058d91734aa960d1b2f9663f8a9207f5d8 --- .../init.d/80-ironic-discoverd-ramdisk | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/elements/ironic-discoverd-ramdisk/init.d/80-ironic-discoverd-ramdisk b/elements/ironic-discoverd-ramdisk/init.d/80-ironic-discoverd-ramdisk index 30e607fa..2e98d181 100644 --- a/elements/ironic-discoverd-ramdisk/init.d/80-ironic-discoverd-ramdisk +++ b/elements/ironic-discoverd-ramdisk/init.d/80-ironic-discoverd-ramdisk @@ -43,9 +43,11 @@ update ".ipmi_address = \"$BMC_ADDRESS\"" CPU_ARCH=$(lscpu | grep Architecture | awk '{ print $2 }') update ".cpu_arch = \"$CPU_ARCH\"" -# NOTE(lucasagomes): dmidecode because we want to know the total -# memory in the system, even the reserved part to the BIOS -RAM=$(dmidecode -t 16 | grep 'Maximum Capacity' | awk '{if ($4 == "GB") s+=$3*1024; else s+=$3;} END {print s}') +RAM=0 +for i in $(dmidecode --type memory | grep Size | awk '{ print $2; }' | grep -E '[0-9]+'); +do + RAM=$(( RAM + $i )); +done update ".memory_mb = $RAM" CPUS=$(cat /proc/cpuinfo | grep processor | wc -l)