Sometimes in some scenarios, you encounter a Xen hosted VM that is stuck in a “Pending” state, typically a VM that was stuck with a pending Shutdown task. from XenCenter, the VM is no responsive in a panic state and the Shutdown and Reboot buttons are greyed out.
A couple of potential causes for this condition include:
1. a mounted iso from the console that is not avaliable for some reason
2. From Citrix:
Windows being Windows. At times, when a server executes shutdown, it hangs, spinning it’s wheels. XenServer waits for a confirmation from XenTools that the shutdown is proceeding before it completes the task. If there are problems during the Shutdown, XenServer does not consider the task completed leading to a loss of connectivity to the XenServer tools. If connectivity between XenServer and XenTools is lost during the shutdown process meaning XenServer never receives a proper signal from Xentools about the state of the shutdown, you get that “stuck” symptom and the only thing you can do is force-kill the task and down a Force Reboot.
In this case, from the XenServer console CLI:
1. xe task-list to view the Pending tasks
2. xe task-cancel force=true uuid=<UUID> the UUID from the above command
Attempting to use the xe vm-reboot or xe vm-shutdown commands do nothing but create more pending tasks. xe-toolstack-restart and xe task-cancel uuid=<UUID> (without the force=true) had no effect.
Once the Pending tasks affecting the VM had been cancelled, the VM rebooted and worked normally, xe-toolstack-restart after cancelling the tasks was not neccassary, but you may need to use it if the server is not responsive.