Virtual SAN leverages Storage Policy Based Management to individually tailor a virtual machine’s protection and performance profile. This lessens the burden of storage provisioning operations on administrators.
Deploying Virtual SAN is pretty simple. When using Virtual SAN Ready Nodes, or vSphere hosts with approved hardware, it is as easy launching a wizard and clicking next, next, next. Another option, is to use Virtual SAN in an Engineered Appliance, like VxRAIL, which includes additional management capabilities of many tasks.
Management of vSphere through tools other than the UI has been around for a while. Tools including the vSphere CLI, vSphere PowerCLI, vSphere Management API make management of vSphere very extensible. Virtual SAN Management in these tools has been somewhat limited until recently.
In Virtual SAN 6.2, a new Virtual SAN Management API was introduced. This API is an extension of the vSphere Management API. It gives administrators/developers the ability to manage all aspects of Virtual SAN via API.
In an effort to get some examples together, we’ve put together a cookbook with a few sample code snippets, illustrating just a few of the things that can be accomplished using the Virtual SAN Management API.
It focuses on using Python to perform tasks like deploying Virtual SAN, configuring a Stretched Cluster, and perform an On-Disk Format upgrade.
These are some of the most common tasks that administrators perform when deploying or managing Virtual SAN.
Each “recipe” illustrates the actions an administrator might perform in the vSphere Web Client and provides some sample code to do the same in Python. While the cookbook does not provide the final code, it does reference the VMware Developer Center, where a copy of the script can be found.
The vsanDeploy.py sample script can be seen tagging VMkernel interfaces, enabling Virtual SAN on each cluster, and claiming disks.
The upgradeVSAN.py sample script can be seen here upgrading a Hybrid VSAN cluster and an All-Flash cluster. Notice also that deduplication and compression are enabled in the All-Flash cluster in conjunction with the upgrade.
The Virtual SAN Management API isn’t limited to Python as the only language it can be used with. There are also SDKs for other languages including Ruby, Perl, C#, and Java.
Sample scripts for the Virtual SAN Management API, as well as the vSphere API and more, can be found at the VMware Developer Center.
Get the Virtual SAN Management API Cookbook for Python here: http://www.vmware.com/content/dam/digitalmarketing/vmware/en/pdf/techpaper/VSAN-API-Cookbook-for-Python.pdf
Look for code provided by the community and get started automating Virtual SAN today!