From 919dd453a69e060de0b8ec8cbb4e0151e722a4e9 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 17 Oct 2013 12:20:40 +0200 Subject: [PATCH] MT#4477 New boot option lowperformance to adjust system for VM usage Now having MT#4463 resolved let's also get rid of "Applying Vagrant performance optimisations for VM" steps from daily-build-vagrant. Implemented as separate boot option (independent from "vagrant" boot option) to apply it only for the VM 2XX builds (to e.g. not execute it on plain Debian systems). --- deployment.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/deployment.sh b/deployment.sh index 347a2d9..0cf8dd5 100755 --- a/deployment.sh +++ b/deployment.sh @@ -48,6 +48,7 @@ STATUS_DIRECTORY=/srv/deployment/ STATUS_WAIT=0 LVM=true VAGRANT=false +ADJUST_FOR_LOW_PERFORMANCE=false if [ -L /sys/block/vda ] ; then export DISK=vda # will be configured as /dev/vda @@ -351,6 +352,10 @@ fi if checkBootParam vagrant ; then VAGRANT=true fi + +if checkBootParam lowperformance ; then + ADJUST_FOR_LOW_PERFORMANCE=true +fi ## }}} ## interactive mode {{{ @@ -432,6 +437,7 @@ for param in $* ; do *ngcphalt*) HALT=true;; *ngcpreboot*) REBOOT=true;; *vagrant*) VAGRANT=true;; + *lowperformance*) ADJUST_FOR_LOW_PERFORMANCE=true;; esac shift done @@ -1745,6 +1751,28 @@ vagrant_configuration() { rm -f "${TARGET}/etc/udev/rules.d/70-persistent-net.rules" } +adjust_for_low_performance() { + # record configuration file changes + chroot "$TARGET" etckeeper commit "Snapshot before decreasing default resource usage [$(date)]" || true + chroot "$TARGET" bash -c "cd /etc/ngcp-config ; git commit -a -m \"Snapshot before decreasing default resource usage [$(date)]\" || true" + + echo "Decreasing default resource usage" + # sems + sed -i -e 's/media_processor_threads=10$/media_processor_threads=1/g' ${TARGET}/etc/ngcp-config/templates/etc/sems/sems.conf.tt2 + # kamailio + sed -i -e 's/tcp_children: 8$/tcp_children: 1/g' ${TARGET}/etc/ngcp-config/config.yml + sed -i -e 's/udp_children: 8$/udp_children: 1/g' ${TARGET}/etc/ngcp-config/config.yml + sed -i -e 's/children: 8$/children: 1/g' ${TARGET}/etc/ngcp-config/config.yml + # apache + sed -i -e 's/StartServers.*[0-9]$/StartServers 1/g' ${TARGET}/etc/apache2/apache2.conf + sed -i -e 's/MinSpareServers.*[0-9]$/MinSpareServers 1/g' ${TARGET}/etc/apache2/apache2.conf + sed -i -e 's/MaxSpareServers.*[0-9]$/MaxSpareServers 1/g' ${TARGET}/etc/apache2/apache2.conf + + # record configuration file changes + chroot "$TARGET" etckeeper commit "Snapshot after decreasing default resource usage [$(date)]" || true + chroot "$TARGET" bash -c "cd /etc/ngcp-config ; git commit -a -m \"Snapshot after decreasing default resource usage [$(date)]\" || true" +} + if "$RETRIEVE_MGMT_CONFIG" ; then echo "Nothing to do, /etc/hosts was already set up." else @@ -1757,6 +1785,11 @@ if $VAGRANT ; then vagrant_configuration fi +if $ADJUST_FOR_LOW_PERFORMANCE ; then + echo "Bootoption lowperformance present, executing adjust_for_low_performance" + adjust_for_low_performance +fi + if [ -n "$PUPPET" ] ; then echo "Rebuilding /etc/hosts" cat > $TARGET/etc/hosts << EOF