If you have ever worked with Citrix Xenserver for a long time, You have no doubt experienced having a VM turn unmanageable. Below are couple of scenarios and quick fixes that will be handy in similar situations.
# 1st Scenario
VM has continuously attempted to shutdown, however remains in the green/on state. The VM will not display the console and manual shut down in XenCenter do not work.
* First step is to execute ‘xe-toolstack-restart’ on the pool master server. Most of the times this will help fix the issue. While the restart command is in execution connection to Xen server pool will drop momentarily. If this doesn’t help proceed to next step.
* From the XenServer console, run the command ‘xe vm-shutdown –force vm=VMNAME’ to force a shutdown.
* In XenCenter, once the above two items are performed, attempt to “Reboot” the VM and you will see the VM restart and reflecting the correct power state.
# 2nd Scenario
A virtual machine’s power state will go into an “amber” or “orange” state and the VM is toally left unmanageable.
* Find the UUID of the VM that is stuck in transition. Use the command ‘xe vm-list’ or via XenCenter.
* Find the Domain ID of the hung VM. Run ‘list_domains’ on Xen server console and match the UUID with the ID number
id | uuid | state
0 | 3fe455fe-3185-4abc-bff6-a3e9a04680b0 | R
47 | 267227f3-a59e-dafe-b183-82210cf51ec4 | B
59 | 298817fb-8a3e-7501-11e0-045a8aa860ff | B
60 | 46e3d5aa-2f02-dfdc-b053-9a8ac56ec5d1 | B
61 | 16cf3204-eb17-5a12-e8d0-c72087bda690 | B
62 | 1f8053b5-c6ca-40bb-504e-3017c37e7281 | H
63 | ddaec491-097a-e271-362b-f2f985e26e4a | R
65 | 7adef6fd-9171-5426-b333-6fb1b57b8e60 | B H
66 | 6046dc13-f70b-8398-56fb-069c22440a7c | B
67 | f201cd94-a501-00c2-d21e-8c2f03ea167b | B H
* Run the cmd destroy_domain on the Domain ID.
# /opt/xensource/debug/destroy_domain -domid 62
* You will still see the VM show itself as running, Finally, we need to reboot it.
# xe vm-reboot name-label=’name of the VM’ –force
* The above command will reboot the VM and restore its normalcy. You may want to check the logs for some disk inconsistencies.