VMware Cloud Community
ClapaKonrad
Contributor
Contributor
Jump to solution

Deleting vCAC Entities

Hi Everyone,

I am trying to delete VM Item in vCAC/vRA.

I have used vCACEntityManager.deleteModelEntityBySerializedKey methode. Seems like it does not delete the vCAC:VirtualMachine object.

Does anyone have experience with the topic?

How does vCAC:Entity correspond to vCAC:VirtualMachine object?

Regards,

Konrad

1 Solution

Accepted Solutions
Dan_Linsley
VMware Employee
VMware Employee
Jump to solution

Hi Konrad,

What version of vCAC/vRA are you working with?  Unfortunately from 6.1 onward the vCO plugin didn't provide a simple way to do what you are asking.

Recently I did develop a workflow to delete a IaaS VM (vCAC:VirtualMachine) correctly  (See attached).

Make sure the credentials used to connect to vCACCafe are entitled to request a delete.

Dan.

View solution in original post

9 Replies
SeanKohler
Expert
Expert
Jump to solution

Hi Konrad,

How about running the "Destroy" action via a REST call?

1. Your plugin service account has to be entitled to the action for the machine resource.  (add service account to business group, add entitlement for service account to have all actions for machine resources)

2. Run your REST action with parameterized Business Group (tenantRef and subtenantRef) and Machine. Use your service account as the user (since it is entitled to Destroy machines now)...Using vCAC 6 REST APIs - Part 1 - Elastic Skies & Using vCAC 6.X REST APIs - Part 2 - Elastic Skies

Note:  You can get the tenantRef and subtenantRef information off the VCACCAFE:VirtualMachine object if memory serves.  (not in the office at the moment)

Edit:  There is probably another way destroy a machine without using a REST call, once the service account is entitled to run a ConsumerResourceOperation Destroy.

ClapaKonrad
Contributor
Contributor
Jump to solution

Good Stuff! This will work for sure. Thannks for that.

However, I would realy like to make use of the vCAC plugin for that.

I am much interested in relation between vCAC Entity and vCAC Virtual Machine.

There must be some kind of link between them that could be used destroy the Object in the Itemes in vCAC.

I would also like to understand the 1:1 corespondence of Virtual Machine Properties in vCAC to VCAC:VirtualMachine object in vCO

Reply
0 Kudos
TomBarbour
Contributor
Contributor
Jump to solution

The attached image displays relationships for each of the vCAC:Entities. If you look at the Entity with entitySetName:VirtualMachines, you can see there is a property called "VMUniqueID". This property directly corresponds to the vCAC:VirtualMachine property "vmUniqueID"

Reply
0 Kudos
SeanKohler
Expert
Expert
Jump to solution


Hmmm.... if you think about it, you are not really deleting.  You are trying to do a managed destroy of an Entity (VCAC:VirtualMachine and VCACCAFE:CatalogResource) and its associated real VC:VirtualMachine.  If you were to successfully run a Delete against the Entity without a managed destroy, you would effectively be orphaning the Virtual Machine in vCenter.

Reply
0 Kudos
SeanKohler
Expert
Expert
Jump to solution


>>> I would also like to understand the 1:1 corespondence of Virtual Machine Properties in vCAC to VCAC:VirtualMachine object in vCO

I have been working on understanding it better myself.  I am not all the way there, but might have a little bit of a head start on you.

Give that WF a shot... maybe it will illuminate some things.

VCAC:VirtualMachine is an inventory object of VCAC (Iaas I guess)

VCAC:Entity appears to be runtime based on inventory object in VCAC.

VCACCAFE:CatalogResource is the inventory object that is ties the Café Catalog Resource to the IaaS inventory item.

VC:VirtualMachine is an inventory item in the VC Plugin and the VCAC tied Reference can be pulled through the Entity.

I think I got some of that right at least...

The workflow demonstrates the references, but I might be jumping the wrong gaps in my understanding of how they correlate.

Reply
0 Kudos
ClapaKonrad
Contributor
Contributor
Jump to solution

You are correct here. I have another workflow in the chain that deletes the machine in vC Smiley Happy

The Problme is that the methode i used deletes the VCAC:Entity but Orphants an item in VCAC portal. When you see details od the items it has nothing in it...

Reply
0 Kudos
ClapaKonrad
Contributor
Contributor
Jump to solution

I have also realized that the custom properties can be accessed by Properties object. That contains Key pair values of custome properties. I am not sure though how this info is injected there Smiley Happy

See: http://www.vmtocloud.com/how-to-extend-vcac-with-vco-part-2-hello-world-script-in-guest/

It also mentions this Workflow Template - vCO Workflow which is great help

Reply
0 Kudos
Dan_Linsley
VMware Employee
VMware Employee
Jump to solution

Hi Konrad,

What version of vCAC/vRA are you working with?  Unfortunately from 6.1 onward the vCO plugin didn't provide a simple way to do what you are asking.

Recently I did develop a workflow to delete a IaaS VM (vCAC:VirtualMachine) correctly  (See attached).

Make sure the credentials used to connect to vCACCafe are entitled to request a delete.

Dan.

ClapaKonrad
Contributor
Contributor
Jump to solution

Hi Dan!

This seems what i am looking for. However i think i might be having some issues with the vCAC plugin.... It does not see any object in the vCACCafe inventor,

vcacafe.png


UPDATE: This was permission issues Smiley Happy


Dan great job this is exactly what i was looking for!!!