From 0921974c54dbf828c2f427c304b43470798a5322 Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Sun, 9 May 2010 20:56:34 +0200 Subject: smaller changes --- .../plugins/virtualbox/files/run-virt.include | 6 ++-- .../init-hooks/80-after-plugins/virtualization.sh | 8 +++--- .../plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm | 32 ++++++++++------------ os-plugins/plugins/vmgrid/files/run-vmgrid.sh | 14 +++++----- os-plugins/plugins/vmgrid/files/vmgrid | 4 +-- .../init-hooks/80-after-plugins/virtualization.sh | 8 +++--- 6 files changed, 33 insertions(+), 39 deletions(-) (limited to 'os-plugins/plugins') diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include index 2091f79e..4a1e2c14 100644 --- a/os-plugins/plugins/virtualbox/files/run-virt.include +++ b/os-plugins/plugins/virtualbox/files/run-virt.include @@ -136,7 +136,8 @@ imageuuid=${snapshotuuid} if echo "${imgmode}" | grep -q rw; then # lock existing? if [ -e "${vmpath}.lock" ]; then - writelog "This rw image is already in use: ${vmpath}, exiting!" + writelog "This rw image is already in use." + writelog "Found lock in: ${vmpath}.lock, exiting!" writelog "Remove lock if you are sure that this is not the case" cleanexit 1 # image rw? @@ -158,9 +159,6 @@ elif [ ${diskless} -eq 0 ]; then | gunzip > "${snapshotdir}/{${snapshotuuid}}.vdi" fi -# make sure cpu_cores is not empty -cpu_cores=${cpu_cores:-"1"} - # TODO: MEM muss noch angepasst werden. Maschine crasht wenn nehr als 50% MEM # memory part equal to vmware plugin # percentage of memory to use for virtualbox in standard case diff --git a/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh b/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh index a1da2e63..37576331 100644 --- a/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh +++ b/os-plugins/plugins/vmchooser/init-hooks/80-after-plugins/virtualization.sh @@ -25,9 +25,9 @@ PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization # check if plugins available active=0 [ -f ${CONFFILEVMCHOOSER} ] && . ${CONFFILEVMCHOOSER} -[ ${vmchooser_active} -ne 0 ] && active=1 +[ "x${vmchooser_active}" = "x1" ] && active=1 [ -f ${CONFFILEVMGRID} ] && . ${CONFFILEVMGRID} -[ ${vmgrid_active} -ne 0 ] && active=1 +[ "x${vmgrid_active}" = "x1" ] && active=1 [ $DEBUGLEVEL -gt 0 ] \ && echo -e "Executing the 'virtualization' plugin ... \c" @@ -46,7 +46,7 @@ if [ ${active} -ne 0 ] ; then | awk '{print $2}') / 1024) echo "totalmem=${totalmem}" >> ${PLUGINCONFDIR}/virtualization.conf - if [ ${vmgrid_active} -ne 0 ]; then + if [ "x${vmgrid_active}" = "x1" ]; then totalmemtest=$(expr $(echo ${vmgrid_memratio} \ | awk -F ',' '{print $1" + "$2" + "$3" + "$4" + "$5" + "$6}')) @@ -63,7 +63,7 @@ if [ ${active} -ne 0 ] ; then fi # main vm mem (vmchooser) - if [ ${vmchooser_active} -ne 0 ]; then + if [ "x${vmchooser_active}" = "x1" ]; then mainvirtratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $5}') mainvirtmem=$(expr ${totalmem} \* ${mainvirtratio} / 100 2>/dev/null) if [ ${mainvirtmem} -lt 512 2>/dev/null ]; then diff --git a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm index c3542274..d90a6f53 100644 --- a/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm +++ b/os-plugins/plugins/vmgrid/OpenSLX/OSPlugin/vmgrid.pm @@ -1,4 +1,4 @@ -# Copyright (c) 2008, 2009 - OpenSLX GmbH +# Copyright (c) 2008, 2010 - OpenSLX GmbH # # This program is free software distributed under the GPL version 2. # See http://openslx.org/COPYING @@ -6,7 +6,7 @@ # If you have any feedback please consult http://openslx.org/feedback and # send your suggestions, praise, or complaints to feedback@openslx.org # -# General information about OpenSLX can be found at http://openslx.org/ +# General information about OpenSLX can be found at http://openslx.org # ----------------------------------------------------------------------------- # vmgrid.pm # - ... @@ -107,7 +107,7 @@ sub getAttrInfo applies_to_clients => 1, description => unshiftHereDoc(<<' End-of-Here'), location of virtual images - for starts /wo full path + for starts /w relative path End-of-Here content_descr => 'absolute path to vm image files', default => '/var/lib/virt/vmgrid/images', @@ -117,7 +117,7 @@ sub getAttrInfo applies_to_clients => 1, description => unshiftHereDoc(<<' End-of-Here'), location of XML configuration for virtual images - for starts /wo full path + for starts /w relative path End-of-Here content_descr => 'absolute path to vm xml files', default => '/var/lib/virt/vmgrid/xml', @@ -150,7 +150,6 @@ sub getAttrInfo applies_to_clients => 1, description => unshiftHereDoc(<<' End-of-Here'), use this number of vcpus as maximum for one vm - will be used only if applicable (only if supported by plugin) End-of-Here content_regex => qr{^(1|2|4|8|16)$}, @@ -162,7 +161,6 @@ sub getAttrInfo applies_to_clients => 1, description => unshiftHereDoc(<<' End-of-Here'), use this number of vcpus as minimum for one vm - will be used only if applicable (only if supported by plugin) End-of-Here content_regex => qr{^(1|2|4|8|16)$}, @@ -180,35 +178,33 @@ sub getAttrInfo according to their ratio if less than 4 VMs defined in startvms the memory is being reserved for a later manual start - set to 0 if you don't intend to start them manually + set to 0 if you do not intend to start them manually (only if supported by plugin) End-of-Here content_regex => qr{^(\d\d??,\d\d??,\d\d??,\d\d??,\d\d??,\d\d??)$}, content_descr => '\d\d??,\d\d??,\d\d??,\d\d??,\d\d??,\d\d??', default => '40,0,0,0,40,20', }, - 'vmgrid::maxram' => { + 'vmgrid::maxmem' => { applies_to_systems => 1, applies_to_clients => 1, description => unshiftHereDoc(<<' End-of-Here'), - maximum of RAM used for ALL vms - will be used only if applicable + maximum RAM used by one vm (only if supported by plugin) End-of-Here - content_regex => qr{^(1|2|3|4|5|6|7|8|9)}, - content_descr => 'absolute or relative e.g. 512 or 50%', + content_regex => qr{^(\d\d\d\d??\d??)$}, + content_descr => 'absolute amount: \d\d\d\d??\d??', default => undef, }, - 'vmgrid::minram' => { - applies_to_systems => 1, + 'vmgrid::minmem' => { + applies_to_systems => 1, applies_to_clients => 1, description => unshiftHereDoc(<<' End-of-Here'), - minimum of RAM used for ALL vms - will be used only if applicable + minimum RAM used by one vm (only if supported by plugin) End-of-Here - content_regex => qr{^(1|2|3|4|5|6|7|8|9)}, - content_descr => 'absolute or relative e.g. 512 or 50%', + content_regex => qr{^(\d\d\d\d??\d??)$}, + content_descr => 'absolute amount: \d\d\d\d??\d??', default => undef, }, }; diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh index 9b9adb44..9e3cbf0a 100644 --- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh +++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh @@ -69,7 +69,7 @@ headless=1 while [ $# -gt 0 ]; do case "$1" in -h|--help) - echo -e "Usage: run-vmgrid.sh [-g] [--mem ] \c" + echo -e "Usage: run-vmgrid.sh [-g] [--mem ] \c" echo -e "[/path/]filename[.xml]" exit ;; @@ -253,6 +253,7 @@ xmlvirt=$(grep -o 'virtualmachine param=.*"' ${xmlfile} \ # make a guess from the filename extension if ${xmlvirt} is empty # (not set within the XML file) +# TODO: implement possibility to submit own configuration files if [ -z "${xmlvirt}" ] && [ -n "${additional_config}" ]; then writelog "No virtual machine parameter defined in ${xmlfile}" writelog "Trying to guess VM...\c" @@ -330,20 +331,19 @@ writelog "\tVM short name:\t\t$vm_shortname" ### Declaration of default variables ############################################################################### -# TODO: cpu cores +# make sure cpu_cores is not empty +cpu_cores=${cpu_cores:-"1"} #vmgrid::maxvcpus #vmgrid::minvcpus -#cpu_cores="${cpu_cores}" - # check for CPU virtualization flags -#vmgrid::hvm +#vmgrid::vt # total amount of memory defined in stage 3 permem=60 # get a result which can be divided through 4 mem=$(expr ${totalmem} / 100 \* ${permem} / 4 \* 4) -#vmgrid::maxram -#vmgrid::minram +#vmgrid::maxmem +#vmgrid::minmem # configuring ethernet mac address: first 3 bytes are fixed (00:50:56) # 4th byte is the VM-ID diff --git a/os-plugins/plugins/vmgrid/files/vmgrid b/os-plugins/plugins/vmgrid/files/vmgrid index 3b6713b8..2ddfc5a0 100644 --- a/os-plugins/plugins/vmgrid/files/vmgrid +++ b/os-plugins/plugins/vmgrid/files/vmgrid @@ -24,7 +24,7 @@ if [ -n "$1" ]; then if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then - echo -e "Usage: vmgrid [[-g] [--mem ] \c" + echo -e "Usage: vmgrid [[-g] [--mem ] \c" echo -e "[/path/]filename[.xml]]" exit 0 else @@ -145,7 +145,7 @@ for i in {1..4}; do writelog "Starting ${vm[$i]} via run-vmgrid.sh with ${vmmem[$i]} MB RAM" run-vmgrid.sh --mem ${vmmem[$i]} ${vm[$i]} 2>/dev/null & echo $! > /tmp/vmgrid/${USER}/vmgrid.pids - # wait 5 secs for the next vm to start + # wait 10 secs for the next vm to start sleep 10 fi fi diff --git a/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh b/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh index a1da2e63..37576331 100644 --- a/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh +++ b/os-plugins/plugins/vmgrid/init-hooks/80-after-plugins/virtualization.sh @@ -25,9 +25,9 @@ PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/virtualization # check if plugins available active=0 [ -f ${CONFFILEVMCHOOSER} ] && . ${CONFFILEVMCHOOSER} -[ ${vmchooser_active} -ne 0 ] && active=1 +[ "x${vmchooser_active}" = "x1" ] && active=1 [ -f ${CONFFILEVMGRID} ] && . ${CONFFILEVMGRID} -[ ${vmgrid_active} -ne 0 ] && active=1 +[ "x${vmgrid_active}" = "x1" ] && active=1 [ $DEBUGLEVEL -gt 0 ] \ && echo -e "Executing the 'virtualization' plugin ... \c" @@ -46,7 +46,7 @@ if [ ${active} -ne 0 ] ; then | awk '{print $2}') / 1024) echo "totalmem=${totalmem}" >> ${PLUGINCONFDIR}/virtualization.conf - if [ ${vmgrid_active} -ne 0 ]; then + if [ "x${vmgrid_active}" = "x1" ]; then totalmemtest=$(expr $(echo ${vmgrid_memratio} \ | awk -F ',' '{print $1" + "$2" + "$3" + "$4" + "$5" + "$6}')) @@ -63,7 +63,7 @@ if [ ${active} -ne 0 ] ; then fi # main vm mem (vmchooser) - if [ ${vmchooser_active} -ne 0 ]; then + if [ "x${vmchooser_active}" = "x1" ]; then mainvirtratio=$(echo ${vmgrid_memratio} | awk -F ',' '{print $5}') mainvirtmem=$(expr ${totalmem} \* ${mainvirtratio} / 100 2>/dev/null) if [ ${mainvirtmem} -lt 512 2>/dev/null ]; then -- cgit v1.2.3-55-g7522