Running commands in batch mode

CLI commands can be grouped together and run in a batch. For example, you can use batch mode to run an identical set of commands on multiple storage systems.

Creating a batch file for the commands

Create a text file and write the commands without the xcli prefix or CLI parameters. For example:
pool_create pool=pool_00001 hard_size=171 soft_size=171 snapshot_size=65
vol_create vol=vol_00010 size=17 pool=pool_00001
vol_list vol=vol_00010
This example contains the following commands:
  • The pool_create command, along with its arguments. This command creates a storage pool, which is a prerequisite for creating a volume.
  • The vol_create command, along with its arguments. This command creates a volume in the pool that has just been created.
  • The vol_list command displays the details of the newly created volume.

Name the script file and save it.

Running a batch file

To run the batch file, you must specify the CLI parameters:
xcli -u admin -p ********** -m 127.0.0.1 -r 
"C:\Documents and Settings\avia\xcli\xcli_script.txt"
In this command:
Identification parameters
-u
Specifies the user ID.
-p
Specifies the password.
Storage system
The storage system is specified by either its IP address or name of the storage system as listed in the configuration file. See Configuration parameters for more information.
-m
Specifies the IP address of the storage system to which this command is directed.
-c
Specifies the name of the storage system to which this command is directed, as it is defined in the configuration file (for example, my_system).
The batch parameter
-r
Specifies the name of the batch file to run on the storage system.

Viewing the output

The three commands in the previous example create a pool, then create a volume, then display the volume details. The following output is returned from running these three commands in batch mode:
  • Confirmation that a pool was created
  • Confirmation that a volume was created
  • Table with the details of the newly created volume

Failure of batch mode

When one of the commands that run in batch mode fails, the following actions occur:
  1. The script exits immediately.
  2. No commands after the failing command are run.
  3. An error message is displayed identifying the CLI command that failed.