Creating and Adding Storage with Dell Storage Manager SDK and VMWare PowerCLI

Recently I was tasked with the storage migration of our vmware environment.  We were moving from an aging dell compellent about to fall off of support to the latest model compellent that should get us through the next few years.  Over time we had ammassed hundreds of datastores and raw device mappings and the dell storage manager gui is quite cumbersome when trying to recreate all of this on a new san.  Enter.. Dell Storage Manager SDK (links below).  The dell storage manager sdk allows you to manage your environment using powershell commands.  This was huge!  What would have taken hours and hours was completed in minutes.

 

A quick look through the cookbook (links below) to get connected with a script such as:

Import-Module C:\dell_sdk\DellStoragePowerShellSDK_v3_5_1_9\DellStorage.ApiCommandSet.psd1
$DsmHostName = "data collector host"
$DsmUserName = "username"
$ConnName = "DSM"
$DsmPassword = Read-Host -AsSecureString -Prompt "Please enter the password for $DsmUserName"
Connect-DellApiConnection -HostName $DsmHostName -User $DsmUserName -Password $DsmPassword -Save $ConnName | Out-Null

 

At this point you are connected to your data collector and you can start pulling information or making changes.  The first thing I needed to do was pull all of the existing datastores on our old san so I could then create them on the new san.  Here is a one liner that will pull the datastore name and configured size.

Get-DellScVolume -ConnectionName $ConnName -StorageCenter (Get-DellStorageCenter -Name "<ENTER SC NAME>" -ConnectionName $ConnName) | where {$_.Name -like "<ENTER SEARCH STRING>"} | select name,configuredsize

Sample Output:

Name ConfiguredSize
—- ————–
datastore-replicated-001 1 TB

 

Now I piped mine out to export-csv and with the concatenate function I was able to create powershell one liners to create all of the new datastores on my new san with the proper sizes.  The connection variable is already created from the initial connection lines above.  You will need to set the $storagecenter variable as well as the $volumefolder variable.  These will be unique to your environment so me posting an example would be useless.

New-DellScVolume -ConnectionName $ConnName -StorageCenter $StorageCenter -Name <volume name> -Size <volume size> -VolumeFolder $VolumeFolder

 

Ok so now I have all of the volumes created.  The gui does allow you to “mass” map the volumes so I just used the gui to map the new volumes to the esxi clusters.  Now I can rescan my storage and viola the new luns appear in the storage devices pane.  However, they have all the same name.  Ok back to powershell so we can grab the device id.

Get-DellScVolume -ConnectionName $ConnName -StorageCenter (Get-DellStorageCenter -Name "<ENTER SC NAME>" -ConnectionName $ConnName) | where {$_.Name -like "<ENTER SEARCH STRING>"} | select name,deviceid

Sample output:

Name DeviceId
—- ——–
datastore-replicated-001 6000d310015368000000000000000091

 

This DeviceID is what vmware uses to produce the “canonical name”.  If you look in vmware you will see this datastore has a canonical name of naa.6000d310015368000000000000000091.  Now we can use this combined with vmware powercli to rename the storage devices appropriately.  I used excel again in conjunction with the concatenate function in order to create one liners.

First we have to setup a few variables..

$esxName = "<ENTER HOST NAME>"
$esx = Get-VMHost $esxName
$storSys = Get-View $esx.ExtensionData.ConfigManager.StorageSystem

Then we can start changing names.

Get-ScsiLun -VMHost $esxName -LUNType disk -CanonicalName "naa.6000d310015368000000000000000091" | %{ $storSys.UpdateScsiLunDisplayName($_.ExtensionData.Uuid, "datastore-replicated-001")}

Finally we can create the datastore.

New-Datastore -VMHost $esxName -Name datastore-replicated-001 -Path naa.6000d310015368000000000000000091 -Vmfs

 

Links:

(current as of todays date)
Dell Storage SDK 
Dell Storage SDK Cookbook
VMWare PowerCLI

Leave a Reply

Your email address will not be published. Required fields are marked *