Process automation with Zadara Storage VPSAs


By using Zadara Storage REST APIs it is possible to automate all operations performed through the VPSA GUI. The full API document is located here.  (V2)

This article contains some examples of basic operations with volumes through the command line to simplify your VPSA adoption.


1. Example script to attach/detach volume to the server & more

The small Python script might be downloaded from the end of the article.  Most VPSAs created from the end of 2013 onwards are using V2 of the REST APIs, and the appropriate script should be chosen.


Usage: -i vpsa_ip -k key -o operation [options]

-h, --help                    show this help message and exit
-i IP, --ip=IP                VPSA IP
-k KEY, --key=KEY             Access key for the VPSA
-o OP, --operation=OP         Operations: [create_volume|attach|detach|list_volumes]
-v VOLUME, --volume=VOLUME    Volume name
-r RAID, --raidgroup=RAID     RAID Group name (optional)
-z SIZE, --size=SIZE          Volume size, GB
-t VOL_TYPE, --type=VOL_TYPE  Volume type: [nfs|block] (default: nfs)
-s SERVER, --server=SERVER    Server name (optional)

The IP of your VPSA might be retrieved from the VPSA Management console or from the VPSA GUI (Controllers / iSCSI IP)

The Access Key is presented in VPSA GUI (Access Control / Users section)


Attach NFS or Block volume to the current server:

./ -k ABCDEF12345 -i -o attach -v vol1 -t nfs 
./ -k ABCDEF12345 -i -o attach -v vol2 -t block


Attach NFS or Block volume to another server:

./ -k ABCDEF12345 -i -o attach -v vol1 -t nfs -s AMAZONA-S77ARGH
./ -k ABCDEF12345 -i -o attach -v vol2 -t block -s AMAZONA-S77ARGH


Detach NFS or Block volume from the current server:

./ -k ABCDEF12345 -i -o detach -v vol1


Detach NFS or Block volume from another server:

./ -k ABCDEF12345 -i -o detach -v vol1 -s AMAZONA-S77ARGH


Create NFS or Block volume of size 10GB from the RAID Group ‘R5’

./ -k ABCDEF12345 -i -o create_volume -v vol1 -r R5 -z 10 -t nfs
./ -k ABCDEF12345 -i -o create_volume -v vol2 -r R5 -z 10 -t block


*** NOTE *** This script was created for VPSA V1. The create NFS/Block volume functionality will not work with V2.


Create NFS or Block volume of size 10GB from any RAID group:

./ -k ABCDEF12345 -i -o create_volume -v vol1 -z 10 -t nfs
./ -k ABCDEF12345 -i -o create_volume -v vol2 -z 10 -t block


List all volumes

./ -k ABCDEF12345 -i -o list_volumes


2. Example script to replace iSCSI Initiator name

If you spawn a VM from the AMI with pre-installed iSCSI Initiator software, your new VM will have the same iSCSI IQN name as the original AMI. This will happen, because the IQN is generated during the iSCSI Initiator package installation.

There are several ways to fix the problem. We would recommend the following procedure:

Before creating an AMI:

- replace the IQN stored in /etc/iscsi/initiatorname.iscsi with something like:

- create a boot script, who will replace the %CHANGE_ME% to some unique value:

UNIQUE_SUFFIX=\`/sbin/iscsi-iname -p ""\`
sed -e "s,%CHANGE_ME%,\$UNIQUE_SUFFIX,g" -i /etc/iscsi/initiatorname.iscsi

- make this script to run at a boot time (optionally, this script can destroy itself after the 1st run).

- create an AMI


Have more questions? Submit a request


Please sign in to leave a comment.