Pages

Wednesday 20 April 2011

The VDI is not available - XenServer 5.6 FP1

I had a virtual machine crash and it could not be restarted.
It would not shut down through XenCenter. It would not shut down through the command line with "xe vm-shutdown vm=" or "xe vm-shutdown --force vm=".
I tried “xe vm-reset-powerstate uuid=uuid-of-the-virtual-in-question force=true” and that failed.

In order to restart the VDI I had to run the following commands:
“xe task-list”
see if anything is in pending state that might be related to the command failure.

If you do see anything that is likely to be in the way, try removing the task with
“xe task-cancel uuid= TASK-UUID”
then try the shutdown operation again.

I then found that the XenCenter console did not refresh so I needed to close the connection and re-open in order to see my shutdown VDI.

When the VDI was then started I received the error “ the vdi is not available”
The VDI in question had 3 drives:
C:\ System
E:\ Data
F:\ Logs
I tried to attached the various disks to a test VM and restart and found that one of the virtual disks was causing the problem. The E:\ Data drive which is probably the most crucial disk in the VM.
It appeared that the virtual disk was not being accessed on the Storage Repository or it was locked.
In order to resolve this I ran the following commands.

1. Determine the UUID of the Storage Repository and the VDI that's exhibiting the issue
2. Run xe vdi-forget uuid=<vdi_uuid>
3. Run xe vdi-scan sr-uuid=&lt;sr_uuid>;
4. Check in XenCenter (or run xe vdi-list sr-uuid=&lt;sr_uuid>;) and you should see the VDI sitting there. Fill in the info you had before in the Properties.
5. Reattach the VDI to your VM of choice and try starting it up.

XenServer is not as stable as I would hope and hopefully this will assist others in the future.

PLEASE SEE COMMENTS: This may cause issues if any post SP1 hotfixes have been applied. Please test with caution.

4 comments:

  1. Thank you very much Ben. This saved my ass. :)

    ReplyDelete
  2. Thanks Ben. You just saved our domain controller's life. :)

    We had a situation where our iSCSI went offline leaving most of our VM's without storage. During diagnosing the problem we Force Shutdown our DC and when the storage problem was resolved it would not boot again, giving us the 'The VDI is not available' error.

    In our case it was both VDI's that were dead. I tried detaching one at a time and still got the error when booting.

    Following the steps at the end of the article brought the machine back up perfectly.

    ReplyDelete
  3. Is your Pool HA enabled?
    If so, disable it.

    VM which was booted befor HA enabling, it will cause filesystem crash.

    THIS IS A BUG.

    ReplyDelete
  4. DO NOT follow this if you have updates applied to FP1. Your system will be hosed. Thansks OP I am now screwed!

    ReplyDelete