vRealize Automation 7.x – Cannot remove storage

August 4, 2016

vRealize Automation 7.x and “You cannot remove storage with name [Your Datastore Name] because there are managed machines still attached to it.”

Synopsis:

I had a virtual machine in vRealize Automation 7 that showed up in the UI and in the IaaS database but, did not actually exist anywhere in vSphere. The VM is question was deleted in vRA using the user’s tenant entitlement options. The VM was deleted in vSphere but, was stuck forever in vRA’s interface as “Finalized” and I could no longer perform any actions on this VM.

Removing the VM from the IaaS database allowed me to successfully remove the stuck Datastore from the reservation.

Caveat, if the VM still shows up in the vRA UI, you may need to do some further cleanup.

If at all possible, try using the VMware Cloud Client 4.x (4.1 is current) and remove the VM before touching the IaaS database. Try deleting the VM and removing the Datastore object after purging any VM objects tied to it.

If unsuccessful, try deleting it from the database.

https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2144269

SELECT * FROM VirtualMachine WHERE VirtualMachineName = Your VM Name’

Note the Primary key in the IaaS database in the dbo.VirtualMachine table – ‘VirtualMachineID’

Verify the ID is a match on the VM in question by comparing the name in the VirtualMachineName column:

SELECT * FROM VirtualMachine WHERE VirtualMachineId = ‘3B23C483-C39D-40DE-AF7E-5D9BBDBBFE2D’

DELETE FROM [dbo].[VirtualMachine] where VirtualMachineId = ‘3B23C483-C39D-40DE-AF7E-5D9BBDBBFE2D’

Run an Inventory refresh “Data collection” in vRA and then you should be able to remove the Datastore object successfully from the compute resource’s reservation.
Once the managed machine was deleted from the database, it allowed the removal of the Datastore from the reservation. All managed machines = 0 or false freeing any vRA VM to Datastore dependencies.
SELECT * FROM VirtualMachine WHERE StoragePath = ‘Datastore Name”

Rob Shaw – 8/4/16

Comments are closed.