Hello. I'm testing a personal balancing path script for MRU LUNs. I developed the following pseudo-algorithm and I would turn/convert it into PowerCLI. I would like to do exactly this:
HostName = "Server1"
Cont_Fix = 1
Cont_MRU = 1
For each LUN of HostName
# Get the number of paths for the LUN:
NumPaths=LeerNumPaths(Lun)
# Balancing paths for a Fixed LUN:
If (Lun = Fixed) Then
# The technique is configure a preferred path for the Fixed LUNs and playing
# with a module to determining which path can be preferred in each case.
Configure_Path -Lun=lun -PreferredPath=(Cont_Fix Mod NumPaths)+1
Cont_Fix = Cont_Fix + 1
End If
# Balancing paths for a MRU LUN:
If (LUN = MRU) Then
Path_To_Set_Enabled=(Cont_Mru Mod NumPaths)+1
# The technique is: 1) Disabling all paths except one, which will have taken the active role:
For Path_Count=1 To NumPaths Do
If Path_Count <> Path_To_Set_Enabled Then
Disable_Path -Lun=lun -Path=Path_Count
End If
End For
# 2) We again turn on the paths to normalize the status of the LUN:
For Path_Count=1 To NumPaths Do
If Path_Count <> Path_To_Set_Enabled Then
Enable_Path -Lun=lun -Path=Path_Count
End If
End For
Cont_Mru = Cont_Mru + 1
End If
End For
If Get_Paths_Disabled Then
Say "Oups. You need to review disabled paths"
Else
Say "Yeah."
End If
It's possible to convert this pseudo-script to Power-CLI?
Thank you in advance!
Regards.