The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Microsoft Virtualization Discussions

Get-NaLunTargetDeviceId - trying to get LUN WWN

ALEXANDER_KRIVOSHEIN

Hello everybody, I'm trying to get LUN WWN with PowerShell and I faced with issue.

At PS side:

PS C:\> Get-NaLunSerialNumber /vol/AIX_TEST/AIX_TEST

D0zdE+CP/KHo

PS C:\> Get-NaLunTargetDeviceId -serialnumber "D0zdE+CP/KHo" -Protocol fcp

Get-NaLunTargetDeviceId : Extra input: protocol

At line:1 char:24

+ Get-NaLunTargetDeviceId <<<<  -serialnumber "D0zdE+CP/KHo" -Protocol fcp

    + CategoryInfo          : InvalidOperation: (xx.xx.xx.xx:NaController) [Get-NaLunTargetDeviceId], EINVALIDINPUTERROR

    + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Lun.GetNaLunTargetDeviceId

At controller side:

fas-bottom1> Wed AprWed Apr 10 16:34:37 VOLT 10 16: [fas-bottom1:api.input.invalidSchema:warning]: Error in API input schema validation. API name: lun-get-target-device-id. Detailed error: Extra input: protocol.

34:37 VOLT [fas-bottom1:api.input.invalidSchema:warning]: Error in API input schema validation. API name: lun-get-target-device-id. Detailed error: Extra input: protocol.

As you can see I did mark "Extra input: protocol", because if I try to use Get-NaLunTargetDeviceId without -Protocol I get this:

PS C:\Distr> Get-NaLunTargetDeviceId -serialnumber "D0zdE+CP/KHo"

cmdlet Get-NaLunTargetDeviceId at command pipeline position 1

Supply values for the following parameters:

(Type !? for Help.)

Protocol: fcp

Get-NaLunTargetDeviceId : Extra input: protocol

At line:1 char:24

+ Get-NaLunTargetDeviceId <<<<  -serialnumber "D0zdE+CP/KHo"

    + CategoryInfo          : InvalidOperation: (xx.xx.xx.xx:NaController) [Get-NaLunTargetDeviceId], EINVALIDINPUTERROR

    + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Lun.GetNaLunTargetDeviceId

Suggestions?

1 ACCEPTED SOLUTION

ALEXANDER_KRIVOSHEIN

I guess I solve the problem. (with information from this topic https://communities.netapp.com/thread/27473)

$a = Get-NaLunSerialNumber /vol/vol1/lun1;

$b = $a.ToCharArray();

Foreach ($element in $b) {$c = $c + [System.String]::Format("{0:X}", [System.Convert]::ToUInt32($element))}

"naa.60a98000" + $c

View solution in original post

5 REPLIES 5

ALEXANDER_KRIVOSHEIN

Ok, folks, same story, but for c-mode? Smiley Happy

There is no Get-NcLunSerialNumbercommand.

 

ALEXANDER_KRIVOSHEIN

I guess I solve the problem. (with information from this topic https://communities.netapp.com/thread/27473)

$a = Get-NaLunSerialNumber /vol/vol1/lun1;

$b = $a.ToCharArray();

Foreach ($element in $b) {$c = $c + [System.String]::Format("{0:X}", [System.Convert]::ToUInt32($element))}

"naa.60a98000" + $c

View solution in original post

###############################################################################################

## Get-NALunSerialNumberHex: Function that gathers the Hex Serial number of an NALun

###############################################################################################

Function Get-NALunSerialNumberHex {

    param (

        [parameter(Mandatory=$true)]

        $LunPath

    )

    Write-Host "[Gathering Lun Serial Number]" -ForegroundColor Cyan

    $LunSerial = ((Get-NaLunSerialNumber $LunPath).ToCharArray() | % {([byte][char]$_).ToString("X2")}) -join ""

    return $LunSerial

}

bsti

There's a definite mismatch between the Powershell cmdlet and the API. The API does not accept a protocol parameter.

Try this as a  workaround:

function GetWWN([string] $lunSerialNo)

{

  $req = New-Object "System.xml.XmlDocument"

  $req.LoadXml("<lun-get-target-device-id><lun-serial-id>$lunSerialNo</lun-serial-id></lun-get-target-device-id>")

  $response = Invoke-NaSystemApi $req

  $response.results."target-device-id"

}

Call it like this:

Connect-NAController "mycontroller" -RPC

$lun = get-nalun -terse -path "/vol/myvol/myvollun"

GetWWN $lun.SerialNumber

ALEXANDER_KRIVOSHEIN

Thanks for your advice!

It seems not working correctly... WWN's for two different LUN's are the same.

PS C:\Scripts> .\LunWWN.ps1

/vol/AIX_TEST/AIX_TEST

D0zdE+CP/KHo

naa.600A098200000675875

PS C:\Scripts> .\LunWWN.ps1

/vol/TClient_PROD_DataStore_02/TClient_PROD_DataStore_02

D0zdE+CP/KHs

naa.600A098200000675875

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public