VMware Cloud Community
realstuffag
Contributor
Contributor
Jump to solution

How to use "Set-ScsiLun -MultipathPolicy "Fixed""

Hi there

After a misstake by viewing the HCL i changed all Luns to Roundrobin with PowerCLI

Now I would like to take them back to Preferred Path but each time i type the command i got an error.

Maybe someone can help?

i tried it allready like this:

Get-ScsiLun -VMHost hostname -LunType disk | Set-ScsiLun -MultipathPolicy "Fixed" -PreferredPath "vmhba2:C0:T0:L9"

but each time I recieve this error:

Set-ScsiLun : 22.01.2014 21:03:18Set-ScsiLun    Could not find ScsiLunPath with name 'vmhba2:C0:T0:L9'.

At line:1 char:48

+ Get-ScsiLun -VMHost hostname* -LunType disk | Set-ScsiLun -MultipathPolicy "Fix ...

+                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo      : ObjectNotFound: (vmhba2:C0:T0:L9:String) [Set-ScsiLun], VimException
+ FullyQualifiedErrorId : Core_ObnSelector_SelectObjectByNameCore_ObjectNotFound,VMware.VimAutomation.ViCore.Cmdle

   ts.Commands.Host.SetScsiLun

Set-ScsiLun : 22.01.2014 21:03:18Set-ScsiLun    If the MultipathPolicy parameter is set to 'Fixed', you must

specify the PreferredPath parameter.

At line:1 char:48

+ Get-ScsiLun -VMHost hostname* -LunType disk | Set-ScsiLun -MultipathPolicy "Fix ...

+                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo      : InvalidArgument: (:) [Set-ScsiLun], InvalidArgument
+ FullyQualifiedErrorId : Core_SetScsiLun_TryValidateParameterList_PreferredPathNoSpecified,VMware.VimAutomation.V

   iCore.Cmdlets.Commands.Host.SetScsiLun

Has somebody any idea?

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

On the PreferredPath parameter, you should pass one of the objects that is returned by the Get-ScsiLunPath cmdlet for that specific LUN.

There are many scripts available that use algorithms to spread the load evenly over the paths.

You could also take a random path for each LUN.

For example:

Get-ScsiLun -VmHost $esx -LunType disk | %{
 
$path = Get-ScsiLunPath -ScsiLun $_ | Get-Random
 
Set-ScsiLun -ScsiLun $_ -MultipathPolicy "Fixed" -PreferredPath $path
}

Note that this is in fact a silly method of assigning preferred paths, but it should show what is required on the PreferredPath parameter


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

On the PreferredPath parameter, you should pass one of the objects that is returned by the Get-ScsiLunPath cmdlet for that specific LUN.

There are many scripts available that use algorithms to spread the load evenly over the paths.

You could also take a random path for each LUN.

For example:

Get-ScsiLun -VmHost $esx -LunType disk | %{
 
$path = Get-ScsiLunPath -ScsiLun $_ | Get-Random
 
Set-ScsiLun -ScsiLun $_ -MultipathPolicy "Fixed" -PreferredPath $path
}

Note that this is in fact a silly method of assigning preferred paths, but it should show what is required on the PreferredPath parameter


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
realstuffag
Contributor
Contributor
Jump to solution

@lucd thx for your help. this was the right answer.

so the PreferredPath variable is the output from gets-scsilun!

0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is correct, pick one of the objects returned by Get-ScsiLunPath.

Which one you pick, depends on the algorithm you want to use.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos