Start a XenServer VM that throws "VDI not available" error when you attempt to start
When a VM is started on a XenServer host, domain 0, needs to ensure that all resources required by the guest VM are available for it to start. If a VM has had an unexpected shutdown, power failure, etc., we could have a dirty flag on the VDI, which is normally a logical volume in a volume group (Storage Repository). To clear this flag, we need to do the following actions:
1. Via the command line, type “xe vm-start vm=<name of VM>” and you will get a better error message than noted in the XenCenter, namely the UUID of the VDI that cannot be used exclusively by the guest VM.
2. Make a note of the UUID of the VDI and proceed to remove it from the pool database via the following “xe vdi-forget uuid=<UUID of the VDI>. You will then note that the VM no longer is attached to the VDI in XenCenter.
3. On the SR that the VDI is located on, proceed to the “Storage” tab and select “Rescan”. You should see the VDI with no name label on it.
4. To ensure we have the correct VDI, if there are many VDIs with no name, use the following command “xe vdi-list uuid=<UUID of the VDI>. You should see it with no name label or description. We can then label this VDI via “xe vdi-param-set uuid=<UUID of the VDI> name-label=<New name label>”. You should see the labeled VDI in the XenCenter.
5. On the VMs storage tab, select “Attach” and proceed to select the VDI on the SR.
6. VM should start without issue.