Error: "Failed to delete folder from vCenter Server" when deleting a vApp
search cancel

Error: "Failed to delete folder from vCenter Server" when deleting a vApp

book

Article ID: 378622

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • From the debug details of the error in the UI after deleting the vApp, the following entries are seen:

    com.vmware.ssdc.util.LMException: Failed to delete folder [vcId=vc######-####-####-####-############, moref=group-v####] from vCenter Server.
     at com.vmware.vcloud.val.purger.impl.FolderPurgeUtil.purge(FolderPurgeUtil.java:58)
     at com.vmware.vcloud.val.purger.impl.PurgeServiceImpl.purgeFolder(PurgeServiceImpl.java:49)
     at com.vmware.vcloud.vdc.impl.DeleteVappActivity$PurgeVAppFolderPhase.invoke(DeleteVappActivity.java:530)
    ...
     at java.base/java.lang.Thread.run(Thread.java:829)
    Caused by: com.vmware.ssdc.library.exceptions.FolderNotEmptyException: Could not delete folder "<vApp Name> (vapp####-####-####-####-############)" because it contains:
    child "vm-####"
     at com.vmware.vcloud.val.internal.impl.VC20VirtualEngine.deleteEmptyChildFoldersOrThrow(VC20VirtualEngine.java:2782)
     at com.vmware.vcloud.val.internal.impl.VC20VirtualEngine$1.doWithRetry(VC20VirtualEngine.java:2754)
     at com.vmware.vcloud.val.internal.impl.VC20VirtualEngine$1.doWithRetry(VC20VirtualEngine.java:2751)
     at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287)
     at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:164)
     at com.vmware.vcloud.val.internal.impl.VC20VirtualEngine.deleteChildFoldersWithRetry(VC20VirtualEngine.java:2751)
     at com.vmware.vcloud.val.internal.impl.VC20VirtualEngine.DeleteFolder(VC20VirtualEngine.java:2710)
     at com.vmware.vcloud.val.purger.impl.FolderPurgeUtil.purge(FolderPurgeUtil.java:50)
     ... 9 more

  • In the /opt/vmware/vcloud-director/logs/vcloud-container-debug.log file, entries of the following type are seen: 

    ERROR    | Backend-activity-pool-1659 | DeleteVappActivity             | [Activity Execution] Uncaught Exception during Activity execution. Recent phase: com.vmware.vcloud.vdc.impl.DeleteVappActivity$PurgeVAppFolderPhase@5a1c5ee1 - Handle: urn:uuid:########-####-####-####-############, Current Phase: DeleteVappActivity$PurgeVAppFolderPhase | requestId=########-####-####-####-############,request=DELETE https://<VCD FQDN or IP>/api/vApp/vapp-########-####-####-####-############,...

    ERROR    | task-service-activity-pool-221 | FutureUtil                     | Task future is not complete. | requestId=########-####-####-####-############,request=DELETE https://<VCD FQDN or IP>/api/vApp/vapp-########-####-####-####-############,...

  • UI and API deletion of the vApp returns the same error.
  • The vApp folder in vCenter(VC) shows the presence of child VMs which are not VMware Cloud Director(VCD) VMs.
  • The VMs existing in the VC vApp folder are active and running VMs.

Environment

VMware Cloud Director 10.x

Cause

This issue occurs when there are VM's in vApp folder in VC inventory which is not matching the VM entries in the VCD vApp folder.

Resolution

To resolve the issue, the VMs that are incorrectly present in the vApp folder within VC needs to be removed: 

  1. Note the VMs present in the vApp that needs to be deleted from VCD.
  2. From VC UI, navigate to Inventory > VMs and Templates > vApp folder.
  3. Verify if the VC and VCD vApp folders show the same VMs.
  4. Move(Drag & Drop) the VM which is not supposed to be present in the VCD vApp folder from the VC vApp folder to the root of the datacenter/cluster.
  5. For any VMs that can be safely deleted, proceed with "Remove from Inventory" or "Delete from Disk" option.
  6. Once all the child VMs are removed from the vApp folder, delete the vApp from the VCD UI.