Microsoft Virtualization Discussions

Getting API errors with a couple of cmdlets

lallin
5,374 Views

I'm having trouble mapping and unmapping luns with PowerShell. When I try I get an API error. Is there a minimum version of DataONTAP that is required for these cmdlets to work with? Right now I'm on 7.3.1.1 with plans to go to 7.3.3.

6 REPLIES 6

cknight
5,374 Views

Hello, lallin.  The lun-map and lun-unmap APIs have been around a long time, so that shouldn't be a problem.  FWIW, I have done most of my Toolkit development / testing on 7.3.3.

If you'll send along the cmdlet invocation snippet and error details, we can look more closely.

Clinton

lallin
5,374 Views

Just for kicks, I upgraded my mirror target filer to 7.3.3 and tried this again and it didn't work. Below is the command and the error that I'm getting. I'm connected to the filer using RPC, and can execute other commands against the filer except the add and remove nalunmap commands. I can run a get-nalunmap command just fine, just can't manipulate the mapping.

PS C:\Windows\system32> Add-naLunMap -Path /vol/Chatesthv/Chatesthv.lun -InitiatorGroup viaRPC.iqn.1991-05.com.microsoft
:mmatlhyperv2.law.millermartin.com -Controller Filer6
Add-NaLunMap : API invoke failed.
At line:1 char:13
+ Add-naLunMap <<<<  -Path /vol/Chatesthv/Chatesthv.lun -InitiatorGroup viaRPC.iqn.1991-05.com.microsoft:mmatlhyperv2.l
aw.millermartin.com -Controller Filer6
    + CategoryInfo          : InvalidOperation: (NetApp.Ontapi.Filer.NaController:NaController) [Add-NaLunMap], NaExce
   ption
    + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Lun.AddNaLunMap

Add-NaLunMap : API invoke failed.
At line:1 char:13
+ Add-naLunMap <<<<  -Path /vol/Chatesthv/Chatesthv.lun -InitiatorGroup viaRPC.iqn.1991-05.com.microsoft:mmatlhyperv2.l
aw.millermartin.com -Controller Filer6
    + CategoryInfo          : InvalidOperation: (NetApp.Ontapi.Filer.NaController:NaController) [Add-NaLunMap], NaExce
   ption
    + FullyQualifiedErrorId : LunListInfoFailed,DataONTAP.PowerShell.SDK.Cmdlets.Lun.AddNaLunMap

-Luther

cknight
5,374 Views

Hi, Luther.

Add-naLunMap -Path /vol/Chatesthv/Chatesthv.lun -InitiatorGroup  viaRPC.iqn.1991-05.com.microsoft:mmatlhyperv2.law.millermartin.com -Controller Filer6

If you're using RPC, then you shouldn't need to use the -Controller switch when connected to a single controller.  If, however, you are connected to multiple controllers and wish to direct commands to different ones, try something like this:

$Filer6 = Connect-NaController Filer6

Add-NaLunMap ... -Controller $Filer6

(Don't forget the $ sign on the controller variable).

Clinton

lallin
5,374 Views

Well, what do you know? It worked.

Question though: What if I need to address multiple filers in the same script? Can I use RPC and then call out the filer name? Or, do I need to not use RPC if I'm going to do this?

cknight
5,374 Views

Yes, you may connect (via RPC or HTTP) to any number of controllers in a script, saving the result of each connection in a variable.  Then just pass the variable as the argument of -Controller in any of the Toolkit's cmdlets.  It's common to operate with multiple systems when dealing with clusters, SnapMirror, SnapVault, etc.  Some of the example scripts posted here by others show this.

Clinton

lallin
5,374 Views

Thanks Clinton. This has been very helpful. I'm sure I'll be back.

Public