diff options
Diffstat (limited to 'os-plugins/plugins/vmgrid/files/vmgrid')
-rw-r--r-- | os-plugins/plugins/vmgrid/files/vmgrid | 17 |
1 files changed, 11 insertions, 6 deletions
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 |