4.2
Table Of Contents
- Developing with VMware vCenter Orchestrator
- Contents
- Developing with VMware vCenter Orchestrator
- Updated Information
- Developing Workflows
- Principal Phases in the Workflow Development Process
- Accessing the Orchestrator Client
- Testing Workflows During Development
- Workflow Editor
- Provide General Workflow Information
- Defining Attributes and Parameters
- Workflow Schema
- Obtaining Input Parameters from Users When a Workflow Starts
- Requesting User Interactions While a Workflow Runs
- Add a User Interaction to a Workflow
- Set the User Interaction security.group Attribute
- Set the timeout.date Attribute to an Absolute Date
- Calculate a Relative Timeout for User Interactions
- Set the timeout.date Attribute to a Relative Date
- Define the External Inputs for a User Interaction
- Define User Interaction Exception Behavior
- Create the Input Parameters Dialog Box for the User Interaction
- Respond to a Request for a User Interaction
- Calling Workflows Within Workflows
- Running a Workflow on a Selection of Objects
- Developing Long-Running Workflows
- Configuration Elements
- Workflow User Permissions
- Validating Workflows
- Running Workflows
- Develop a Simple Example Workflow
- Create the Simple Workflow Example
- Define the Simple Workflow Example Parameters
- Create the Simple Workflow Example Schema
- Link the Simple Workflow Example Elements
- Create Workflow Zones
- Define the Simple Workflow Example Decision Bindings
- Bind the Simple Workflow Example Action Elements
- Bind the Simple Workflow Example Scripted Task Elements
- Define the Simple Example Workflow Exception Bindings
- Set the Simple Workflow Example Attribute Read-Write Properties
- Set the Simple Workflow Example Parameter Properties
- Set the Layout of the Simple Workflow Example Input Parameters Dialog Box
- Validate and Run the Simple Workflow Example
- Develop a Complex Workflow
- Create the Complex Workflow
- Define the Complex Workflow Example Input Parameters
- Create a Custom Action For the Complex Workflow Example
- Create the Complex Workflow Example Schema
- Link the Complex Workflow Example Schema Elements
- Create the Complex Workflow Example Zones
- Define the Complex Workflow Example Bindings
- Set the Complex Workflow Example Attribute Properties
- Create the Layout of the Complex Workflow Example Input Parameters
- Validate and Run the Complex Workflow Example
- Scripting
- Orchestrator Elements that Require Scripting
- Limitations of the Mozilla Rhino Implementation in Orchestrator
- Using the Orchestrator API
- Access the Scripting Engine from the Workflow Editor
- Access the Scripting Engine from the Action or Policy Editor
- Access the Orchestrator API Explorer
- Use the Orchestrator API Explorer to Find Objects
- Writing Scripts
- Add Parameters to Scripts
- Accessing the Orchestrator Server File System from JavaScript and Workflows
- Accessing Java Classes from JavaScript
- Accessing Operating System Commands from JavaScript
- Exception Handling Guidelines
- Orchestrator JavaScript Examples
- Developing Actions
- Creating Resource Elements
- Creating Packages
- Index
What to do next
You can define long-running workflows.
Running a Workflow on a Selection of Objects
You can automate repetitive tasks by running a workflow on a selection of objects. For example, you can create
a workflow that takes a snapshot of all the virtual machines in a virtual machine folder, or you can create a
workflow that powers off all the virtual machines on a given host.
You can use one of the following methods to run a workflow on a selection of objects.
n
Run the Library > vCenter > Batch > Run a workflow on a selection of objects workflow.
n
Create a workflow that calls the Orchestrator > Start workflows in a series or Start workflows in
parallel workflows.
n
Create a workflow that obtains an array of objects and runs a workflow on each object in the array in a
loop of workflow elements.
n
Run a workflow from JavaScript by calling the Workflow.execute() method in a For loop in a scripted
element in a workflow.
Which method you choose to run a workflow on a selection of objects depends on the workflow to run and
can affect the performance of the workflow. For example, running the Run a workflow on a selection of objects
workflow is the simplest way to run a workflow on multiple objects and requires no workflow development,
but it can only run workflows that take a single input parameter.
Creating a workflow that calls the Start workflows in a series or Start workflows in parallel workflows allows
you to run on multiple objects workflows that take more than one input parameter. The calling workflow must
create a properties array to pass the input parameters to the Start workflows in a series or Start workflows in
parallel workflow. These workflows are only for use in other workflows. Do not run them directly.
Running a workflow in a For loop in a scripted element is faster than running a workflow in a loop of workflow
elements, but it is less flexible and limits the potential for reuse. Most importantly, running a workflow in a
scripted loop loses the checkpointing that Orchestrator performs when it starts each element in a workflow
run. As a consequence, if the Orchestrator server stops while the scripted loop is running, when the server
restarts, the workflow will resume at the beginning of the scripted element, repeating the whole loop. If the
Orchestrator server stops while running a workflow with a loop of workflow elements, the workflow will
resume at the specific element in the loop that was running when the server stopped.
For more information about the Batch workflows, see Using vCenter Orchestrator Plug-Ins.
How to create a workflow that runs a workflow on an array of objects in a loop of workflow elements is
demonstrated in “Develop a Complex Workflow,” on page 87.
How to run a workflow in a scripted For loop is demonstrated in “Workflow Scripting Examples,” on
page 117.
Implement the Start Workflows in a Series and Start Workflows in Parallel
Workflows
You can use the Start workflows in a series and Start workflows in parallel workflows to run a workflow on a
selection of objects.
You cannot run the Start workflows in a series and Start workflows in parallel workflows directly. You must
include them in another workflow that you create. To use the Start workflows in a series and Start workflows
in parallel workflows to run a workflow on a selection of objects, you must obtain the objects on which to run
the workflow. You pass these objects and any other input parameters that the workflow requires to the
workflow as an array of properties. The Start workflows in a series and Start workflows in parallel workflows
emit the results of running the workflow on the selection of objects as an array of WorkflowToken objects.
Developing with VMware vCenter Orchestrator
54 VMware, Inc.