Introduction

This will be another quick post to let you know how you can solve a “stuck” vAPP in VMware Cloud Director (VCD). A “stuck” vAPP is a vAPP that does not hold any state, a vAPP that does not allow actions and a vAPP that cannot be managed through the HTML5 client as a System Administrator or Organization Owner.

How do I recognize a “stuck” vAPP? Well, have a look at the below figure. You can clearly see that the vAPP does not have any options, and the vAPP is in a forever “Busy” state. This particular vAPP also does not have any VM’s registered to it anymore. This is why we want to remove the vAPP.

Stuck vAPP in VCD
Stuck vAPP in VCD

However, how do we remove the vAPP if there are no actions that we can execute against it? Well for this we have to go into the Postgresql ‘vcloud’ database and look the VM up and remove it’s record. If you are not familiar with Postgresql or the ‘vcloud’ database environment don’t worry I got you covered. You can just follow the next couple of simple steps to remove the “stuck” vAPP from your environment.

Solution

So let’s get right to it. Please remember that we will be editing the Postgresql database on the VCD Cell, so if you do not feel comfortable with this, you can do the following:

  • Shutdown all VCD Cells.
  • Snapshot all VCD Cells.
  • Start all VCD Cells

So now that we’ve done this, we can go ahead and login to the VCD Cell through a SSH connection. Once you’ve done this enter the following commands to enter the ‘vcloud’ database:

root@vcloud [ ~ ]# sudo -u postgres psql

Next up, we need to identify the name of the VCD database in Postgresql.You can do this by entering the following command:

postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     |
 repmgr    | repmgr   | UTF8     | C       | C     |
 vcloud    | vcloud   | UTF8     | C       | C     |
(3 rows)
Listing the VCD Postgresql databases
Listing the VCD Postgresql databases

As you can see, we have followed the defaults on this and the database name is called ‘vcloud’. Now we are going to connect to it by entering the following commands:

postgres=# \c vcloud
You are now connected to database "vcloud" as user "postgres".

Once you’ve done this we are now ready to execute some commands. First we need to identify the vAPP that is “stuck”. There are two ways (actually three including the API) we can do this, either by finding the vAPP ID from the VCD HTML5 UI like the figure below (You can get this in the Administration -> Events overview). Have a look at the yellow marked ID (I’ve blocked out some parts for obvious reasons):

VCD Event details to find vAPP ID
VCD Event details to find vAPP ID

Or by just simply digging through the ‘vcloud’ database and finding the vAPP with it’s name. You can do this by entering the following command:

vcloud=# select * from vm_container where name like '%VAPPNAME%';

This should yield one long piece of information regarding the specific vAPP we need. You can use this information to specifically filter away some information we don’t need by entering the following command:

vcloud=# select name,creation_status from vm_container where sg_id = 'VAPP-ID';
                     name                     | creation_status
----------------------------------------------+-----------------
VAPP NAME | RESOLVED
(1 row)

In this particular situation the “Creation_Status” was “Resolved”. Normally if you have a “stuck” vAPP, this state would show either “DELETING_CONTENTS” or “UNRESOLVED”. In our situation this wasn’t the case, but the vAPP was stuck eitherway. You can also easily check for all “stuck” or faulty vAPP in the VCD database by entering the following psql commands:

 select * from vm_container where creation_status = 'DELETING_CONTENTS';
 select * from vm_container where creation_status = 'UNRESOLVED';

Now in this next part we are going to delete the vAPP entry from the ‘vcloud’ database. Like I said before, if you are not comfortable with this, follow the prerequisites I mentioned earlier:

vcloud=# delete from vm_container where sg_id = 'VAPP-ID';
DELETE 1

At this point the record is deleted. We can double-check this by re-entering the previous command that showed us the vAPP:

vcloud=# select name,creation_status from vm_container where sg_id = 'VAPP-ID';
 name | creation_status
------+-----------------
(0 rows)

Like myself, you should now see that the above command no longer yields results. Great! Now let’s go back into the VCD HTML5 UI and have a look at the available vAPPs.

VCD HTML5 vAPP UI
VCD HTML5 vAPP UI

Eureka! The “stuck” vAPP is completely removed from the database, and from the UI. This means we are done!

I hope this blog post is informational for everybody. Until the next blogpost!


Bryan van Eeden

Bryan is an ambitious and seasoned IT professional with almost a decade of experience in designing, building and operating complex (virtual) IT environments. In his current role he tackles customers, complex issues and design questions on a daily basis. Bryan holds several certifications such as VCIX-DCV, VCAP-DCA, VCAP-DCD, V(T)SP and vSAN and vCloud Specialist badges.

1 Comment

Manny · November 23, 2020 at 4:53 pm

Great post Brian!

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *