Monday, May 19, 2014

Citrix XenServer Error: VDI is not Available


The first thing to be done is to check and see if the disk is still attached to the VM in question. If so Detach the disk.

If the server has multiple disks run the following command and see if the error in the output of the command gives you information about which disk if giving the error:

xe vm-start vm=<Name of VM>

For Example:
[root@fsxensvr32 ~]# xe vm-start vm=FvABTFDM01
Error code: SR_BACKEND_FAILURE_46
Error parameters: , The VDI is not available [opterr=VDI 966cb0e6-c303-4c80-84ee-43513cd937be not detached cleanly],

As you can see from the example above the error gave you the UUID of the disk associated with the VM that is causing the issue. Based on this informaton you now know which disk to use when executing the procedures in this document.


Find the UUID of the VDI in question

xe vdi-list


You need to obtain the UUID of the VDI and not the UUID of the VM

For Example:
                       uuid ( RO)  : b69d4862-4080-416b-9f77-496474510c15
            name-label ( RW): vdi_xvda
name-description ( RW): XenAppPoolWLB

You can see that the UUID: b69d4862-4080-416b-9f77-496474510c15 is associated with VM XenAppPoolWLB.

Once you have the UUID run the following command:

xe vdi-forget uuid=<VDI UUID we found in step 1>

This is going to remove the VDI from the VM so we can reattach it correctly.  So drive order does matter, you don’t want to switch an OS VDI with a data VDI.

After the above command is executed open XenCenter and navigate to the SR with your VDI.  Hit rescan

Now go to your VM with issues and select the ‘Storage’ tab and click ‘Attach Disk’, and locate the disk to add for your VM

Boot your VM






Thursday, May 8, 2014

Unable to start VM Error Message: This operation cannot be performed because a VDI is in use by some other operation

I needed to see which VM had the VDI in use so I executed the following command. This command will give me a list of the UUID's associated with the VM LBFDM01. I will focus on the C:\ drive.

[root@fsxensvr20 ~]# xe vdi-list name-label=LBFDM01
uuid ( RO)                : bb53e15c-7312-48dc-a736-ce5b9935b145
          name-label ( RW): LBFDM01
    name-description ( RW): LBFDM01 Data
             sr-uuid ( RO): 66f24970-843f-0b80-9400-404585e64f42
        virtual-size ( RO): 214748364800
            sharable ( RO): false
           read-only ( RO): false


uuid ( RO)                : f1b8ed87-f6c4-4aa5-a996-bf9db2ef4be8
          name-label ( RW): LBFDM01
    name-description ( RW): LBFDM01 Data
             sr-uuid ( RO): 66f24970-843f-0b80-9400-404585e64f42
        virtual-size ( RO): 214748364800
            sharable ( RO): false
           read-only ( RO): false


===================


uuid ( RO)                : 7ead0b63-1bf4-48d4-bd2d-c52f739cfec5
          name-label ( RW): LBFDM01
    name-description ( RW): LBFDM01 C:\drive
             sr-uuid ( RO): 66f24970-843f-0b80-9400-404585e64f42
        virtual-size ( RO): 53687091200
            sharable ( RO): false
           read-only ( RO): false


uuid ( RO)                : 86488985-ece7-412c-8b31-ef2f210872d5
          name-label ( RW): LBFDM01
    name-description ( RW): LBFDM01 C:\drive
             sr-uuid ( RO): 66f24970-843f-0b80-9400-404585e64f42
        virtual-size ( RO): 53687091200
            sharable ( RO): false
           read-only ( RO): false


==========================

I then needed to associate which VM is associated with which VDI. So I ran the following command

==========================


[root@fsxensvr20 ~]# xe vbd-list vdi-uuid=7ead0b63-1bf4-48d4-bd2d-c52f739cfec5 params=vm-uuid

Basically says that this disk c52f739cfec5 is associated with these (2) VMs


vm-uuid ( RO)    : 505ebabd-9edb-2cd3-dc2c-08721ee74c7a


vm-uuid ( RO)    : de6e9d15-6d8d-d0a8-4ce8-aee90f1dd6ca



====================================

Once I new the VM UUID associated with the VDI I then ran the following command to determine the power-state on the VM

====================================



[root@fsxensvr20 ~]# xe vm-list uuid=505ebabd-9edb-2cd3-dc2c-08721ee74c7a
uuid ( RO)           : 505ebabd-9edb-2cd3-dc2c-08721ee74c7a
     name-label ( RW): Transfer VM for VDI 7ead0b63-1bf4-48d4-bd2d-c52f739cfec5
    power-state ( RO): running


[root@fsxensvr20 ~]# xe vm-list uuid=de6e9d15-6d8d-d0a8-4ce8-aee90f1dd6ca
uuid ( RO)           : de6e9d15-6d8d-d0a8-4ce8-aee90f1dd6ca
     name-label ( RW): LBFDM01
    power-state ( RO): halted

=======================================

As you can see the Transfer VM is still in a running state which is causing the initial error message of the VDI being in use. I ran the following command to shutdown the Transfer VM

=======================================

[root@fsxensvr20 ~]# xe vm-shutdown uuid=505ebabd-9edb-2cd3-dc2c-08721ee74c7a

Once this was done I was able to start the VM LBFDM01