VMware Cloud Community
rami79
Contributor
Contributor

Methods of updating a property

I have a bit of a newbie question here, and I was wondering if someone can help clear it up for me.  I noticed that there are two methods of updating a vRA property within vRO:

1. System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(host,virtualMachineEntity,propertyName,propertyValue,propertyIsHidden,propertyIsRuntime,propertyIsEncrypted,doNotUpdate) and

2. VirtualMachineAddOrUpdateProperties = new Properties();

     VirtualMachineAddOrUpdateProperties.put(propertyName, value);

What is the difference between the two? Is one better than the other? Is it an old vs new way of doing things? Which method should I get myself into the habit of using most?

Thank you,

0 Kudos
3 Replies
iiliev
VMware Employee
VMware Employee

The code in the second point does nothing - it just creates a new empty Properties object in memory and puts one entry in it. It doesn't update anything.

0 Kudos
hawks76
Enthusiast
Enthusiast

Method 1 of updating properties can be used anytime in any workflow. Method 2 of updating properties can only be used during the provisioning process and must be passed out of a workflow as an output back to vra.
0 Kudos
rami79
Contributor
Contributor

Thank you guys for replying this make sense.  So I guess it's good habit to always use method 1 unless you are doing a quick one off update?

The reason I'm asking and trying to understand this a little bit more is I'm currently working on a deployment blueprint, and I have like 5 properties to edit during the provisioning process and a sixth one to create from scratch.  The properties are mainly networking properties so network name, and IP address.

Thanks

0 Kudos