4.1

Table Of Contents
9 Add the following description of the action in the General tab.
This action returns an array containing the disk modes of all disks on a VM.
The elements in the array each have one of the following string values:
- persistent
- independent-persistent
- nonpersistent
- independent-nonpersistent
Legacy values:
- undoable
- append
10 Click the Scripting tab.
11 Right-click in the top pane of the Scripting tab and select Add Parameter to create the following input
parameter.
n
Name: vm
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
You must create the workflow schema.
Create the Complex Workflow Example Schema
You create a workflow's schema in the Schema tab of the workflow editor. The workflow schema contains the
elements that the workflow runs.
Prerequisites
You must have created the Take a Snapshot of All Virtual Machines in a Resource Pool workflow, defined its
input parameter, and created the getVMDiskModes action.
Procedure
1 Right-click the Take a Snapshot of All Virtual Machines in a Resource Pool workflow to open the workflow
editor.
2 Click the Schema tab in the workflow editor.
vCenter Orchestrator Developer's Guide
92 VMware, Inc.