CaptainVSANPowerCLIWith the new release of Virtual SAN 6.2, the engineering teams have made significant efforts on increasing the product’s interoperability with Command Line tools, and deliver accessible APIs for just about everything on the product.

There is an effort to make the Virtual SAN experience friendly for the DevOps audience. As we’re preparing the platform to support use cases for the VMware Photon Platform, it makes sense to become a bit more proactive with Virtual SAN CLI tools that are supported on different types of operating systems and development platforms. I’m working on a few projects that revolve around some of those use cases and I will be sharing a couple of examples in a series of blogs.

I will start with one of the most useful and powerful command line interface tools for windows and vSphere, PowerCLI. I’ve been working with Alan Renouf for some time now on the automation of all types of things with regards to the deployments of Virtual SAN. Alan who is our PowerCLI and all things APIs master and now product manager in case you didn’t know because you went to Mars and just got back from that trip.

Alan and I have been spending time working on a couple of efforts developing automated solution for the complete deployment of Virtual SAN at a data center level with the minimum amount interaction and touches with the vSphere Web Client. The idea is for anyone to get in front of their computer and very easily deploy and destroy a Virtual SAN infrastructure for any use case at any point in time if needed. You know the sorta things folks in DevOps do all the time.

So, I wanted to share the code for a PowerCLI script we have created that delivers the exact experience mentioned above. The code includes automated configuration procedures of the following vSphere and Virtual SAN artifacts:

  • Virtual Datacenter
  • Cluster
  • Adding Hosts to Cluster
  • Host Configuration (DNS, NTP, VMkernel interfaces for Virtual SAN, vMotion, VLANs, iSCSI Targets)SOLID-VSAN_logo_logo_color
  • iSCSI Software Initiator – for access to external storage
  • Distributed Switch, Distributed Port Groups
  • DVUplinks (Based on Virtual SAN recommended configurations)
  • NIC teaming policy
  • Enable Virtual SAN
  • Claim Storage devices – Flash – Caching/Write Buffer and Capacity
  • Disk Groups
  • Space Efficiency features – Sparse Swap

Note that some of the Virtual SAN features being enabled here are only available in the 6.2 release. If this is not the version you are working with, you can remove those lines of code and not include them in your script in order to avoid the ugly PowerCLI red error text on your screen.

There are a couple of new Virtual SAN features which haven’t been exposed to PowerCLI cmdlets yet and they have to be enabled from the UI at the moment. The necessary fixes for this are already in the works. The features I’m referring to are Virtual SAN’s Deduplication and Compression cluster settings as well as the Performance Services.

I used the latest version of PowerCLI which was released last week I recommend getting – PowerCLI 6.3 Release 1. I’ve included a demonstration of the script at work below to see it all working. I recommend watching the video in full screen more to clearly see the actions performed by the script just in case the font on the windows is too small to see.

You can copy the code below and use it as much as you like. I hope everyone finds this useful and for those PowerCLI pros out there feel free to provide comments and improvements. This script is great for all types of proof of concepts with minimal changes required. All you need to know and change is the IP addresses and settings to match the network settings relevant to the infrastructures where deploying Virtual SAN.

I would like to thank the folks at Micron for being generous and providing the flash devices for the Virtual SAN infrastructure used for the creation of the demo.


For future updates on Virtual SAN (VSAN), vSphere Virtual Volumes (VVol) and other Storage and Availability technologies, as well as vSphere Integrated OpenStack (VIO), and Cloud-Native Applications (CNA) be sure to follow me on Twitter: @PunchingClouds.