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:
parent
da346aecec
commit
70677e81b7
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user