diff options
author | Michael Janczyk | 2010-05-25 22:23:08 +0200 |
---|---|---|
committer | Michael Janczyk | 2010-05-25 22:23:08 +0200 |
commit | f2ebeaa58d6c52708d5d2f7969dfe6fb4edfaad1 (patch) | |
tree | a186f8334d93d415d0aece6acf732b65137b847f /os-plugins | |
parent | accidently moved if clause to use only one core /w 64 guests on 32 bit clients (diff) | |
download | core-f2ebeaa58d6c52708d5d2f7969dfe6fb4edfaad1.tar.gz core-f2ebeaa58d6c52708d5d2f7969dfe6fb4edfaad1.tar.xz core-f2ebeaa58d6c52708d5d2f7969dfe6fb4edfaad1.zip |
nice level added to vmgrid
Diffstat (limited to 'os-plugins')
-rw-r--r-- | os-plugins/plugins/virtualbox/files/run-virt.include | 6 | ||||
-rw-r--r-- | os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 30 | ||||
-rw-r--r-- | os-plugins/plugins/vmgrid/files/vmgrid | 2 |
3 files changed, 28 insertions, 10 deletions
diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include index f8a6ff79..9dbe47ac 100644 --- a/os-plugins/plugins/virtualbox/files/run-virt.include +++ b/os-plugins/plugins/virtualbox/files/run-virt.include @@ -43,7 +43,7 @@ export VBOX_USER_HOME=${confdir} RMDIRS="${snapshotdir} ${confdir} /tmp/.vbox-${USER}-ipc" rm -rf ${RMDIRS} 2>/dev/null machfolder="${confdir}/Machines" -# use vm_shortname for VM name since vm_name can be very long +# use vm_shortname for dir and config names since vm_name can be very long machconfig="${machfolder}/${vm_shortname}/${vm_shortname}.xml" diskfolder="${confdir}/HardDisks" snapshotdir=${machfolder}/${vm_shortname}/Snapshots @@ -233,8 +233,8 @@ case ${boot} in n*|tftp) boot="Network" if [ "${network_kind}" = "NAT" ] && [ -n "${virtualbox_tftpdir}" ]; then - # remove spaces from VM name to avoid Problems /w TFTP in NAT - vm_name=$(echo ${vm_name} | sed -e "s, ,-,g") + # use vm_shortname to avoid Problems /w TFTP in NAT + vm_name=${vm_shortname} # link TFTP dir for NAT TFTP boots mkdir -p ${confdir}/TFTP if [ -e ${virtualbox_tftpdir}/pxelinux.0 ]; then diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh index 9e3cbf0a..b4830dc9 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,10 +79,25 @@ 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 *) xmlfile=$@ break @@ -399,11 +415,13 @@ if [ ${headless} -eq 0 ]; then cleanexit 1 fi writelog "Starting ${vmgrid_virt} in graphical mode..." - ${VIRTCMD} ${VIRTCMDOPTS} 2>/dev/null + # 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 + # start /w low nice level + nice -n ${unice} ${VIRTCMDHL} ${VIRTCMDOPTSHL} 2>/dev/null else writelog "${vmgrid_virt}: No headless mode defined, exiting!" cleanexit 1 diff --git a/os-plugins/plugins/vmgrid/files/vmgrid b/os-plugins/plugins/vmgrid/files/vmgrid index 2ddfc5a0..9450ecf7 100644 --- a/os-plugins/plugins/vmgrid/files/vmgrid +++ b/os-plugins/plugins/vmgrid/files/vmgrid @@ -25,7 +25,7 @@ if [ -n "$1" ]; then if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then echo -e "Usage: vmgrid [[-g] [--mem <memory size in MB>] \c" - echo -e "[/path/]filename[.xml]]" + echo -e "[--nice <nice level>] [/path/]filename[.xml]]" exit 0 else echo "Starting run-vmgrid.sh with options '$@'" |