Overview
In this post we will create the workflow that will run when vCD sends a message to the AMQP server. At the end we will see the data that vCloud passes to the workflow. We will simply print out some of this data, but this info can be used in many ways. For example, it could be used for a provisioning process that performs various tasks such as creating a computer object in AD, creating an IP/DNS entry, registering the VM in a configuration management tool, etc. This is what we do in our private cloud. Users log into vCloud Director, select their VM and from there vCO talks to all the necessary components to get the VM ready for the user.
Configuring the Workflow Runner Workflow
From anywhere within the vCO client, right-click a folder and select New workflow:
Provide the workflow a name:
After you press OK, you’ll be on the Inputs page.
- Select the new parameter icon (right-arrow with plus sign)
- Select arg_in_0
- Enter organization
- Press OK
Now we need to set the object type of our organization attribute.
- Select string
- Enter organization
- Select vCloud:Organization
- Press Accept
Repeat for the vapp, user and blockingTask attributes. It should look like this:
Select the Schema tab and drag a Scriptable task object from the Generic group onto the blue line between the Start and End elements:
Select the IN tab and select organization, vapp, blockingTask and user:
Click on the Scripting tab and enter the following in the scripting field:
You should be able to press Save and close and not receive any errors.
Now we can configure the Workflow runner workflow to call the workflow we just created. You can easily find the workflow by:
- Entering Workflow runner in the search box in the upper-right corner of the vCO client.
- Select the highlighted workflow
- Select Go to selection
- Select Close
Edit the workflow and on the General tab under attributes we want to set vcdHost and wf. Here we can see that they are both not set:
Select Not set for the vcdHost attribute then
- Double-click vCloud Director to expand it.
- Select your vCloud Director host. Mine is vcd55.vmware.local
- Press Select
Select Not set for the wf attribute then
- Enter the name of our test workflow.
- Select it
- Press Select
It should look like this:
We need to make a quick change to make sure the vcdHost and wf attributes get passed correctly. I’m not sure why this needs to be done.
- Click the Schema tab.
- Select the Retrieve message object.
- Select the Out tab.
- Select both the vcdHost and wf parameters and delete them.
It should look like this:
You can now save and close.
Back to vCloud Director
If we’ve done everything correctly up to this point and we start a vApp in vCloud Director, the Workflow runner workflow should run and then start our vcd Test workflow. Here we can see see that the Workflow runner workflow ran successfully. You can also see some data is was able to parse from the blocking task:
We can see the same thing with the vcd Test worflow that we ran. We simply display a few attributes and resume the blocking task, which tells vCloud Director that it can continue with starting the vApp: