Restrict nodepool memory only when possible

* .../files/nodepool/scripts/restrict_memory.sh: We have different
bootloader versions/implementations on different providers and
platforms, and in some cases may even have no accessible bootloader
configuration at all we can modify. Make this script more adaptable
and make sure it does not cause image builds to fail when run in
those situations.

Change-Id: If47fcdb60142d38d604a8f49be7885e61df8f34b
This commit is contained in:
Jeremy Stanley 2014-03-13 15:33:07 +00:00
parent 6894c3ffaa
commit b43fca1f77

View File

@ -18,11 +18,10 @@
# Limit all test slaves to 8GB of memory so that larger flavors with more
# cpu resources can be used without the risk of becoming dependent on more
# memory.
OS_FACT=$(facter operatingsystem)
if [ "$OS_FACT" == "Ubuntu" ] ; then
if [ -f /etc/default/grub ] ; then
sudo sed -i -e 's/^GRUB_TIMEOUT=[0-9]\+/GRUB_TIMEOUT=0/' -e 's/#\?GRUB_CMDLINE_LINUX=""/GRUB_CMDLINE_LINUX="mem=8G"/g' /etc/default/grub
sudo update-grub
elif [ "$OS_FACT" == "CentOS" ] || [ "$OS_FACT" == "Fedora" ] ; then
elif [ -f /boot/grub/grub.conf ] ; then
sudo sed -i -e 's/^timeout=[0-9]\+/timeout=0/' -e 's/\(^\s\+kernel.*\)/\1 mem=8G/' /boot/grub/grub.conf
fi