So I have run into a few issues where trying to delete a vApp with Partially Powered Off VMs live inside the vApp. It seems to place the vApp and VM into a Pending state in vCloud Director. When you attempt to run the delete again it says that you need to stop the VM first. In your eyes you thought the VM was stopped but vCD seems to think otherwise. You check in vCenter and see the VM is powered off so what now?
Ok, sorry for yelling but I can’t stress this enough! Make sure you have a backup of your vCD database before doing anything related to modifying the database directly. Here are some, what I consider, best practice tips for doing vCD database work:
- Quiesce all the vCD cells
- Shutdown the vCD cells
- Backup the vCD database
Once you have completed the above steps open your favorite database UI or go straight to the command line. I will not go into the specifics on how to do this as I just don’t want to have that on my conscience if you mess something up! When you are in the database you will want to find the VM in the vCD VM table. You can search for it using the UUID from the error in the vCD interface. You will notice that the row reports that the status is DELETING_CONTENTS. You will want to change this to have a status of RESOLVED.
Next, we need to find the vApp in the VM_CONTAINER table in the vCD database. You can follow the same steps as above to find it by using the UUID of the vApp, which you can grab from the error as well. Once found, you will see that it shows a status of DELETING_CONTENTS as well. This will need to be modified to RESOLVED. When you have completed this and committed the changes you need to refresh your view in the vCD interface. You will see that the status is no longer Pending. Go into the vApp and you will probably see the VM is Partially Powered Off. Go ahead and right-click the VM and Power Off. It should power off clean now. Go to the vApp and shut the vApp down, this to should complete successfully. Finally, go ahead and right-click the vApp and delete!
Yay! If things worked out for you then awesome…if not, please open a case with VMware regarding your issue. As stated in the disclaimer, be careful with this and remember that your mileage will vary! Hope this helps!