vCloud Automation Center 6.0 and vCenter Orchestrator Advance Automation -Part03
Part1, Part2 are simple in some ways & parts. Next part is bit difficult to understand. At least it was for me. I will explain what I’m going to do at high level. I’ll get Machine Name. Then I will get Machine Property –> Machine Property will give me custom property ( VM Size which user be selecting from drop down menu as referred here and Backup Selection referred here ) finally I will Invoke VCO workflow. In this workflow which needs VM Name input and VM Size, Backup Choice as input – I will put VM Name which I get from Get Machine Name property and VM Size, Backup choice which I got from Get Machine Property
Now lets find where to do this and how to do this. Once you understand the basic concept it is way too simple. First open vCAC designer. In that first select load and then select “WFStubMachineProvisioned”. Why “WFStubMachineProvisioned”. Well, this workflow is called immediately when the status of VM is provisioned. More information is available in http://pubs.vmware.com/vCAC-60/topic/com.vmware.ICbase/PDF/vcloud-automation-center-60-extensibility.pdf guide
In below screen double click on “Machine Provisioned”
Scroll down till you find custom code and double click on the custom code
From left hand side “DynamicOps.Cdk.Activities” Drag “GetMachineName”
I have defined two variable for this custom code
vmname (to capture VM Name)
VMSize (to capture VM size e.g. Large, Medium and Small in string format)
VarBackupOption (To capture user selection Yes/No in string format)
Double click on GetMachineName
In Machine Id field put a pre-defined variable “VirtualMachineId”. This is standard value. Please do not change it. Under machine name put the variable vmname. This variable we have defined above.
Machine Name will pickup name from virtualmachineid and pass it to vmname. Finally variable vmname will hold the name of the vm. We are done with GetMachineName.
Click on the custom code as shown in above figure, it will take you back to custom code screen. Now from left hand side ”DynamicOps.Cdk.Activities” Drag “GetMachineProperty”
GetMachineProperty reads the custom property you have defined and the value associated with that property in vCAC. In our case I have defined custom property with name VMSize and it’s value will come from value select from drop down menu. This value (e.g. Large, Medium or Small) will be taken by variable VMSize
You will notice VMSize property name is in Quotes however Property Value is without quotes. It is because VMSize in property value is variable which will be captured from user interaction in vCAC and VMSize in property name is coming from custom property defined in vCAC.
Conceptually this is how it is related
I repeated the same procedure for Backup choice and here is how it looks below
VarBackupOption will hold the user selection string value which would be either Yes or No and pass it to vCO workflow
Now we have Virtual machine name captured in VMName variable, VMSize captured in VMSize variable and BackupOption capture in VarBackupOption we are ready for next drag and drop
Simply put VMName and VMSize as input to VCO workflow.
Now below is how entire workflow looks like
Now you are done with, simple Send and that updates the WFStubMachineProvisioned
This is all you need to do. Request Virtual Machine and you will get what you have configured.
Complete log of VM provisioning via vCAC and VCO is presented below with sequence of action.