Hi,
I'm using vRA and vRO 7.4. All plugins have been installed and configured.vRA and vRO full integrated.
I have a blueprint and It has Custom Propery named VirtualMachine.Network0.ProfileName. It has a value like "External-Network-XXX"
I have created subscription and called a workflow when request life cycle state has VMPSMasterWorkflow32.Requested. I am getting all properties of this request with payload... It is very easy..
This workflow is doing something and when workflow is finished I want to update VirtualMachine.Network0.ProfileName value as "External-Network-YYY". Then VM will be created on External-Network-YYY profile.
Because VM network profile needs to change according to some circumstances ..
How to do this ?
If you have the EBS workflow and all you want to do is set the property on the VM then use this OOTB action
// update the vm properties
System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(vcacHost, virtualMachineEntity,
"Property name goes here", "Property value goes here",false,false,false,false);
In your case this should work since the event state is MachineRequested (assuming you get the NWProfile create part sorted out before this event runs etc). In the Requested state you can more or less override any custom property as it is the last state before vRA begins creating anything for the new VM. I've used this approach before to do things like
- change the VM name and hostname
- Re-size the VM
- Add disks
- etc...
I would point out that I *normally* do these kind of changes using an XaaS workfow as an overlay to a vRA CatalogItem but your proposed approach here should be fine as it amounts to the same thing just via the EBS
HTH
Although it's probably not what you're looking for, a far simpler way that I use to accomplish this is with Property Toolkit for use cases just like this.
SovLabs Property Toolkit Part 2: Dynamic Custom Property Assignment – SovLabs
Thanks for your reply but, dynamic custom property is not suitable for my case. Network Profile just is an example. Other custom property might be change as well.
That's exactly what the Property Toolkit is designed to do. Did you read the article I wrote? You can change basically any property you want to dynamically based on the value of other properties.
Hello Legioon,
I think you need to add 2 output parameters of type Properties in your subscription event workflow :
- virtualMachineAddOrUpdateProperties
- virtualMachineDeleteProperties
If you wand to add, update or delete a property, just push it in the right output parameter.
For your property "VirtualMachine.Network0.ProfileName", call this :
var virtualMachineAddOrUpdateProperties = new Properties();
virtualMachineAddOrUpdateProperties.push("VirtualMachine.Network0.ProfileName", "External-Network-YYY");
If you want to delete some property, call this :
var virtualMachineDeleteProperties = new Properties();
virtualMachineDeleteProperties.push("MyProperty.To.Delete", null);
Emmanuel.
Yes i read. Of course it is very useful article but, in this article all values are predefined and static. But My network profiles are not predefined. In the beginning there is not any network profile on vRA.. It will be created with vRO workflow after when getting IP block from Infoblox, then it will be assigned to blueprint request, after that VM will be created on this profile.
If you have the EBS workflow and all you want to do is set the property on the VM then use this OOTB action
// update the vm properties
System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(vcacHost, virtualMachineEntity,
"Property name goes here", "Property value goes here",false,false,false,false);
In your case this should work since the event state is MachineRequested (assuming you get the NWProfile create part sorted out before this event runs etc). In the Requested state you can more or less override any custom property as it is the last state before vRA begins creating anything for the new VM. I've used this approach before to do things like
- change the VM name and hostname
- Re-size the VM
- Add disks
- etc...
I would point out that I *normally* do these kind of changes using an XaaS workfow as an overlay to a vRA CatalogItem but your proposed approach here should be fine as it amounts to the same thing just via the EBS
HTH