From 4f30ed99307f55ae8b1f5c9fd6377bf6b3122750 Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Tue, 13 Apr 2010 22:07:37 +0200 Subject: disable audio when using vmgrid --- .../plugins/virtualbox/files/machine.include | 2 +- .../plugins/virtualbox/files/run-virt.include | 3 ++- .../plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm | 26 +++++++++++----------- os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 1 + os-plugins/plugins/vmgrid/files/vmgrid | 17 +++++++++----- 5 files changed, 28 insertions(+), 21 deletions(-) diff --git a/os-plugins/plugins/virtualbox/files/machine.include b/os-plugins/plugins/virtualbox/files/machine.include index 0482d03a..1544d4d6 100644 --- a/os-plugins/plugins/virtualbox/files/machine.include +++ b/os-plugins/plugins/virtualbox/files/machine.include @@ -59,7 +59,7 @@ cat << EOF > "${machconfig}" - + diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include index f846a442..b2c55c0d 100644 --- a/os-plugins/plugins/virtualbox/files/run-virt.include +++ b/os-plugins/plugins/virtualbox/files/run-virt.include @@ -284,6 +284,7 @@ cdrom1=${cdtest:-"FALSE"} # be done while creating the runscripts ... ide="TRUE" hddrv="ide" +audio=${audio:-"true"} [ ${diskless} -eq 0 ] && writelog "\tSnapshots dir:\t\t$snapshotdir" writelog "Diskimage:" @@ -371,6 +372,6 @@ done VIRTCMD=$(which VirtualBox 2>/dev/null) VIRTCMDOPTS="--startvm ${machineuuid} --start-running" -# set headless mode +# set headless mode (-v off to disable vrdp) VIRTCMDHL=$(which VBoxHeadless 2>/dev/null) VIRTCMDOPTSHL="-s ${machineuuid}" diff --git a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm index d73e0720..401a2151 100644 --- a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm +++ b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm @@ -133,7 +133,7 @@ sub getAttrInfo content_descr => 'name of xml file e.g. scilin-5.4-wn(.xml)', default => undef, }, - 'vmgrid::hvm' => { + 'vmgrid::vt' => { applies_to_systems => 1, applies_to_clients => 1, description => unshiftHereDoc(<<' End-of-Here'), @@ -249,7 +249,7 @@ sub _writeRunlevelScript my $self = shift; my $initfile = newInitFile(); - $initfile->setName("vmgrid-slx"); + $initfile->setName("vmgrid"); $initfile->setDesc("Setup environment for vmgrid. Part of OpenSLX vmgrid plugin."); # todo: Function need to be formated proper... not important right now @@ -258,16 +258,16 @@ sub _writeRunlevelScript # 'lsmod | grep -q "$1[^_-]"' #); - # Is a VM running? - my $runningvms = unshiftHereDoc(<<' End-of-Here'); - if [ -e /tmp/vmgrid/vmgrid.pids ]; then - for pid in $(cat /tmp/vmgrid/vmgrid.pids); do - if ps aux | grep " ${pid} " | grep vmgrid; then - echo "Running: ${pid}" - fi - done - fi - End-of-Here +# # Is a VM running? +# my $runningvms = unshiftHereDoc(<<' End-of-Here'); +# if [ -e /tmp/vmgrid/vmgrid.pids ]; then +# for pid in $(cat /tmp/vmgrid/vmgrid.pids); do +# if ps aux | grep " ${pid} " | grep vmgrid; then +# echo "Running: ${pid}" +# fi +# done +# fi +# End-of-Here # Kill all VMS! my $killvms = unshiftHereDoc(<<' End-of-Here'); @@ -312,7 +312,7 @@ sub _writeRunlevelScript 'stop && start' ); - # get distro version +# # get distro version # my $distro = (split('-',$self->{'os-plugin-engine'}->distroName()))[0]; # my $runlevelscript = getInitFileForDistro($initfile, $distro); # diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh index 1501749e..a684310b 100644 --- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh +++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh @@ -331,6 +331,7 @@ macaddr=$(echo "${macguestpart}:${machostpart}" | tr [a-z] [A-Z]) ide="TRUE" scsi="FALSE" hddrv="ide" +audio="false" # add rw share sharepath="${vmgrid_rwmnt}/folders/${vm_shortname}" diff --git a/os-plugins/plugins/vmgrid/files/vmgrid b/os-plugins/plugins/vmgrid/files/vmgrid index d8ccd938..77efe4e0 100644 --- a/os-plugins/plugins/vmgrid/files/vmgrid +++ b/os-plugins/plugins/vmgrid/files/vmgrid @@ -57,9 +57,9 @@ writelog () { # write to stdout echo -e "$1" # log into file - echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log + echo -e "$1" >> ${OPENSLX_DEFAULT_LOGDIR}/vmgrid.${USER}.$$.log # log into share dir, so that log is available in vm as well - echo -e "$1" >> ${vmgrid_rwmnt}/logs/run-vmgrid.${USER}.$$.log + echo -e "$1" >> ${vmgrid_rwmnt}/logs/vmgrid.${USER}.$$.log } ################################################################################ @@ -71,7 +71,7 @@ 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 + >${vmgrid_rwmnt}/logs/vmgrid.${USER}.$$.log if [ -z "${hostratio}" ]; then writelog "There has been an error in the memory configuration in stage 3" @@ -111,7 +111,7 @@ for i in {1..4}; do # calculate VMs mem: mem = $freemem * $vmratio/100 * 100/$restratio # multiple of 4 vmmem[$i]=$(expr ${freemem} \* ${vmratio[$i]} / ${restratio} / 4 \* 4 \ - 2>/dev/null) + 2>/dev/null) if [ -n "${vm[$i]}" ] && [ ${vmmem[$i]} -lt 512 2>/dev/null ]; then writelog "Not enough free RAM for ${vm[$i]} (min. 512 MB), \c" writelog "free: ${vmmem[$i]} MB" @@ -126,8 +126,13 @@ done # start vms for i in {1..4}; do if [ -n "${vm[$i]}" ]; then - alreadyrunning=$(ps aux | grep run-vmgrid.sh | grep -v grep | \ - grep "${vm[$i]}" | wc -l) + alreadyrunning=$(ps aux | grep run-vmgrid.sh | grep -v grep \ + | grep "${vm[$i]}" | wc -l) + # if Xen use different method + if [ "${vmgrid_virt}" = "xen" ]; then + alreadyrunning=$(xm list 2>/dev/null | grep -vE "Domain-0|Name.*ID" \ + | grep "${vm[$i]}-0.$" | wc -l) + fi if [ ${alreadyrunning} -gt 0 2>/dev/null ]; then writelog "${vm[$i]} already running, skipping!" else -- cgit v1.2.3-55-g7522