Fix memory detection in ironic-discoverd-ramdisk

It was actually detecting total _possible_ size, not real one.

Change-Id: I9e96e0058d91734aa960d1b2f9663f8a9207f5d8
This commit is contained in:
Dmitry Tantsur 2015-02-16 11:41:30 +01:00
parent bbeafa80bf
commit 2c15fd83ca

View File

@ -43,9 +43,11 @@ update ".ipmi_address = \"$BMC_ADDRESS\""
CPU_ARCH=$(lscpu | grep Architecture | awk '{ print $2 }') CPU_ARCH=$(lscpu | grep Architecture | awk '{ print $2 }')
update ".cpu_arch = \"$CPU_ARCH\"" update ".cpu_arch = \"$CPU_ARCH\""
# NOTE(lucasagomes): dmidecode because we want to know the total RAM=0
# memory in the system, even the reserved part to the BIOS for i in $(dmidecode --type memory | grep Size | awk '{ print $2; }' | grep -E '[0-9]+');
RAM=$(dmidecode -t 16 | grep 'Maximum Capacity' | awk '{if ($4 == "GB") s+=$3*1024; else s+=$3;} END {print s}') do
RAM=$(( RAM + $i ));
done
update ".memory_mb = $RAM" update ".memory_mb = $RAM"
CPUS=$(cat /proc/cpuinfo | grep processor | wc -l) CPUS=$(cat /proc/cpuinfo | grep processor | wc -l)