Mar 8, 2018

How to fix "The VDI is not available" error in XenServer

I had an epic shit storm of an issue the other night with one of my XenServer clusters at my day job. I won't get into too many boring details, but long story short is that two out of my five XenServers were offline, and I had to tell my cluster for forcefully shut down a few of the VMs that the cluster thought were still running on the offline hosts.

That was the easy part. Powering up the VMs was not easy. When I tried to power the VMs back on to run on one of the live nodes, I got the following error:

the vdi is not available
Man! What kind of shit is that?!

Well, to fix it is actually not that hard. Just kind of a pain. What you need to do is detach the virtual disk from the VM in XenCenter. Then grab the UUID of the LUN where the virtual disk is located.You can do that by clicking on the LUN in XenCenter and just look at the properties.


Once you have that number, SSH into the master XenServer node and run the following command:
  • xe vdi-list sr-uuid=<UUID of The LUN Holding The Virtual Disk>
This will list all of the virtual disks saved on that LUN. 



Now find the UUID of the virtual disk of the VM that you need to power back on. I circled one in red above as a reference. Now you want to tell the cluster to forget this VDI (Don't worry, trust me on this). You can do that by running:
  • xe vdi-forget uuid=<UUID of the VDI>
If you look in XenCenter on the Storage tab of the LUN, that virtual disk will disappear from the LUN. Now click the Rescan button and it will show back up again. Boom!

Now here is the tricky part. You must now make a generic VM with the same specs as the old VM, but leave it powered off. Make sure to delete any disks that you created with it as well. Then attach the VM from the original VM, and power the new VM shell back up. Boom! Your virtual server is alive again! Now you can delete the old VM.

I'm sure there is an easier way to fix this, but I have yet to find an easier solution to this problem than this. If you know a better way, let me know in the comments!





Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | stopping spam