diff options
author | Michael Janczyk | 2010-04-09 22:07:25 +0200 |
---|---|---|
committer | Michael Janczyk | 2010-04-09 22:07:25 +0200 |
commit | e530a41bf4ef1b84917cd1295d5aaf30051e42c9 (patch) | |
tree | 70c4a122edf9590e4aa0ca1b71845099800ab4e6 /os-plugins/plugins/vmgrid/files/run-vmgrid.sh | |
parent | Merge branch 'master' of git@openslx.org:openslx/core (diff) | |
download | core-e530a41bf4ef1b84917cd1295d5aaf30051e42c9.tar.gz core-e530a41bf4ef1b84917cd1295d5aaf30051e42c9.tar.xz core-e530a41bf4ef1b84917cd1295d5aaf30051e42c9.zip |
qemukvm network configuration
Diffstat (limited to 'os-plugins/plugins/vmgrid/files/run-vmgrid.sh')
-rw-r--r-- | os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh index bf10dc36..5e64b4cd 100644 --- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh +++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh @@ -39,11 +39,12 @@ RWSHARE=/var/opt/openslx/plugins/vmgrid/share ################################################################################ # function to write to stdout and logfile +LOGFILE=${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log writelog () { # write to stdout echo -e "$1" # log into file - echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log + echo -e "$1" >> ${LOGFILE} # log into share dir, so that log is available in vm as well echo -e "$1" >> ${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log } @@ -66,7 +67,8 @@ while [ $# -gt 0 ]; do ;; --forcemem) # get a result which can be divided through 4 - forcemem=$(expr $2 / 4 \* 4) + forcemem=$2 + echo $2 | grep -q '[1-9][0-9]\{2,3\}$' && forcemem=$(expr $2 / 4 \* 4) shift ;; *) @@ -113,7 +115,7 @@ if [ "${vmgrid_virt}" = "xen" ]; then runningvms=$(expr ${runningvms} + 1) fi # check value -if [ $runningvms -le 0 ]; then +if [ ${runningvms} -le 0 ]; then writelog "Error in value: Running VMs: ${runningvms}. Exit!" exit 1 fi @@ -288,9 +290,9 @@ vmostype=$(grep -io '<os param=.*"' ${xmlfile} | awk -F '"' '{ print $2 }' \ # definition of the networking the client system is connected to network_kind=$(grep -io 'network param=.*"' ${xmlfile} \ - | awk -F '"' '{ print $2 }') + | awk -F '"' '{ print $2 }' | tr [A-Z] [a-z]) network_card=$(grep -io 'netcard param=.*"' ${xmlfile} \ - | awk -F '"' '{ print $2 }') + | awk -F '"' '{ print $2 }'| tr [A-Z] [a-z]) writelog "\tVirtualization:\t\t$xmlvirt" writelog "\tVM name:\t\t$vm_name" @@ -320,8 +322,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=$($(which ifconfig) br0 | grep br0 | sed -e "s/ //g" \ - | awk -F ":" '{print $(NF-1)":"$NF}') +machostpart=$(echo ${machostaddr} | 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 @@ -378,6 +379,11 @@ else exit 1 fi +# postrun for scripts after virtualization finishes +if [ -n "${POSTRUN}" ]; then + eval ${POSTRUN} >/dev/null 2>&1 +fi + # remove config dirs when finished if echo "${RMDIRS}" 2>/dev/null | grep -q ${vmgrid_virt}; then writelog "${vmgrid_virt} exited. Cleanning up... \c" |