summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
diff options
context:
space:
mode:
authorMichael Janczyk2010-06-04 15:03:10 +0200
committerMichael Janczyk2010-06-04 15:03:10 +0200
commitffbf58a3401a314cd38ef99d0d16602046fb6810 (patch)
tree6b1043c30b5d16b1f328fd44dd342bb103efbe95 /os-plugins/plugins/vmgrid/files/run-vmgrid.sh
parentfixes apt, ../archives/partial directry required (diff)
downloadcore-ffbf58a3401a314cd38ef99d0d16602046fb6810.tar.gz
core-ffbf58a3401a314cd38ef99d0d16602046fb6810.tar.xz
core-ffbf58a3401a314cd38ef99d0d16602046fb6810.zip
nice level, more host infos in virtualization.conf, copy to share dir in vmgrid
Diffstat (limited to 'os-plugins/plugins/vmgrid/files/run-vmgrid.sh')
-rw-r--r--os-plugins/plugins/vmgrid/files/run-vmgrid.sh37
1 files changed, 28 insertions, 9 deletions
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
index 9e3cbf0a..376e8182 100644
--- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
+++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
@@ -64,13 +64,14 @@ cleanexit () {
### Get XML file and dir
################################################################################
-# check if mem or graphical mode set
+# check if mem, nice or graphical mode set
headless=1
+unice=19
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
echo -e "Usage: run-vmgrid.sh [-g] [--mem <memory size in MB>] \c"
- echo -e "[/path/]filename[.xml]"
+ echo -e "[--nice <nice level>] [/path/]filename[.xml]"
exit
;;
-g)
@@ -78,8 +79,24 @@ while [ $# -gt 0 ]; do
;;
--mem)
# get a result which can be divided through 4
- forcemem=$2
- echo $2 | grep -q '[1-9][0-9]\{2,3\}$' && forcemem=$(expr $2 / 4 \* 4)
+ if echo $2 | grep -qE \
+ '^[2-9][0-9][0-9]$|^[1-9][0-9][0-9][0-9]$|^1[0-9][0-9][0-9][0-9]$';
+ then
+ forcemem=$(expr $2 / 4 \* 4)
+ else
+ echo "memory $2 not supported (200-19999)!"
+ exit 1
+ fi
+ shift
+ ;;
+ --nice)
+ # set nice level
+ if echo $2 | grep -qE '^-[1-9]$|-1[0-9]$|^-20$|^[0-9]$|^1[0-9]$'; then
+ unice=$2
+ else
+ echo "nice level $2 does not exist!"
+ exit 1
+ fi
shift
;;
*)
@@ -350,7 +367,7 @@ mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4)
# last two bytes are taken from the bridge of the host
# define one MAC per guest
macguestpart="00:50:56:${VM_ID}"
-machostpart=$(echo ${machostaddr} | awk -F ":" '{print $(NF-1)":"$NF}')
+machostpart=$(echo ${hostmacaddr} | awk -F ":" '{print $(NF-1)":"$NF}')
macaddr=$(echo "${macguestpart}:${machostpart}" | tr [a-z] [A-Z])
# ide is expected default, test for the virtual disk image type should
@@ -398,12 +415,14 @@ if [ ${headless} -eq 0 ]; then
writelog "Grapical mode not available, exiting!"
cleanexit 1
fi
- writelog "Starting ${vmgrid_virt} in graphical mode..."
- ${VIRTCMD} ${VIRTCMDOPTS} 2>/dev/null
+ writelog "Starting ${vmgrid_virt} in graphical mode /w nice level ${unice}..."
+ # start /w low nice level
+ nice -n ${unice} ${VIRTCMD} ${VIRTCMDOPTS} 2>/dev/null
# start headless
elif [ -n "${VIRTCMDHL}" ]; then
- writelog "Starting ${vmgrid_virt} in headless mode..."
- ${VIRTCMDHL} ${VIRTCMDOPTSHL} 2>/dev/null
+ writelog "Starting ${vmgrid_virt} in headless mode /w nice level ${unice}..."
+ # start /w low nice level
+ nice -n ${unice} ${VIRTCMDHL} ${VIRTCMDOPTSHL} 2>/dev/null
else
writelog "${vmgrid_virt}: No headless mode defined, exiting!"
cleanexit 1