Vmware VRO (VCO) :How to design workflow :Basic Workflow[series3]

In this section, We will try to write a workflow from scratch… When we start writing any workflow, we need to start from following:

  • What needs to be developed, means understand the requirement properly
  • Perform manually what parameters are require, possibly from virtual center.

Lets start for a workflow, where we are get virtual machine snapshots. When we do manually, we connect to esx(i) host (using VIC/web client), for a particular vm right click and snapshot manager.

Lets have a api search in vRo, searching

snapshot2

In Api search, we will find lot snapshot related stuff such as revert,create.. We need to select what we are looking for “get vm snapshot”.

snapshot3

There are methods or attribute define in different object. In VcPlugin, getAllVirtualMachineSnapshots method is available. Lets have a look into this method:

snapshot

This method has two parameters and one return type value.

  • Parameters
    • additonalPropertyFilters(array of String)
    • query(string) /*Xpath query*/
    • Return Type: Array of VcVirtualMachineSnapshot

First parameter additional property filters, its a big topic to discuss, “PropertyFilter is actually applying a filter to each result, as in, return the following fields for each result instead of filtering the results set based on the PropertyFilter.  So it will return the properties as the result of filter.

Xpath query will be used to search the result from vCo side.

Lets start writing the workflow, we create a workflow and go in schema , we see the below figure.

snapshot1\

In this workflow we need the list of virtual Machines which snapshots need to be searched. So first input is “List of Virtual Machines: So our input is Vc:VirtualMachine array type. Output is “Array of VcVirtualMachineSnapshot”. So we define Snapshot output type VC:VirtualMachineSnapshot.

Currently in schema we select the scriptable task.

snapshot5

Visual binding of the inputs and output in schema:

snapshot6

The Scripting part :

for(i in VMs) {
var vmpattern = VMs[i];
var XPath = "xpath://name[starts-with(.,'"+vmpattern+"')]";
ListSnapshot = VcPlugin.getAllVirtualMachineSnapshots(null,XPath);
Snapshot=ListSnapshot;
System.log (Snapshot);
}

Above is scripting part, which is working state,tried to use all the parameters defined above..

Below is the presentation layer, when we start executing the workflow, this is the layer will give the front end. It will ask the list of the array which we need

snapshot7

snapshot4

In upcoming series, we will try to understand more about propertyfilter… it will help for further coding…