From b43fca1f775b508ab0e12312aa0a30350f5a25de Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Thu, 13 Mar 2014 15:33:07 +0000 Subject: [PATCH] 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 --- .../files/nodepool/scripts/restrict_memory.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/openstack_project/files/nodepool/scripts/restrict_memory.sh b/modules/openstack_project/files/nodepool/scripts/restrict_memory.sh index 0c3b369adf..332e2fcba8 100755 --- a/modules/openstack_project/files/nodepool/scripts/restrict_memory.sh +++ b/modules/openstack_project/files/nodepool/scripts/restrict_memory.sh @@ -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