diff options
| author | Michael Janczyk | 2010-03-29 22:56:08 +0200 |
|---|---|---|
| committer | Michael Janczyk | 2010-03-29 22:56:08 +0200 |
| commit | 1f29892fec8d5a131dd5f9ff7971b7a902eabce6 (patch) | |
| tree | 6ad47efdce7a0751bd453b5fc0de8a5e61d1a140 /os-plugins/plugins/vmgrid/files | |
| parent | NAT TFTP boot with VBox. (diff) | |
| download | core-1f29892fec8d5a131dd5f9ff7971b7a902eabce6.tar.gz core-1f29892fec8d5a131dd5f9ff7971b7a902eabce6.tar.xz core-1f29892fec8d5a131dd5f9ff7971b7a902eabce6.zip | |
vmgrid graphical mode ;)
Diffstat (limited to 'os-plugins/plugins/vmgrid/files')
| -rw-r--r-- | os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 57 | ||||
| -rw-r--r-- | os-plugins/plugins/vmgrid/files/vmgrid | 11 |
2 files changed, 47 insertions, 21 deletions
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh index c300e9ce..21d7cbf8 100644 --- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh +++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh @@ -51,13 +51,28 @@ writelog () { ### Get XML file and dir ################################################################################ -# check if forcemem set -if [ "$1" = "--forcemem" ]; then - forcemem=$2 - xmlfile=$3 -else - xmlfile=$1 -fi +# check if forcemem or graphical mode set +while [ $# -gt 0 ]; do + case "$1" in + -h|--help) + echo -e "Usage: run-vmgrid.sh [-g] [--forcemem <memorysize in MB>] \c" + echo -e "[/path/]filename[.xml]" + exit + ;; + -g) + headless=0 + ;; + --forcemem) + forcemem=$2 + shift + ;; + *) + xmlfile=$@ + break + ;; + esac + shift +done # absolute or relative path? if ls ${xmlfile} 2>/dev/null | grep '/' >/dev/null 2>&1; then @@ -75,8 +90,8 @@ xmlfile="${xmlpath}/${xmlfile%.xml}.xml" # test if the xml file is valid if ! [ -r "${xmlfile}" ]; then - echo -e "Usage: run-vmgrid.sh [--forcemem <memorysize in MB>] \c" - echo -e "[/path/]filename[.xml]" + writelog "${xmlfile} not a readable XML file!" + run-vmgrid.sh -h & exit 1 fi @@ -299,7 +314,7 @@ hddrv="ide" # add rw share sharepath="${vmgrid_rwmnt}/folders/${vm_shortname}" mkdir -p ${sharepath} -chmod 1777 "${vmgrid_rwmnt}/folders" +chmod -f 1777 "${vmgrid_rwmnt}/folders" sharename="share" # set hostname: using original hostname and adding string @@ -326,22 +341,28 @@ else exit 1 fi +# start graphical mode +if [ ${headless} -eq 0 2>/dev/null ]; then + if [ -z "${VIRTCMD}" ]; then + writelog "Grapical mode not available, exiting" + exit 1 + fi + writelog "Starting ${vmgrid_virt} in graphical mode..." + ${VIRTCMD} ${VIRTCMDOPTS} # start headless -if [ -n "${VIRTCMDHL}" ]; then - writelog "Starting ${vmgrid_virt} headless..." - # TODO: for testing use VBox - VirtualBox - #${VIRTCMDHL} ${VIRTCMDOPTSHL} +elif [ -n "${VIRTCMDHL}" ]; then + writelog "Starting ${vmgrid_virt} in headless mode..." + ${VIRTCMDHL} ${VIRTCMDOPTSHL} else writelog "${vmgrid_virt}: No headless mode defined, exiting!" exit 1 fi -writelog "${vmgrid_virt} exited. Cleanning up...\c" if echo "${RMDIRS}" 2>/dev/null | grep ${vmgrid_virt} >/dev/null 2>&1; then + writelog "${vmgrid_virt} exited. Cleanning up...\c" rm -rf ${RMDIRS} >/dev/null 2>&1 + writelog "done" fi -writelog "done" -writelog "Bye." +echo -e "Bye." exit 0 diff --git a/os-plugins/plugins/vmgrid/files/vmgrid b/os-plugins/plugins/vmgrid/files/vmgrid index b60d8902..d93f4fbd 100644 --- a/os-plugins/plugins/vmgrid/files/vmgrid +++ b/os-plugins/plugins/vmgrid/files/vmgrid @@ -24,11 +24,13 @@ if [ -n "$1" ]; then if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then - echo "Usage: vmgrid [[/path/]filename[.xml]]" + echo -e "Usage: vmgrid [[-g] [--forcemem <memorysize in MB>] \c" + echo -e "[/path/]filename[.xml]]" exit 0 else - run-vmgrid.sh $@ & - exit 0 + echo "Starting run-vmgrid.sh with options '$@'" + run-vmgrid.sh $@ + exit fi fi @@ -66,6 +68,8 @@ writelog () { # start to log, create shrare log dir mkdir -m 1777 -p ${vmgrid_rwmnt}/logs +mkdir -m 1777 -p /tmp/vmgrid +mkdir -p /tmp/vmgrid/${USER} echo "Starting to log at $(date)" \ >${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log @@ -153,6 +157,7 @@ for i in {1..4}; do else writelog "Starting ${vm[$i]} via run-vmgrid.sh with ${vmmem[$i]} MB RAM" run-vmgrid.sh --forcemem ${vmmem[$i]} ${vm[$i]} & + echo $! > /tmp/vmgrid/${USER}/vmgrid.pids # wait 5 secs for the next vm to start sleep 5 fi |
