Unable to remove the storage reservation for empty datastore
book
Article ID: 345599
calendar_today
Updated On:
Products
VMware Aria Suite
Issue/Introduction
Symptoms:
You have moved the Virtual machines from the storage, decommissioned and deleted from the vCenter.
When you try to delete the storage in vRealize Automation, you experience an error similar to:
You cannot remove the storage names <sotrage path name> because it is in use by one or more managed machines.
Environment
VMware vRealize Automation 7.x
Cause
The issues occurs if the machine was moved in vCenter to a new storage path that is not part of the machine's current reservation in vRA. A Change Reservation is required to be performed in vRA to correct the information about the machine. Before doing this, ensure that the target or new storage path is selected in machine's target reservation.
Resolution
To resolve this issue:
Note down the Datastore Name from the error message, which is to be used in the following SQL command.
Run the following SQL against the IaaS SQL DB:
SELECT vm.VirtualMachineName, vm.VirtualMachineID, vm.StoragePath, hr.HostReservationName, h.HostName FROM VirtualMachine vm JOIN HostReservationToStorage hrts ON vm.HostStorageReservationID = hrts.HostReservationToStorageID JOIN HostToStorage hts ON hrts.HostToStorageID = hts.HostToStorageID JOIN HostReservation hr ON vm.HostReservationID = hr.HostReservationID JOIN Host h ON vm.HostID = h.HostID Where hts.StoragePath = 'EXAMPLE_LUN28'
Note: Replace the EXAMPLE_LUN28 with the datastore name collected from the step 1.
The vm.VirtualMachineName column in the output of step 2 provides the name of the VM that is still using the storage.
Login to vRA UI and edit the reservation associated with the machine.
Select the target storage path of the machine and save the reservation.
Run inventory for the cluster where the machine is hosted.
Log in to vRA UI and edit the reservation again. De-select the old storage path from reservation.
Run the Data Collection (Infrastructure > Compute Resources > Compute Resources) to update the system.
Additional Information
Impact/Risks: This will only affect the VM that is still using the storage. The steps will modify and correct the storage details of the affected VM.