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

bug #1151: added switch to destroy kvm VMs with ACPI enabled

Based on the patch provided by "jan horacek" <jahor@jhr.cz>
http://dev.opennebula.org/issues/1151
This commit is contained in:
Javi Fontan 2012-05-07 15:24:05 +02:00
parent da346aecec
commit 70677e81b7
2 changed files with 16 additions and 2 deletions

View File

@ -26,3 +26,7 @@ export SHUTDOWN_TIMEOUT=300
# Uncomment this line to force VM cancellation after shutdown timeout
#export FORCE_DESTROY=yes
# Uncomment this line to force VM's without ACPI enabled to be destroyed
# on shutdown
#CANCEL_NO_ACPI=yes

View File

@ -23,6 +23,16 @@ count=0
deploy_id=$1
shutdown_command="virsh --connect $LIBVIRT_URI shutdown $deploy_id"
if [ "x$CANCEL_NO_ACPI" = "xyes" ]; then
virsh --connect $LIBVIRT_URI dumpxml $deploy_id | grep -q acpi
if [ "x$?" != "x0" ]; then
virsh --connect $LIBVIRT_URI destroy $deploy_id
fi
fi
if [ -z "$SHUTDOWN_TIMEOUT" ]; then
TIMEOUT=120
else
@ -36,7 +46,7 @@ function monitor
# Issue another shutdown to cover occasional libvirt lack of attention
if [ "$count" -eq "$HALF_LOOP" ]
then
virsh --connect $LIBVIRT_URI shutdown $deploy_id
$($shutdown_command)
fi
let count=count+1
@ -48,7 +58,7 @@ function monitor
[ "x$?" != "x0" ]
}
exec_and_log "virsh --connect $LIBVIRT_URI shutdown $deploy_id" \
exec_and_log "$shutdown_command" \
"Could not shutdown $deploy_id"
retry $TIMEOUT monitor