- Category: Xenserver Howtos
- Published: August 20, 2012
- Written by Grant
Sometimes I get a stuck Virtual Machine that just won't go down and it's usually due to a lack of memory in the VM. When I issue a shutdown command from within the VM it starts the shutdown process but hangs part way through. Executing xe vm-shutdown --force uuid=<insert UUID here> does nothing but lock up the terminal. If this happens to you follow the steps below to forcefully shut the VM down.
- xe task-list (find the pending tasks UUID)
- xe task-cancel uuid=<task UUID>
- xe vm-list (note the VM's UUID)
- list_domains (find the VM's UUID and note the domain id)
- /opt/xensource/debug/destroy_domain -domid XX (where XX is the domain id from step 2)
- xe vm-shutdown --force uuid=<UUID from step 1>
The steps above in script form (if you trust me). Step one has to be entered in manually. The rest can be copied and pasted.
TASK=$(xe task-list status=pending --minimal)
xe task-cancel uuid="$TASK"
VMUUID=$(xe vm-list name-label="$name" --minimal)
DOMID=$(xe vm-list uuid="$VMUUID" params=dom-id --minimal) /opt/xensource/debug/destroy_domain -domid "$DOMID" xe vm-shutdown --force uuid="$VMUUID"