5.5

Table Of Contents
n
Value: VC:VirtualMachine
n
Description: The virtual machine for which to return the Disk Modes
12 Add the following scripting in the bottom of the Scripting tab.
The following code returns an array of disk modes for the disks of the virtual machine.
var devicesArray = vm.config.hardware.device;
var retArray = new Array();
if (devicesArray!=null && devicesArray.length!=0) {
for (i in devicesArray) {
if (devicesArray[i] instanceof VcVirtualDisk) {
retArray.push(devicesArray[i].backing.diskMode);
}
}
}
return retArray;
13 Click Save and Close to exit the Actions palette.
You have defined the custom action the Take a Snapshot of All Virtual Machines in a Resource Pool
workflow requires.
What to do next
Create the workflow's schema.
Create the Schema of the Complex Workflow Example
You can create a workflow's schema in the workflow editor. The workflow schema contains the elements
that the workflow runs, and determines the logical flow of the workflow.
Prerequisites
Complete the following tasks.
n
“Create the Complex Workflow Example,” on page 103.
n
“Create a Custom Action for the Complex Workflow Example,” on page 104.
n
Open the workflow for editing in the workflow editor.
Procedure
1 Click the Schema tab in the workflow editor.
2 Add the following schema elements to the workflow schema.
Element Type Element Name Position in Schema
Scriptable task
Initializing Below the Start element
Decision
VMs to Process? Below the Initializing scriptable task element
Scriptable task
Pool Has No VMs Below the VMs to Process? custom decision element, linked with a red
arrow
Custom decision
Remaining VMs? Right of the VMs to Process? custom decision element, linked with a
green arrow
Action
getVMDiskModes Right of the Remaining VMs? custom decision element, linked with a
green arrow
Custom decision
Create Snapshot? Right of the getVMDiskModes action element, linked with a blue arrow
Chapter 1 Developing Workflows
VMware, Inc. 105