pages

Showing posts with label custom properties. Show all posts
Showing posts with label custom properties. Show all posts

Monday, July 1, 2013

vCAC - What if you need vCO on every blueprint?

Based on my blog posts you know already how to interact with vCenter Orchestrator from a vCloud Automation Center blueprint. When you use this interaction there will be the day when you ask yourself: "How can  i use different workflows with the same stub?".

To be honest, it looked to me as there is only one external call possible at the "ExternalWFStubs.MachineProvisioned" stub, but what if i can create another stub based on this provisioning state? Something like "ExternalWFStubs.MyMachineStateEqualMachineProvisioned"? Heureka!

Here is how:

First you have to install the CDK plug-in for Visual Studio. This enables the vCAC workflow generator and allows you to generate a "StateChange" workflow with your own stub name.













I named my workflow: "MyShinyWorkflow" and this is shown as naming in the solution explorer.











Now you can build everything you want in Visual Studio... or you can upload the empty workflow in your vCAC like described in the .txt file (just open the solution in a windows explorer and copy the files).


Cloudutil Workflow-Install -f MyShinyWorkflow.xaml -n MyShinyWorkflow














Don´t forget to copy the .xml file to the /xmldb folder in your vCAC file location. After that you are able to "design" your workflow in the vCAC Design Center.

















With this new workflow you can set a custom property for example (keep in mind that this is only a simple one)














Now you can upload the workflow it will set a new custom property when the workflow is called.














Just add your stub (mine is named: ExternalWFStubs.MyMachineStateEqualMachineProvisioned) to the blueprint you want to enhance.












After the machine is requested the custom property is set once the "MachineProvisioned" stated is reached.











Now you have the power!

Tuesday, April 23, 2013

Using vCAC custom properties as vCO inputs

Based on the excellent blog post at vcoteam.info describing the decommission of services with vCenter Orchestrator integration, I searched for an option to deliver input values for workflows from vCAC to vCO.

A big thanks goes to my fellow Adam Bohle for providing me the essential answer :)

The "Extensibility Guide" describes different ExternalWFStubs for some states of the service lifecycle.









So this is where you can access external systems using the vCloud Automation Design Center. So the first step is to build or enhance a blueprint adding the ExternalWFStubXXX property. In my case I used the ExternalWFStubs.MachineProvisioned.







The next step is to add a new custom property "ValueToReceive" and let the user make some input (User Prompt = Yes).

So this was all from the vCAC side!

In vCO I designed a little workflow finding the virtual machine object with the vmName as IN-Parameter.















So in my case the value to receive is the vmName the user enters in the vCAC wizard. So let´s check out the vCAC Design Center workflow. First you have to "Load" the actual release of the WFStubMachineProvisioned workflow:

















Now you can double click the "Custom Code" part of the loaded workflow and add two more variables: vmName (String) and VM (VirtualMachine).






The next step is to drag a "GetMachineProperty" element next to the "Start" element and open it with a double click:











Enter the values as shown in the screen and go back to the Custom Code (Navigation on top of the workflow).

Now drag the "InvokevCOworkflow" element next to the "GetMachineProperty" element, browse for the vCO workflow we designed first and enter "vmName" as Input and "myVm" as Output:





















Now you can connect every step and you will see if there is any error. In my case I had to enter "virtualMachineId" in the VirtualMachineId field on the right upper side for the "InvokevCOworkflow" element:
















When everything is okay (no error messages) you can now press the "Load" button and give the new workflow release a description. With this step the workflow is updated.

After the configuration you can now deploy a virtual machine ("Windows XP instance" in my environment) from the enhanced blueprint and the wizard will ask for a custom property called "ValueToReceive":
















So this is the value our vCO workflow should receive. Keep in mind that this is just a functional example. You can do this with every option you want to provide ("Backup Network", "Additional Tools" etc.) to a vCO workflow.

When the machine is provisioned there should be a new workflow run with your value :)









Simple, isn´t it?