Unable to remove the storage reservation for empty datastore
search cancel

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:
  1. Note down the Datastore Name from the error message, which is to be used in the following SQL command.
     
  2. 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.
     
  3. The vm.VirtualMachineName column in the output of step 2 provides the name of the VM that is still using the storage.
     
  4. Login to vRA UI and edit the reservation associated with the machine.
     
  5. Select the target storage path of the machine and save the reservation. 
     
  6. Run inventory for the cluster where the machine is hosted.
     
  7. Log in to vRA UI and edit the reservation again. De-select the old storage path from reservation.
     
  8. 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.