Troubleshooting Mysterious Catalog Item in vCloud Director

Few days back while working on one of the customer ticket, I came across an incident where customer was reporting that he is not able to see one of his template in his catalog. He sent the VM via ODT to vCloud Air to be imported in his catalog.

I verified that VM was missing from catalog but was present in vCenter. I tried to import the VM again in Catalog by selecting the option “Import from vSphere” but to my surprise the VM was showing up in the list for selection.

I have never seen such behaviour in VCD. Even if import of template is failed midway, the item is listed in catalog with a question mark against it and status of item reads as “failed to create

After scratching my head for 15-20 minutes and checking with my peer if he had seen any such issue in past, I decided to employ API calls for catalog query (GUI is a big fat lier sometimes) and to my surprise I was seeing 2 entries for catalog items. If you see the above screenshot, you will find only one entry there (VM name purposefully blurred).

Also I have changed original VM name to VM1 and VM2 in below example.

API call to list Catalog items

curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization: Auth” -X GET https://us-texas-1-14.vchs.vmware.com/api/compute/api/catalog/81228929-05e7-4834-8231-4c80b3fb30c8 | grep CatalogItem

Output

<CatalogItems>

<CatalogItem href=”https://us-texas-1-14.vchs.vmware.com/api/compute/api/catalogItem/c2e9faed-ac90-40a3-b0d3-74e2f07dc081″ id=”c2e9faed-ac90-40a3-b0d3-74e2f07dc081” name=”VM1” type=”application/vnd.vmware.vcloud.catalogItem+xml”/>

<CatalogItem href=”https://us-texas-1-14.vchs.vmware.com/api/compute/api/catalogItem/d5a7dd8e-1177-4aa8-a447-35631d0146b4″ id=”d5a7dd8e-1177-4aa8-a447-35631d0146b4” name=”VM2” type=”application/vnd.vmware.vcloud.catalogItem+xml”/>

</CatalogItems>

At this point I was able to determine that there is stale entry for VM2 in VCD and thats why it is not allowing to import VM again from vSphere. Next was to delete the stale entry via API call and try to import VM again. 

Before performing any delete operation, I cloned the VM in vCenter server so that if something goes wrong, I would have a copy of VM with me to figure out alternate way to fix the issue.

Once the cloned completed, I deleted the stale catalog entry via below API call

# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization: Auth” -X DELETE https://us-texas-1-14.vchs.vmware.com/api/compute/api/catalogItem/c2e9faed-ac90-40a3-b0d3-74e2f07dc081

As expected the above API call deleted the original VM from vCenter.

I went ahead and tried to import the cloned VM in catalog by selecting “Import from vSphere” option, and this time I was able to import VM without any further issues.

Isn’t API thing wonderful 😉 atleast it helped me on ‘n’ number of occasions to fix issues which can’t be fixed from GUI.

I hope you enjoyed reading this post. Feel free to share this on social media if it is worth sharing. Be sociable

Leave a ReplyCancel reply