The release of SimpliVity’s OmniStack 3.5 includes a number of great new features and functions which further expand the capabilities of the SimpliVity Data Virtualization Platform (DVP). One new feature which I am very excited about is the addition of a REST API. The SimpliVity REST API provides an easy way for administrators to create scripts for automating common tasks and reporting in a SimpliVity environment. The REST API also provides a path for third party software providers to integrate SimpliVity functionality into their monitoring and automation products.
This is the first GA release of the SimpliVity REST API. With this release an administrator can perform a number of operations on objects within the SimpliVity Federation including:
- Virtual Machines – List, find, report, clone, and move
- Backups – List, find, copy, and recover
- Backup Policies – List, create, and edit
- OmniStack Hosts – Reporting on health and capacity
- Datastores – List, report, create, and delete
The SimpliVity REST API documentation can be accessed by pointing a browser to the management IP/FQDN to any OmniStack Virtual Controller (OVC) running in the OmniStack 3.5 environment:
SimpliVity REST API operations can also be performed directly from the OVC web interface.
The SimpliVity REST API allows us to do some useful stuff with Virtual Machines running on the SimpliVity DVP. We can get information about virtual machines, set a virtual machine’s backup policy, create a backup of a virtual machine, clone a virtual machine, and even move a virtual machine from one datacenter to another.
The outline of the process for using the SimpliVity REST API to SimpliVity Rapid Clone a virtual machine:
- Authenticate and receive an authentication token.
- Get the VM ID of the source Virtual Machine to clone.
- SimpliVity Rapid Clone the source Virtual Machine.
- Report on the SimpliVity Rapid Clone task.
Each of these operations can be executed from the SimpliVity REST API web interface. Very useful for testing, but not exactly an efficient way for automation. The same operations can be called using scripts. Here are a couple script examples using Python and pyCurl to clone a Virtual Machine using the SimpliVity REST API.
The first example is SVTcloneVM.py. This script takes two command line parameters: the source VM to clone, and the name of the new clone. The script obtains an authentication token, locates the VM ID for the source VM, and then creates a clone of the source VM. The Python code for SVTcloneVM.py can be found here.
In the screenshot below SVTcloneVM.py is being used to clone 01_DEMOWINVM to 02_DEMOWINVM:
Another example, SVTMultiCloneVM.py, creates multiple clones of a source VM. The script takes two command line parameters: the source VM to clone, and the number of clones to create. The script obtains an authentication token, locates the VM ID for the source VM, and then creates the number of clones specified of the source VM. The newly cloned VMs will use the name of the source VM with a number appended (sourceVM-1). The Python code for SVTMultiCloneVM.py can be found here.
In this screenshot SVTMultiCloneVM.py is creating 10 clones of 01_DEMOWINVM:
These scripts could be used to quickly clone virtual machines for testing, development, or even for provisioning a new application. The scripts make the processes easily repeatable, and they also could be easily scheduled.
In the two example scripts, SVTcloneVM.py and SVTMultiCloneVM.py, you may notice the same functions defined and used in each of the scripts. These functions are:
post_SVTREST(url, data, header),
jpost_SVTREST(url, data, header), and
get_SVTREST(url, header). The functions can be re-used in other scripts to execute other SimpliVity REST API operations.
post_SVTRESTfunction is used for POST operations which use url encoded data. The Authentication operation uses this function. The function returns JSON data.
get_SVTRESTfunction is used for GET operations. The operation to get the VM ID of the source VM uses this function. The function returns JSON data.
jpost_SVTRESTfunction is used for POST operations which use JSON data. The operation to clone the source VM uses this function. The function returns JSON data.
Very cool stuff! Looking forward to doing more (and learning more). Very excited to see how this will enable SimpliVity Technology Alliance Partners to integrate their solutions with SimpliVity DVP.
The REST API is a fantastic new feature in OmniStack 3.5 which provides even more ways to Simplify IT with SimpliVity.