Powershell/PowerCLI to Automate Nimble Datastore Build from OneView to Vmware

I recently added a Nimble storage system to my Cloud environment . This introduced a new challenge from an automation perspective. I am working to have most all of the process of bringing a new tenant into the cloud automated. Previously I built some automation to work with HPE OneView and 3Par to create volumes and that was about as far as I got. I've been testing new automation this week and am ready to share it in case you run into the same challenge I did.

At the end of this we will have leveraged Powershell/PowerCLI to connect to OneView and build a new volume, then connect it to all the server profiles in a cluster. Connect to VMware and rescan the vHost for new storage, then create an new datastore. Lastly we will create a tag for the new datastore and build a storage policy that we can later use when we are building Org VDC's in vCloud Director.

Here we go;

first we have to connect to OneView and vCenter

Next we will create the variables needed for the builds. Couple notes on the screen shot below. I pre-populated the $pool and $system variables in this script because they will not change for me. To get the pool information, once you have connected Powershell to the OneView server run this command Get-HPOVStoragePool. To get the system information run this command Get-HPOVStorageSystem

After we have our variables define we can begin to create our new volume in OneView.

After the volume is created we need to add the new volume to our server profiles.

Now we are all set on the OneView side. On to vCenter to finish up. First we need to rescan the vHost in the cluster to see the new storage. Then leverage a function called Get-FreeEsxiLUNS I found at http://vcloud-lab.com/entries/powercli/find-free-or-unassigned-storage-lun-disks-on-vmware-esxi-server This function will find the unused storage we just presented. I made a few adjustments to be sure it was using the Nimble storage just in case. Then we create the new datastore. Finally do one more rescan/refresh to be sure all the vHost see the new datastore

The last thing I wanted to do with this script was to create a Tag and a storage policy to leverage later when building the virtual datacenters in vCloud Director.

All that is left to do from here is to disconnect from the OneView server and vCenter. I hope this script is as useful for you as it has been for me. Below is a link to my github where the entire script can be downloaded.


Thanks for reading.