Active IQ Unified Manager Discussions
Active IQ Unified Manager Discussions
Hello everybody,
We do have a WFA workflow that create mutliple LUNs based on a Table (user inputs). This is using the repeat row feature. Workflow is working great. My question now is how can I get back, in the return parameters, the serial of every LUN created on this repeated row?
On the repeated row "Number of times" is based on the getSize() of my table and I'm using the Index Variable to access the line on the table. But I don't know what to put on "parameter value" in the "Return Parameters" tab to have the wished info for every lun created.
Any advise?
Many thanks.
Renaud
Solved! See The Solution
Hi Renaud,
I've encountered this scenario in WFA and am sharing the solution i developed for adding return paramaters for mulitple LUNs in a repeat row. The trick is to "variablize" the return parameter names into a custom command (this way you can increment the return paramater name. EG "lun_path_01", "lun_path_02" etc). I named the command "get_lun_return_parameters", if you don't set the return parameter names it will assign defaults (EG "lun_id", "lun_path", "lun_serial_number", "lun_naa_number") however by enabling you set the return paramater name as a variable you can use it to return paramaters for multiple LUNs in a repeat row.
Hope this is useful.
Param( [Parameter(Mandatory=$True, HelpMessage="The cluster name or IP Address")] [String]$Cluster, [Parameter(Mandatory=$True, HelpMessage="The vserver name")] [String]$VserverName, [Parameter(Mandatory=$True, HelpMessage="The LUN path")] [String]$LunPath, [Parameter(Mandatory=$False, HelpMessage="The LUN name return parameter name")] [String]$LunPathReturnParameterName, [Parameter(Mandatory=$False, HelpMessage="The LUN serial return parameter name")] [String]$LunSerialReturnParameterName, [Parameter(Mandatory=$False, HelpMessage="The LUN NAA return parameter name")] [String]$LunNaaReturnParameterName, [Parameter(Mandatory=$False, HelpMessage="The LUN ID return parameter name")] [String]$LunIdReturnParameterName, [Parameter(Mandatory=$False, HelpMessage="The number of times to retry commands that return with errors that may succeed after a retry")] [Int]$ZapiRetryCount ) #'------------------------------------------------------------------------------ Function ConvertFrom-AsciiToHex{ Param( [Parameter(Mandatory=$False, HelpMessage="The ASCII value to convert to Hexidecimal")] [String]$Ascii ) [Array]$result = @() For($i = 1; $i -le $Ascii.Length; $i++){ [String]$character = $Ascii.SubString(($i -1), 1) [Array]$result += "{0:X}" -f [Byte][Char]$character } Return [String]::join("", $result).ToLower(); }#End Function #'------------------------------------------------------------------------------ #'Connect to the cluster. #'------------------------------------------------------------------------------ Connect-WfaCluster $Cluster #'------------------------------------------------------------------------------ #'Enumerate the LUN. #'------------------------------------------------------------------------------ Get-WFALogger -Info -Message "Enumerating Return Parameters for LUN ""$LunPath"" on vserver ""$VserverName""" [String]$command = "Get-NcLun -Path $LunPath -VserverContext $VserverName " If($ZapiRetryCount){ [String]$command += "-ZapiRetryCount $ZapiRetryCount " } [String]$command += "-ErrorAction Stop" Try{ $lun = Invoke-Expression -Command $command -ErrorAction Stop Get-WFALogger -Info -Message "Executed Command`: $command" Get-WFALogger -Info -Message "Enumerated LUN ""$LunPath"" on vserver ""$VserverName""" }Catch{ Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message) Throw "Failed enumerating LUN ""$lunPath"" on vserver ""$VserverName""" } [String]$lunSerial = $lun.SerialNumber [Bool]$lunMapped = $lun.Mapped If($lunMapped){ [String]$command = "Get-NcLunMap -Path $LunPath -VserverContext $VserverName " If($ZapiRetryCount){ [String]$command += "-ZapiRetryCount $ZapiRetryCount " } [String]$command += "-ErrorAction Stop" Try{ $lunMapping = Invoke-Expression -Command $command -ErrorAction Stop $lunId = $lunMapping.LunId Get-WFALogger -Info -Message "Executed Command`: $command" Get-WFALogger -Info -Message "Enumerated mapping for LUN ""$LunPath"" as LUN ID ""$lunID"" on vserver ""$VserverName""" }Catch{ Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message) Throw "Failed enumerating mapping for LUN ""$lunPath"" on vserver ""$VserverName""" } } Get-WFALogger -Info -Message "The Serial Number for LUN ""$lunPath"" is ""$lunSerial""" #'------------------------------------------------------------------------------ #'Enumerate the LUN Serial number. #'------------------------------------------------------------------------------ If($lunSerial -eq ""){ Throw "Failed enumerating Serial Number for LUN ""$LunPath"" on vserver ""$VserverName""" } #'------------------------------------------------------------------------------ #'Enumerate the LUN NAA number. #'------------------------------------------------------------------------------ [String]$identifier = "naa.600a0980" [String]$lunNaaNumber = $identifier + (ConvertFrom-AsciiToHex -Ascii $lunSerial) #'------------------------------------------------------------------------------ #'Set the LUN Path return parameter. #'------------------------------------------------------------------------------ If(-Not($LUNPathReturnParameterName)){ Add-WfaWorkflowParameter -Name "lun_path" -Value $LunPath -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""lun_path"" as ""$LunPath""" }Else{ Add-WfaWorkflowParameter -Name "$LunPathReturnParameterName" -Value $LunPath -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""$LunPathReturnParameterName"" as ""$LunPath""" } #'------------------------------------------------------------------------------ #'Set the LUN Serial Number return parameter. #'------------------------------------------------------------------------------ If(-Not($LUNSerialReturnParameterName)){ Add-WfaWorkflowParameter -Name "lun_serial_number" -Value $lunSerial -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""lun_serial_number"" as ""$lunSerial""" }Else{ Add-WfaWorkflowParameter -Name "$LunSerialReturnParameterName" -Value $lunSerial -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""$LunSerialReturnParameterName"" as ""$lunSerial""" } #'------------------------------------------------------------------------------ #'Set the LUN NAA Number return parameter. #'------------------------------------------------------------------------------ If(-Not($LUNNaaReturnParameterName)){ Add-WfaWorkflowParameter -Name "lun_naa_number" -Value $lunNaaNumber -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""lun_naa_number"" as ""$lunNaaNumber""" }Else{ Add-WfaWorkflowParameter -Name "$LunNaaReturnParameterName" -Value $lunNaaNumber -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""$LunNaaReturnParameterName"" as ""$lunNaaNumber""" } #'------------------------------------------------------------------------------ #'Set the LUN ID Number return parameter. #'------------------------------------------------------------------------------ If($LunMapped){ If(-Not($LunIdReturnParameterName)){ Add-WfaWorkflowParameter -Name "lun_id" -Value $lunId -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""lun_id"" as ""$lunId""" }Else{ Add-WfaWorkflowParameter -Name "$LunIdReturnParameterName" -Value $lunId -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""$LunIdReturnParameterName"" as ""$lunId""" } } #'------------------------------------------------------------------------------
Please let me know if you have any questions.
/Matt
Hi Renaud,
I've encountered this scenario in WFA and am sharing the solution i developed for adding return paramaters for mulitple LUNs in a repeat row. The trick is to "variablize" the return parameter names into a custom command (this way you can increment the return paramater name. EG "lun_path_01", "lun_path_02" etc). I named the command "get_lun_return_parameters", if you don't set the return parameter names it will assign defaults (EG "lun_id", "lun_path", "lun_serial_number", "lun_naa_number") however by enabling you set the return paramater name as a variable you can use it to return paramaters for multiple LUNs in a repeat row.
Hope this is useful.
Param( [Parameter(Mandatory=$True, HelpMessage="The cluster name or IP Address")] [String]$Cluster, [Parameter(Mandatory=$True, HelpMessage="The vserver name")] [String]$VserverName, [Parameter(Mandatory=$True, HelpMessage="The LUN path")] [String]$LunPath, [Parameter(Mandatory=$False, HelpMessage="The LUN name return parameter name")] [String]$LunPathReturnParameterName, [Parameter(Mandatory=$False, HelpMessage="The LUN serial return parameter name")] [String]$LunSerialReturnParameterName, [Parameter(Mandatory=$False, HelpMessage="The LUN NAA return parameter name")] [String]$LunNaaReturnParameterName, [Parameter(Mandatory=$False, HelpMessage="The LUN ID return parameter name")] [String]$LunIdReturnParameterName, [Parameter(Mandatory=$False, HelpMessage="The number of times to retry commands that return with errors that may succeed after a retry")] [Int]$ZapiRetryCount ) #'------------------------------------------------------------------------------ Function ConvertFrom-AsciiToHex{ Param( [Parameter(Mandatory=$False, HelpMessage="The ASCII value to convert to Hexidecimal")] [String]$Ascii ) [Array]$result = @() For($i = 1; $i -le $Ascii.Length; $i++){ [String]$character = $Ascii.SubString(($i -1), 1) [Array]$result += "{0:X}" -f [Byte][Char]$character } Return [String]::join("", $result).ToLower(); }#End Function #'------------------------------------------------------------------------------ #'Connect to the cluster. #'------------------------------------------------------------------------------ Connect-WfaCluster $Cluster #'------------------------------------------------------------------------------ #'Enumerate the LUN. #'------------------------------------------------------------------------------ Get-WFALogger -Info -Message "Enumerating Return Parameters for LUN ""$LunPath"" on vserver ""$VserverName""" [String]$command = "Get-NcLun -Path $LunPath -VserverContext $VserverName " If($ZapiRetryCount){ [String]$command += "-ZapiRetryCount $ZapiRetryCount " } [String]$command += "-ErrorAction Stop" Try{ $lun = Invoke-Expression -Command $command -ErrorAction Stop Get-WFALogger -Info -Message "Executed Command`: $command" Get-WFALogger -Info -Message "Enumerated LUN ""$LunPath"" on vserver ""$VserverName""" }Catch{ Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message) Throw "Failed enumerating LUN ""$lunPath"" on vserver ""$VserverName""" } [String]$lunSerial = $lun.SerialNumber [Bool]$lunMapped = $lun.Mapped If($lunMapped){ [String]$command = "Get-NcLunMap -Path $LunPath -VserverContext $VserverName " If($ZapiRetryCount){ [String]$command += "-ZapiRetryCount $ZapiRetryCount " } [String]$command += "-ErrorAction Stop" Try{ $lunMapping = Invoke-Expression -Command $command -ErrorAction Stop $lunId = $lunMapping.LunId Get-WFALogger -Info -Message "Executed Command`: $command" Get-WFALogger -Info -Message "Enumerated mapping for LUN ""$LunPath"" as LUN ID ""$lunID"" on vserver ""$VserverName""" }Catch{ Get-WFALogger -Error -Message $("Failed Executing Command`: $command. Error " + $_.Exception.Message) Throw "Failed enumerating mapping for LUN ""$lunPath"" on vserver ""$VserverName""" } } Get-WFALogger -Info -Message "The Serial Number for LUN ""$lunPath"" is ""$lunSerial""" #'------------------------------------------------------------------------------ #'Enumerate the LUN Serial number. #'------------------------------------------------------------------------------ If($lunSerial -eq ""){ Throw "Failed enumerating Serial Number for LUN ""$LunPath"" on vserver ""$VserverName""" } #'------------------------------------------------------------------------------ #'Enumerate the LUN NAA number. #'------------------------------------------------------------------------------ [String]$identifier = "naa.600a0980" [String]$lunNaaNumber = $identifier + (ConvertFrom-AsciiToHex -Ascii $lunSerial) #'------------------------------------------------------------------------------ #'Set the LUN Path return parameter. #'------------------------------------------------------------------------------ If(-Not($LUNPathReturnParameterName)){ Add-WfaWorkflowParameter -Name "lun_path" -Value $LunPath -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""lun_path"" as ""$LunPath""" }Else{ Add-WfaWorkflowParameter -Name "$LunPathReturnParameterName" -Value $LunPath -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""$LunPathReturnParameterName"" as ""$LunPath""" } #'------------------------------------------------------------------------------ #'Set the LUN Serial Number return parameter. #'------------------------------------------------------------------------------ If(-Not($LUNSerialReturnParameterName)){ Add-WfaWorkflowParameter -Name "lun_serial_number" -Value $lunSerial -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""lun_serial_number"" as ""$lunSerial""" }Else{ Add-WfaWorkflowParameter -Name "$LunSerialReturnParameterName" -Value $lunSerial -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""$LunSerialReturnParameterName"" as ""$lunSerial""" } #'------------------------------------------------------------------------------ #'Set the LUN NAA Number return parameter. #'------------------------------------------------------------------------------ If(-Not($LUNNaaReturnParameterName)){ Add-WfaWorkflowParameter -Name "lun_naa_number" -Value $lunNaaNumber -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""lun_naa_number"" as ""$lunNaaNumber""" }Else{ Add-WfaWorkflowParameter -Name "$LunNaaReturnParameterName" -Value $lunNaaNumber -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""$LunNaaReturnParameterName"" as ""$lunNaaNumber""" } #'------------------------------------------------------------------------------ #'Set the LUN ID Number return parameter. #'------------------------------------------------------------------------------ If($LunMapped){ If(-Not($LunIdReturnParameterName)){ Add-WfaWorkflowParameter -Name "lun_id" -Value $lunId -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""lun_id"" as ""$lunId""" }Else{ Add-WfaWorkflowParameter -Name "$LunIdReturnParameterName" -Value $lunId -AddAsReturnParameter $True Get-WFALogger -Info -Message "Added value for WFA return parameter name ""$LunIdReturnParameterName"" as ""$lunId""" } } #'------------------------------------------------------------------------------
Please let me know if you have any questions.
/Matt
Hello Matt,
THANK YOU, this is great! And working perfectly!
Have a great week-end
Renaud