1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

bug #1211: change vmm/xen/shutdown to make use of retry and force_destroy

This commit is contained in:
Javi Fontan 2012-04-24 17:23:02 +02:00
parent 2de23bbaff
commit 19fe111fcc
2 changed files with 19 additions and 14 deletions

View File

@ -21,24 +21,23 @@ source $(dirname $0)/../../scripts_common.sh
deploy_id=$1
function gdm {
$XM_LIST | grep "$deploy_id "
if [ -z "$SHUTDOWN_TIMEOUT" ]; then
TIMEOUT=120
else
TIMEOUT=$SHUTDOWN_TIMEOUT
fi
function monitor
{
$XM_LIST "$deploy_id" > /dev/null
[ "x$?" != "x0" ]
}
exec_and_log "$XM_SHUTDOWN $deploy_id" \
"Could not shutdown $deploy_id"
OUT=$(gdm)
retry $TIMEOUT monitor
while [ -n "$OUT" -a "$(echo $OUT | awk '{print $5}')" != "---s--" ]; do
sleep 1
OUT=$(gdm)
done
OUT=$(gdm)
if [ -n "$OUT" ]; then
$XM_CANCEL "$deploy_id"
fi
sleep 2
force_shutdown "$deploy_id" "$XM_CANCEL \"$deploy_id\""

View File

@ -28,4 +28,10 @@ export XM_LIST="sudo $XM_PATH list"
export XM_SHUTDOWN="sudo $XM_PATH shutdown"
export XM_POLL="sudo /usr/sbin/xentop -bi2"
# Senconds to wait after shutdown until timeout
export SHUTDOWN_TIMEOUT=120
# Uncoment this line to force VM cancellation after shutdown timeout
#export FORCE_DESTROY=yes