Understanding Workflows - Oracle ZFS Storage Appliance Administration Manual

Hide thumbs Also See for ZFS Storage Appliance:
Table of Contents

Advertisement

Understanding Workflows

Understanding Workflows
A workflow is embodied in a valid ECMAscript file, containing a single global variable,
workflow. This is an Object that must contain at least three members:
TABLE 125
Required member
name
description
execute
EXAMPLE 18
The following is an example of a basic workflow:
var workflow = {
};
Uploading this workflow will result in a new workflow named "Hello world"; executing the
workflow will result in the output "hello world!"
EXAMPLE 19
Workflows execute asynchronously in the appliance shell, running (by default) as the user
executing the workflow. As such, workflows have at their disposal the appliance scripting
facility (see
as any other instance of the appliance shell. That is, workflows may execute commands, parse
output, modify state, and so on. Here is a more complicated example that uses the run function
to return the current CPU utilization:
var workflow = {
};
588
Oracle ZFS Storage Appliance Administration Guide, Release OS8.6.x • September 2016
Required Object Members
Hello World Workflow
name: 'Hello world',
description: 'Bids a greeting to the world',
execute: function () { return ('hello world!') }
Using the Workflow Run Function to Return CPU Utilization
"Working with CLI Scripting" on page
name: 'CPU utilization',
description: 'Displays the current CPU utilization',
execute: function () {
run('analytics datasets select name=cpu.utilization');
cpu = run('csv 1').split('\n')[1].split(',');
return ('At ' + cpu[0] + ', utilization is ' + cpu[1] + '%');
}
Type
String
String
Function
43), and may interact with the appliance just
Description
Name of the workflow
Description of workflow
Function that executes the workflow

Advertisement

Table of Contents
loading

Table of Contents