Thursday, October 8, 2015

Cannot remove virtual disk because it is used by "TransferVM for VDI "

You run in to this issue when you are trying to copy/migrate a VM and that operation is interrupted due to what ever reason. You are now stuck with two disks for a VM and the TransferVM has the same VDI as your actual disk.

As a result, when you try to start your VM, you run in to the "This operation cannot be performed because a VDI is in use by some other operation" error


Solution: Remove the "TransferVM for VDI <vdi-number> " disk and start your VM as usual.


Step 1:Get the VM UUID - You don't want to destroy this:

Use "xe vm-list" command

uuid ( RO): 6db58f7d-c411-2b12-a244-9fe2ed866017
name-label ( RW): Deepti2
    power-state ( RO): halted

Step 2:Get the vdi details from "xe vdi-list" command


uuid ( RO): af2b63e7-b110-4258-b027-8c44aa42e5d3
name-label ( RW): Deepti2
    name-description ( RW): Created by template provisioner
sr-uuid ( RO): 686852f4-9ce7-e6a7-3c45-eb05963c7db8
virtual-size ( RO): 16106127360
sharable ( RO): false
read-only ( RO): false


Step 3: Get the list of VM's tagged to the VDI


[root@DeeptiTest ~]# xe vbd-list vdi-uuid=af2b63e7-b110-4258-b027-8c44aa42e5d3
uuid ( RO)             : c6bb40f8-682b-09a4-4827-8c7f539b27bf
          vm-uuid ( RO): 759ef766-d6a5-67e0-c42b-f389cef3ddb3
    vm-name-label ( RO): Transfer VM for VDI af2b63e7-b110-4258-b027-8c44aa42e5d3
         vdi-uuid ( RO): af2b63e7-b110-4258-b027-8c44aa42e5d3
            empty ( RO): false
           device ( RO): xvdb


uuid ( RO)             : 9f699636-03f0-0f0d-5419-c0cf352f3dc6
          vm-uuid ( RO): 6db58f7d-c411-2b12-a244-9fe2ed866017
    vm-name-label ( RO): Deepti2
         vdi-uuid ( RO): af2b63e7-b110-4258-b027-8c44aa42e5d3
            empty ( RO): false
           device ( RO): xvda

Step 4: Shutdown the vdi disks that you don't need

[root@DeeptiTest ~]# xe vm-shutdown --force vm=759ef766-d6a5-67e0-c42b-f389cef3ddb3

Step 5: Destroy the vm that you don't need. 


[root@DeeptiTest ~]# xe vm-destroy uuid=759ef766-d6a5-67e0-c42b-f389cef3ddb3

Step 6: Recheck


[root@DeeptiTest ~]# xe vbd-list vdi-uuid=af2b63e7-b110-4258-b027-8c44aa42e5d3

uuid ( RO)             : 9f699636-03f0-0f0d-5419-c0cf352f3dc6
          vm-uuid ( RO): 6db58f7d-c411-2b12-a244-9fe2ed866017
    vm-name-label ( RO): Deepti2
         vdi-uuid ( RO): af2b63e7-b110-4258-b027-8c44aa42e5d3
            empty ( RO): false
           device ( RO): xvda

Start the VM and it should start!

No comments:

Post a Comment