summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/vmgrid
diff options
context:
space:
mode:
authorMichael Janczyk2010-04-01 21:35:54 +0200
committerMichael Janczyk2010-04-01 21:35:54 +0200
commit46fbdd6d0a6dd5896a2b798deb95aa61a089a355 (patch)
treedf83b52870688d683bcd054233a8a88a56ee8f6c /os-plugins/plugins/vmgrid
parentxen bridge change + xennet TODO: load xennet (diff)
downloadcore-46fbdd6d0a6dd5896a2b798deb95aa61a089a355.tar.gz
core-46fbdd6d0a6dd5896a2b798deb95aa61a089a355.tar.xz
core-46fbdd6d0a6dd5896a2b798deb95aa61a089a355.zip
xen nfs boot, xen boot
Diffstat (limited to 'os-plugins/plugins/vmgrid')
-rw-r--r--os-plugins/plugins/vmgrid/files/run-vmgrid.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
index 4c5ecbb9..716371d5 100644
--- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
+++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
@@ -103,7 +103,13 @@ echo "Starting to log at $(date)" \
# test how many instances running
runningvms=$(ps aux | grep "run-vmgrid.sh " | grep -v grep | wc -l)
+# 2 steps, /w only one is seems not to work
runningvms=$(expr ${runningvms} - 1)
+# if Xen use different method
+if [ "${vmgrid_virt}" = "xen" ]; then
+ runningvms=$(xm list 2>/dev/null | grep -vE "Domain-0|Name.*ID" | wc -l)
+ runningvms=$(expr ${runningvms} + 1)
+fi
# check value
if [ $runningvms -le 0 ]; then
writelog "Error in value: Running VMs: ${runningvms}. Exit!"
@@ -189,7 +195,7 @@ elif [ "${boot}" = "n" ] && [ -z "${imgname}" ]; then
diskless=1
vmpath="{diskless boot}"
# imagename /w full path
-elif echo ${imgname} 2>/dev/null | grep -q '/' >/dev/null 2>&1; then
+elif echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then
imgpath=$(dirname ${imgname})
imgname=$(basename ${imgname})
vmpath=${imgpath}/${imgname}
@@ -209,19 +215,12 @@ fi
# 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 ${xmlfile}
+vm_name=${vm_name:-${xmlfile%.xml}}
# define vm_shortname since vm_name can be very long
-if [ -n "${imgname}" ]; then
- # if ${vm_name} not defined use ${imgname}
- vm_name=${vm_name:-"${imgname%.*}"}
- vm_shortname=$(basename ${imgname%.*} | sed -e "s, ,-,g")
-elif [ -n "${vm_name}" ]; then
- vm_shortname=$(echo ${vm_name} | awk '{print $1"-"$2"-"$3}' \
- | sed -e "s,-$,,;s,-$,,")
-else
- vm_name=$(date | md5sum | awk '{print $1}')
- vm_shortname=${vm_name}
-fi
+vm_shortname=$(basename ${xmlfile%.xml} | sed -e "s, ,-,g")
+
# vm_name = displayname, define for old scripts
displayname=${vm_name}
@@ -376,6 +375,7 @@ else
exit 1
fi
+# remove config dirs when finished
if echo "${RMDIRS}" 2>/dev/null | grep -q ${vmgrid_virt}; then
writelog "${vmgrid_virt} exited. Cleanning up... \c"
rm -rf ${RMDIRS} >/dev/null 2>&1