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 uuid=<insert UUID here> –force does nothing but lock up the terminal. If this happens to you follow the steps below to forcefully shut the VM down. WARNING!! Only do this as a last resort.
- 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 uuid=<UUID from step 1> –force
This will destroy the domain and then shut the VM down. I’ve had to do this several times on an Apache webserver that’s getting pummeled from the Internet.
[root@xenserver1 ~]# xe vm-shutdown uuid=7b192ec8-b739-53c1-3a77-efe4c81b0728 --force Another operation involving the object is currently in progress class: VM object: 7b192ec8-b739-53c1-3a77-efe4c81b0728 (Windows8)
Optionally, you can use the scripts list_domains and destroy_domain as below.
First, list the active domains and select the ID for destroy_domain, you can be sure is the same machine by running the first check
[root@xenserver1 ~]# xe vm-list name-label=Window8 params=dom-id dom-id ( RO) : 12 [root@xenserver1 ~]# list_domains id | uuid | state 0 | 4a510c39-b38b-4ede-9341-5a21394dab72 | R 2 | 61b3faf8-f505-a18a-2afd-125b1cd5c9b5 | B 6 | 62ee4f20-d55c-7f8d-300d-0f03676db9f7 | B H 9 | c4d08919-a7ad-c9f5-8e87-b597b300d71a | B H 12 | 7b192ec8-b739-53c1-3a77-efe4c81b0728 | H [root@xenserver1 ~]# /opt/xensource/debug/destroy_domain -domid 12