Skip to content

Instantly share code, notes, and snippets.

@nacx
Last active December 11, 2015 22:48
Show Gist options
  • Select an option

  • Save nacx/4671933 to your computer and use it in GitHub Desktop.

Select an option

Save nacx/4671933 to your computer and use it in GitHub Desktop.
Massive create iSCSI volumes in Abiquo
#!/bin/bash
HOST=localhost # The hostname or address of the target Abiquo api
NUM=20 # The number of volumes to create
DC=2 # The datacenter where the volumes will be created
TIER=1 # The tier where the volumes will be created
VDC=4 # The virtual datacenter where the volumes will be created
SIZE=32 # The size of the volumes to create in MB
LOGIN=admin:xabiquo # The credentials
for V in `seq 1 ${NUM}`; do
curl "http://${HOST}/api/cloud/virtualdatacenters/${VDC}/volumes" \
-X POST \
-u ${LOGIN} \
-H "Content-type: application/vnd.abiquo.volume+xml" \
-d "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>
<volume>
<link href=\"http://${HOST}/api/admin/datacenters/${DC}/storage/tiers/${TIER}\" rel=\"tier\" />
<name>Volume ${V}</name>
<sizeInMB>${SIZE}</sizeInMB>
</volume>" | xmlindent -nbe -f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment