I’ve had to do a few quick SAN migrations recently that involved setting up new SAN array’s and performing the necessary steps to evacuate data from one device to another. These migrations generally involve –
- Documentation of current LUN layout on legacy SAN
- Documentation of current datastore layout within vSphere
- Creating new LUN’s on the destination device
- Creating new Datastores within vSphere to for the existing VMDK’s
The following script will automate the above steps. This script assumes that you are using these specific vendors, as well as a functional vCenter environment
Find the script here on my github
#The EQL Powershell Extension is required - https://eqlsupport.dell.com/support/download_file.aspx?id=3336
#The Nimble Powershell Module is required - https://infosight.nimblestorage.com/InfoSight/media/software/active/15/49/Nimble_PowerShell_ToolKit_1.0.0.zip
#Nick Shores 8-1-17
#Change paramaters below to match your enviornment
$vcenter = 192.168.0.46
$vcenteruser = yourusername
$vcenterpass = your vcenter password
$EqlCred = Get-Credential
$NimbleCred = Get-Credential
$nimblemgmt = 192.168.0.66
$eqlmgmt = 192.168.0.81
#Import Modules
Import-Module -Name 'C:\Program Files\EqualLogic\bin\EqlPSTools.dll'
import-module -Name 'NimblePowerShellToolKit'
#Connect to dependencies
connect-viserver -server $vcenter -User $vcenteruser -Password $vcenterpass
Connect-Eqlgroup -GroupAddress $eqlmgmt -Credential $EqlCred
Connect-NSGroup -group $nimblemgmt -credential $NimbleCred
#Get list of EQL Volumes to create
write-host 'Getting EQL Volumes...'
$eqlvolume = Get-EqlVolume
$volumestats = $eqlvolume | select VolumeName,VolumeSize
write-host "$volumestats"
Write-Host "Creating $eqlvolume.count New Volumes - Continue? "
$x = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
#On nimble, create each volume
#TODO - Figure out how to set chap / initator access
foreach ($volume in $eqlvolume) {
new-nsvolume -name $volume.VolumeName -size $volume.VolumeSizeMB -multi_initiator $true
}
Get-NSVolume | select name-size
write-host "Creating Datastores"
#Find nimble LUN's / create new datastores
$id = Get-ScsiLun -vmhost * | Get-ScsiLunPath | ? {($_.Sanid -like '*nimble*') -and ($_.State -eq 'Active')}
foreach ($lun in $id){
$name = $lun.sanid -replace '.*?:(.+?)-.*','$1'
new-datastore -Name $name -path $lun.ScsiCanonicalName -vmhost *
}
#Rescan Hosts
Get-VMHostStorage -VMHost * -RescanAllHBA | Out-Null
write-host "Complete!"