summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/vmgrid
diff options
context:
space:
mode:
authorMichael Janczyk2010-03-24 20:01:46 +0100
committerMichael Janczyk2010-03-24 20:01:46 +0100
commit1f031fbafab207fe0879217ae9215caea783ed00 (patch)
treea1e1f8dcadba4602738cb404f9279b9482bbc790 /os-plugins/plugins/vmgrid
parentqemukvm further modifications, first xen runscripts (diff)
downloadcore-1f031fbafab207fe0879217ae9215caea783ed00.tar.gz
core-1f031fbafab207fe0879217ae9215caea783ed00.tar.xz
core-1f031fbafab207fe0879217ae9215caea783ed00.zip
new run-virt.include for xen plugin. qemukvm modules now loaded via runlevelscript qemukvm, script added to sudoers as well. better ideas?
Diffstat (limited to 'os-plugins/plugins/vmgrid')
-rw-r--r--os-plugins/plugins/vmgrid/files/run-vmgrid.sh36
1 files changed, 21 insertions, 15 deletions
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
index 8d199ccf..ce707830 100644
--- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
+++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
@@ -131,10 +131,10 @@ writelog "Starting configuration..."
writelog "\tVM-ID:\t\t\t${VM_ID}"
writelog "\tLogfile:\t\t${OPENSLX_DEFAULT_LOGDIR}/run-vmgrid.${USER}.$$.log"
writelog "\t$(df -h | grep " /tmp$" | awk '{print $2}') \c"
-writelog "/tmp info:\t\t$(grep "/tmp " /proc/mounts | sed -e "s,/tmp ,,")"
+writelog "\t/tmp info:\t\t$(grep "/tmp " /proc/mounts) $(df -h | \
+ grep " /tmp$" | awk '{print $2}')"
writelog "\tVM XML dir:\t\t${vmgrid_xmlpath}"
writelog "\tVM Image dir:\t\t${vmgrid_imgpath}"
-writelog "VM config:"
if ! grep '<?xml' "${xmlfile}" >/dev/null 2>&1; then
writelog \
@@ -143,13 +143,18 @@ if ! grep '<?xml' "${xmlfile}" >/dev/null 2>&1; then
fi
writelog "\tXML file:\t\t$xmlfile"
+writelog "VM config:"
-imgpath=${vmgrid_imgpath}
-
-# name of the virt image of dir
-imgname=$(grep -io 'image_name param=.*"' ${xmlfile} | sed -e "s/&.*;/; /g" | \
- awk -F '"' '{ print $2 }')
-# full path
+# name of the virt image or dir
+imgname=$(grep -io '<image_name param=.*"' ${xmlfile} | \
+ sed -e "s/&.*;/; /g" | awk -F '"' '{ print $2 }')
+if echo ${imgname} 2>/dev/null | grep '/' >/dev/null 2>&1; then
+ imgpath=$(dirname ${imgname})
+ imgname=$(basename ${imgname})
+else
+ imgpath=${vmgrid_imgpath}
+fi
+# set default v path
vmpath=${imgpath}/${imgname}
# check if virtual machine container file exists
@@ -163,16 +168,17 @@ writelog "\tVM file/dir:\t\t$vmpath"
# name of the virt machine, sed because of Windows formatting
vm_name=$(grep -o 'short_description param=.*"' ${xmlfile} | \
sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+# if ${vm_name} not defined use ${imgname}
+vm_name=${vm_name:-"${imgname%.*}"}
+# define vm_shortname since vm_name can be very long
+vm_shortname=$(echo ${imgname%.*} | sed -e "s, ,-,g")
+# vm_name = displayname, define for old scripts
+displayname=${vm_name}
# is there an additional configuration provided?
additional_config=$(grep -o 'additional_config param=.*"' ${xmlfile} | \
sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
-# if ${vm_name} not defined use ${imgname}
-vm_name=${vm_name:-"${imgname%.*}"}
-displayname=${vm_name}
-# remove blanks
-
# image is for the following virtual machine
xmlvirt=$(grep -o 'virtualmachine param=.*"' ${xmlfile} | \
sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
@@ -231,8 +237,8 @@ network_card=$(grep -io 'netcard param=.*"' ${xmlfile} | \
awk -F '"' '{ print $2 }')
writelog "\tVirtualization:\t\t$xmlvirt"
-writelog "\tVM Name:\t\t$vm_name"
-writelog "\tVM Displayname:\t\t$displayname"
+writelog "\tVM name:\t\t$vm_name"
+writelog "\tVM short name:\t\t$vm_shortname"
###############################################################################
### Declaration of default variables