Category Archives: Equallogic

Rescan VMware cluster HBA’s via Powershell

Ever wanted to trigger a recsan of storage for all hosts in a given cluster? There may be a reason why you would want to do this via a script rather than a gui and if so, this is it.

I have written it as a function.

The code will connect to a VC, identify the cluster (you give it the cluster name as a parameter), get a list of hosts, and then for each host, trigger a rescan.

Unfortunately, it runs serially, rather than triggering a parallel run. At this stage it doesn’t really matter to me, but at some point, I will write a version that does the rescan’s in parallel.

Function Rescan-ClusterHBA
{
param ([string]$vmClustername, $viserver)
Connect-VIServer $viserver

$vmClusterPointer = get-cluster $vmClusterName
$vmcluster = $vmClusterPointer | Get-View

$vmhosts = $vmcluster | select -Expand host


foreach ($vmhost in $vmhosts)
	{
	Get-VMHost -Id $vmhost
	Get-VMHostStorage -vmhost (Get-VMHost -Id $vmhost) -RescanAllHba
	}
}

Leave a comment

Filed under Equallogic, Powershell, VMware

Adding and removing Equallogic ACL’s

Sometimes you may want to add or remove ESX/ESXi hosts (or HyperV of anything really) where you need to add or remove entries from the Equallogic SAN ACL.

For examples, we have about 25 volumes connected to our ESX cluster and when we replace a new host, we need to add a new entry, on all 25, and remove an entry on all 25.

So I wrote a powershell script to do the hard work. THe following code can be saved as set-eqlinitiator.ps1.

To use it, you would execute it like this:

Set-eqlInitator.ps1 "iqn.1998-01.com.vmware:myserver-2cfdfaef" remove

That would remove the supplied initiator from all the the volumes that meet the criteria. What criteria? This one:
{$_.VolumeName -like "VMFS*"}

If you want to add (rather than remove) run the same command without specifying “remove”.

All of our ESX volume start with VMFS which makes it fairly easy. You may need to change the filter depending on how you name them in your environment.

So here is the code:


param ([string]$initiator,[string]$remove)

#Check if the EQL add-in's are loaded
if (-not(get-module -name "EqlPSTools"))
	{
	Write-Host "EqlPSTools not loaded, attempting to load."
	import-module -name "C:\Program Files\EqualLogic\bin\EqlPSTools.dll"
	if (-not(get-module -name "EqlPSTools"))
		{
		Write-Host "Loading of EqlPSTools failed, script ending."
		exit
		}
	}



If ($initiator -eq "")
	{
	$initiator = Read-Host "Please enter the iSCSI initiator name:"
	}

Connect-EqlGroup 	-GroupAddress 172.16.250.20 `
					-UserName grpadmin `
					-Password PASSWORD


If ($initiator -ne "")
	{
	If ($remove -ne "remove")
		{
		get-eqlvolume | `
		where {$_.VolumeName -like "VMFS*"} | `
		New-EqlVolumeACL -UseIndex -InitiatorName $initiator -AclTargetType volume_and_snapshot
		Write-Host "added initiator $initiator"
		}
	Else
		{
		get-eqlvolume | `
		where {$_.VolumeName -like "VMFS*"} | `
		Get-EqlVolumeACL | Where {$_.InitiatorName -match $initiator} | `
		Remove-EqlVolumeACL -AclIndex {$_.index}
		Write-Host "removed initiator $initiator"
		}
	}	

Or you can grab a copy from here:
http://tinyurl.com/7t5t6ca

Leave a comment

Filed under Equallogic, Microsoft, Powershell, VMware

Adding a new volume to an ESX host using Powershell

As I have a script already to create a new volume via Powershell, I wanted to extend it to add a new volume (datastore). The following function will do that:

Function vmAddStorage
{
    param ([string]$server, [string]$volname)
    #Example usage - vmAddStorage esxhost myNewVolume
    $myhost = get-vmhost $server
    $myhost | get-vmhoststorage -RescanAllHba
	
	$lunpath = Get-VMHost | Get-ScsiLun | Where { $_.Vendor -match "EQLOGIC"}
	new-datastore -vmfs -vmhost $myhost -path $lunpath.CanonicalName -Name $volname
	
    $myhost | get-vmhoststorage -RescanAllHba
}

This is for Equallogic storage, but you could adapt it for use with other storage vendors. to know what to use in the $lunpath line, you could run

Get-VMHost | Get-ScsiLun | format-list

Then look for the Vendor property. I ran this against ESXi 4.1 so far using version 1.0 of the pssnapin (vmware.viautomation.core).

Leave a comment

Filed under Equallogic, Powershell, VMware

Create a new Equallogic volume via PowerShell

I have been playing around with Powershell, and thought I would write a basic little function to create a new volume.

Function eqlNewVol
{
param ([string]$grpName,[string]$volname, [decimal]$gb, [string]$strPool, [string]$VolumeDesc, [bool]$tp) 
write-debug "Beginning Script, calling new-eqlvolume"
write-debug "$grpname, $volname, $gb, $strpool, $VolumeDesc, $tp"

new-eqlvolume -groupname $grpname -volumeName $volname `
-volumesizeMB ($gb * 1048576) `
-storagepoolname $strPool `
-AllowMultipleInitiators $True `
-Volumedescription $VolumeDesc `
-thinprovision $tp 
write-debug "new-eqlvolume called"

#Add permissions from a file called c:\initiators.csv
write-debug "Setting permissions"
(get-content c:\initiators.csv) `
| foreach-object {new-eqlvolumeACL -volumeName $volname –InitiatorName $_ -AclTargetType volume_and_snapshot}
}

Basically, it will take command line arguments to create a new volume, and then add initiators based on name, taken from a file called c:\initiators.csv.

You would probably want to connect first, when you can do with the “connect-eqlgroup” command, you can then call the function using something like this:

eqlNewVol MySANGroup, NewVol1, 1.95, myPool, 0

First though, you need to load the function to make it accessible. If the function is stored in (say) myfunctions.ps1, you will need to load this (. ./myfunctions.ps1) before you can call it. Not that dot space dot forwardslash file syntax.

Oh, and you will of course need the the Equallogic powershell plugin’s.

1 Comment

Filed under Equallogic, Powershell

Moving an Equallogic SAN to a different storage pool via CLI

Sometimes it is nice not to use the the GUI, to use command line instead.

If you need to move a unit from one storage pool to another, you can establish a telnet or putty session, login, and run the following:

GH-SAN-Prod> member select 3700-3

GH-SAN-Prod(member_3700-3)> pool STD-50

The first command will select the unit you wish to move, and the second command will send it to the pool that you want it to go to.
There is a really good CLI document on the Equallogic website.

Leave a comment

Filed under Equallogic, SRM, VMware

Dropped MPIO connections on VMWare vSphere and iSCSI

If you are getting dropped connections, and running ESX 4.0 U1,  it is probably worth checking out a patch released by VMware.

See here for more information:

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1019492

Leave a comment

Filed under Equallogic, VMware

Installation of Dell Equallogic SRA for VMware SRM

I had this problem a little while ago.

When I clicked on “configure” next to “Array Managers”, and then press “add”, I got the box to enter the details of the local SAN.

I then entered the details in the VC window but got an error saying “Error occurred: XML document is empty.”

The solution is to install Java. It doesn’t come with either SRM or the SRA, so you need to go to Oracles website and download and install it separately. All should then work!

1 Comment

Filed under Equallogic, SRM, VMware