I am able to get the owner with the below code...
Not sure how to change the owner. Below captures the owner name of the VCAC VM.
var ownerEntity = virtualMachineEntity.getLink(vCACHost,"Owner")[0];
var ownerName = ownerEntity.getProperty("UserName");
If you know the property name you want to change, you could try the vCO workflow called Create / Update property on virtualMachine Entity. it's in the Library/vCloud Automation Center/Extensibility/Helpers folder.
I have, but this entity is buried a bit and not sure how to set it like the others.
Thank you
It isn't as simple as updating the IaaS entity... since CAFE and IaaS maintain separate databases, the workflow call would have to update both, or things are going to get... weird. I actually need to do something along those lines myself, but I haven't had a chance to dig into it because it isn't high on the list (yet).
Hi there,
i also wanted to update the owner through Orchestrator and i found two linked areas in the VM Object with the username: VirtualMachineExt and Owner.
I updated both of them to the new user and the VM changed the owner in the Item detail view to the new username. But the username in the left column in the Item detail view (below the Logo or image of the VM) is still the old owner of the VM.
Any ideas which additional fields i have to fill in the new owner?
[2014-11-13 13:18:37.348] [I] | LINK: VirtualMachineExt
[2014-11-13 13:18:37.349] [I] |¯¯¯¯¯¯¯
[2014-11-13 13:18:37.349] [I] | ENTITY
[2014-11-13 13:18:37.349] [I] | modelName: ManagementModelEntities.svc
[2014-11-13 13:18:37.349] [I] | entitySetName: VirtualMachineExts
[2014-11-13 13:18:37.349] [I] |¯¯¯¯¯¯¯¯¯¯¯
[2014-11-13 13:18:37.349] [I] | PROPERTIES
[2014-11-13 13:18:37.352] [I] | UserName: user@domain
[2014-11-13 13:18:41.363] [I] | LINK: Owner
[2014-11-13 13:18:41.363] [I] |¯¯¯¯¯¯¯
[2014-11-13 13:18:41.364] [I] | ENTITY
[2014-11-13 13:18:41.364] [I] | modelName: ManagementModelEntities.svc
[2014-11-13 13:18:41.364] [I] | entitySetName: Users
[2014-11-13 13:18:41.364] [I] |¯¯¯¯¯¯¯¯¯¯¯
[2014-11-13 13:18:41.364] [I] | PROPERTIES
[2014-11-13 13:18:41.364] [I] | UserName: user@domain
[2014-11-13 13:18:41.364] [I] | UserID: 2
I found out, that you also have to update the cafe component of vRA
// This one get's the VM Object from VCACCAFE:vCACHost where vmName is the
var cafeVM = vCACCAFEEntitiesFinder.findCatalogResources(cafeHost, vmName)[0]; //ARRAY - ALWAYS FIRST OBJECT!
System.log("Cafe VM : "+cafeVM);
// This one display's the Owner's! of the VM Object
var cafeVmOwner = cafeVM.getOwners();
System.log("Cafe VM Owner: "+cafeVmOwner);
The only thing that frustrates me a little bit is that the attribute cafeVM.owners is read-only???
So how to solve that? Any ideas?
Hi there,
first of all, i was also not able to figure it out.
In most cases it is not a problem of manipulating the object (for example "read-only" lists), but finding the appropriate method to save any changes.
In the case of CatalogResources, i was not able to find a possibility to save my manipulated CatalogResource with correctly updated owner.
I've also checked the REST-API for a possibility to save/update a CatalogResource. But nothing there.
Maybe somebody knows how to save/update a CatalogResource object?
Greets.
So it's possible by using the Resource Action: "Edit".
If you specify the additional property: provider-Cafe.Shim.VirtualMachine.Owner
you're able to switch the owner.
The value for this property is the UserID of the vCAC Model Entity "Users".
Now the tricky part:
If this user wasn't an owner before, he won't show up as Model Entity.
You now have to create a vCAC Model Entity for the new owner and use his new UserID for the property owner in the Resource Action: Edit.
et voila, you changed the owner by vCO.
Greets,
Sascha
This post is also very useful to solve the problem : Use vCO to change Virtual Machine Owner
I created a workflow to change the owner through vCO which could be integrated to vCAC. It also changes the VRM Owner Annotation in vCenter.
http://vautomate.wordpress.com/2014/12/04/vrealize-automation-change-owner-workflow/
I opened a ticket with VMware because all three different ways I found to change the owner were zeroing out the daily cost and cost to date. Out of that here is a workflow that changes the owner.
There are two input requirements:
There is also an attribute (vCACCAFEHost) that needs to be set prior to running the workflow.