From 3f82922eef9a7b3e894d629d6cac59cadb66e2de Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Mon, 22 Mar 2010 19:06:22 +0100 Subject: small bugfix regarding xmlfile and paths. writelog now additional into rwshare. virtualbox rmdirs new. qemukvm plugin added new konfigurations and headless support, to be tested --- os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 42 ++++++++++++++------------- os-plugins/plugins/vmgrid/files/vmgrid | 30 ++++++++++--------- 2 files changed, 39 insertions(+), 33 deletions(-) (limited to 'os-plugins/plugins/vmgrid/files') diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh index 4a09f237..18e62ea0 100644 --- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh +++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh @@ -17,24 +17,13 @@ . /etc/opt/openslx/openslx.conf -################################################################################ -### Functions used throughout the script -################################################################################ - -# function to write to stdout and logfile -writelog () { - # write to stdout - echo -e "$1" - # log into file - echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log -} - ################################################################################ ### Define default dirs / get configs ################################################################################ PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins PLUGINCONFVMGRID=${PLUGINCONFROOT}/vmgrid +RWSHARE=/var/opt/openslx/plugins/vmgrid/share # include general configuration from vmgrid [ -f ${PLUGINCONFVMGRID}/vmgrid.conf ] && \ . ${PLUGINCONFVMGRID}/vmgrid.conf @@ -44,22 +33,37 @@ PLUGINCONFVMGRID=${PLUGINCONFROOT}/vmgrid [ -f ${PLUGINCONFROOT}/vmchooser/vmchooser.conf ] && \ . ${PLUGINCONFROOT}/vmchooser/vmchooser.conf +################################################################################ +### Functions used throughout the script +################################################################################ + +# function to write to stdout and logfile +mkdir -p ${RWSHARE}/var/log/openslx 2>/dev/null +writelog () { + # write to stdout + echo -e "$1" + # log into file + echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log + # log into share dir, so that log is available in vm as well + echo -e "$1" >> ${RWSHARE}/var/log/openslx/run-vmgrid.${USER}.$$.log +} + ################################################################################ ### Get XML file and dir ################################################################################ # check if forcemem set -# TODO: klappt noch nicht immer :( if [ "$1" = "--forcemem" ]; then forcemem=$2 - xmlfile=${3##*/} + xmlfile=$3 else - xmlfile=${1##*/} + xmlfile=$1 fi # absolute or relative path? -if ls ${1} 2>/dev/null | grep '/' >/dev/null 2>&1; then - xmlpath=$(dirname ${1}) +if ls ${xmlfile} 2>/dev/null | grep '/' >/dev/null 2>&1; then + xmlpath=$(dirname ${xmlfile}) + xmlfile=$(basename ${xmlfile}) else xmlpath=${vmgrid_xmlpath} fi @@ -265,8 +269,6 @@ ide="TRUE" scsi="FALSE" hddrv="ide" -# TODO: vncclient IP:59001 oder Plugin? - # add rw share rwshare="/var/opt/openslx/plugins/vmgrid/share" @@ -296,7 +298,7 @@ fi # start headless if [ -n "${VIRTCMDHL}" ]; then - writelog "Starting ${vmgrid_virt} head-less..." + writelog "Starting ${vmgrid_virt} headless..." ${VIRTCMDHL} ${VIRTCMDOPTSHL} else writelog "${vmgrid_virt}: No headless mode defined, exiting!" diff --git a/os-plugins/plugins/vmgrid/files/vmgrid b/os-plugins/plugins/vmgrid/files/vmgrid index 66291aea..7257226e 100644 --- a/os-plugins/plugins/vmgrid/files/vmgrid +++ b/os-plugins/plugins/vmgrid/files/vmgrid @@ -27,29 +27,18 @@ if [ -n "$1" ]; then echo "Usage: vmgrid [[/path/]filename[.xml]]" exit 0 else - run-vmgrid.sh $1 & + run-vmgrid.sh $@ & exit 0 fi fi -################################################################################ -### Functions used throughout the script -################################################################################ - -# function to write to stdout and logfile -writelog () { - # write to stdout - echo -e "$1" - # log into file - echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log -} - ################################################################################ ### Define default dirs / get configs ################################################################################ PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins PLUGINCONFDIR=${PLUGINCONFROOT}/vmgrid +RWSHARE=/var/opt/openslx/plugins/vmgrid/share # include general configuration from vmgrid [ -f ${PLUGINCONFDIR}/vmgrid.conf ] && \ . ${PLUGINCONFDIR}/vmgrid.conf @@ -57,6 +46,21 @@ PLUGINCONFDIR=${PLUGINCONFROOT}/vmgrid [ -f ${PLUGINCONFROOT}/vmchooser/vmchooser.conf ] && \ . ${PLUGINCONFROOT}/vmchooser/vmchooser.conf +################################################################################ +### Functions used throughout the script +################################################################################ + +# function to write to stdout and logfile +mkdir -p ${RWSHARE}/var/log/openslx 2>/dev/null +writelog () { + # write to stdout + echo -e "$1" + # log into file + echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log + # log into share dir, so that log is available in vm as well + echo -e "$1" >> ${RWSHARE}/var/log/openslx/run-vmgrid.${USER}.$$.log +} + ################################################################################ ### Configure VMs for autostart and set RAM ################################################################################ -- cgit v1.2.3-55-g7522