VMware Cloud Community
mag2sub
Contributor
Contributor

vRO 7.0.1 how to get custom properties of VM

Hi

We have added some custom properties to VM in  build phase pre using  VMaddupdatepropeties ..

How do we retrieve this custom property value in post phase ....enumerating the value by getter on specific name is giving a blank

Please advise

Thanks in advance

0 Kudos
5 Replies
jacksonecac
Enthusiast
Enthusiast

I suppose I don't fully understand your question, I took it this way:

You have a list of custom properties that you applied to the virtualmachine pre-build that you would like to access post build.

Questions for you:

Are you cloning from a template? If so how are you applying properties 'pre-build' to me that would mean applying them to the template which you are cloning from. Or are you applying them to the recently cloned server sometime during the build?

I would recommend tagging the server with the properties that you would like to retrieve later, I am not familiar with VMaddupdateproperties..

This link should provide more instruction on how to do that:

vRO vCenter 6 Tagging plug-in

Here is a tagging link:

How to associate a tag using vAPI

Here is a link to the ManagedEntity object all vmware objects extend it's attributes, note the customValue field array that you may be able to push values to and reference later (not tested or tried)

0 Kudos
admin
Immortal
Immortal

Have a look at the action items in vRealize Orchestrator under com.vmware.library.vcac, assuming you have the vCAC plugin installed and configured.

You have some examples to get custom properties for a virtual machine, either getPropertiesFromVirtualMachine or getPropertyFromVirtualMachine action items.

Oli

0 Kudos
mag2sub
Contributor
Contributor

I am using a blocking event subscription that  ties into a workflow that  updates VM properties using

virtualMachineAddOrUpdateProperties = new Properties () ;

virtualMachineAddOrUpdateProperties.put("name", value) ;

Im trying to retrieve the same property [post build using a

var vRAVmProperties = machine.get("properties") ;

if (vRAVmProperties != null) {

  var log = "";

  log += "vRA VM properties :\n";

  var array = new Array();

  for each (var key in vRAVmProperties.keys) {

  array.push(key + " : " + vRAVmProperties.get(key));

  }

  array.sort();

  for each (var line in array) {

  log += "\t" + line + "\n";

  }

  System.log(log);

}

variable =vRAVmProperties.get("name");

0 Kudos
jacksonecac
Enthusiast
Enthusiast

what is 'machine'? A full copy of your code would be beneficial.

0 Kudos
mag2sub
Contributor
Contributor

var machine = payload.get("machine") ;

payload is the VM properties bag input of type proprties  that IaaS passes to vRO

0 Kudos