Xenserver stuck VM / VDI is not available / Master switch
Hi!
Please only execute these commands if ur comfy with ssh and xenserver, if u dont know what ur doing u can get urself in alot of trouble by killing the wrong vm’s etc. Dont blame me if u seriously break something :).
Stuck VM:
- Try it first the normal way if a powerstate is stuck…
xe vm-reset-powerstate force=true vm= “windows2″
If this does not work, try the the next method. - List the domains on the server and grep the UUID of the hung vm. U can find this info under the general tab in xencenter or under # xe vm-list on the host where its running.
list_domains | grep 84e7e227-63b3-c518-4904-5d8b9cba7091
The number it finds under the uuid is the domain of the hung vm.
cd /opt/xensource/debug/xenops destroy_domain -domid 27
xe-toolstack-restart
VDI is not available:
If u have an犀利士
y snapshots, remove those.. it will confuse u.. there might be a way to do it without removing them, but i do that most of the times.. or i just convert them to a new vm.
On the xenserver where the vm was last active and running:
xe vdi-list | grep -B1 [vmname] | grep uuid
Use that uuid to paste in the following command:
xe vdi-forget uuid=4dfb5f8c-0df7-4b4a-b5b0-c484c2f7247a
This will make your vm loose from the disk, and u need to reattach it.
Do a rescan on your storage repository, and click the vm u just deattached the disk of and reattach it.
Xenserver master change/switch:
First disable the High availibilty on the pool of servers:
xe pool-ha-disable
Check what server is the poolmaster(99% its the server in the top):
xe host-list
Copy the UUID from the new master host, paste/execute the next command with the new uuid (just a example):
xe pool-designate-new-master host-uuid=116ceeb1-c923-40ec-8ac6-243c89512908
Your xencenter will disconnect for a abit till its fully back again, and no servers are in mainance, activate HA again:
xe pool-ha-enable
Grgr Thomas!