Subscribe

Connect-NaController odd bug

Hello all, I believe I've stumbled upon a bug in the Connect-NaController cmdlet in the toolkit.  To reproduce the issue, run the following code chunk:

Import-Module DataONTAP -Verbose

Connect-NaController "toaster"

You should get the following error:

Connect-NaController : Could not find file 'C:\Users\username\AppData\Local\Temp\m2tkuh8b.dll'.

At line:1 char:21

+ Connect-NaController <<<<  ah-3040-1

    + CategoryInfo          : NotSpecified: (Smiley Happy [Connect-NaController], FileNotFoundException

    + FullyQualifiedErrorId : System.IO.FileNotFoundException,DataONTAP.PowerShell.SDK.ConnectNaController

Unfortunately, my script was several hundred lines of code, in which I was setting the $VerbosePreference variable to "Continue" (effectively the same as calling -Verbose on all cmdlets) and also had issues making the connection between the vague error message above and its cause so it took quite a bit of effort to find the root cause.

Hopefully, this can be addressed in an update.  Thanks!

Re: Connect-NaController odd bug

I cannot reproduce this.  Using your example, if "toaster" doesn't exist, here is the expected result:


PS C:\Software\Toolkit\1.2.0> Connect-NaController "toaster"


Connect-NaController : No such host is known
At line:1 char:21
+ Connect-NaController <<<<  "toaster"
    + CategoryInfo          : NotSpecified: (Smiley Happy [Connect-NaController], SocketException
    + FullyQualifiedErrorId : System.Net.Sockets.SocketException,DataONTAP.PowerShell.SDK.ConnectNaController

-- or possibly --

PS C:\Software\Toolkit\1.2.0> Connect-NaController "toaster"

Connect-NaController : The requested name is valid, but no data of the requested type was found
At line:1 char:21
+ Connect-NaController <<<<  "toaster2"
    + CategoryInfo          : NotSpecified: (Smiley Happy [Connect-NaController], SocketException
    + FullyQualifiedErrorId : System.Net.Sockets.SocketException,DataONTAP.PowerShell.SDK.ConnectNaController

If "toaster" isn't a Data ONTAP controller, you might see:

PS C:\Software\Toolkit\1.2.0> Connect-NaController "toaster"


Connect-NaController : RPC Error - The RPC server is unavailable.
At line:1 char:21
+ Connect-NaController <<<<  "toaster"
    + CategoryInfo          : InvalidResult: (NetApp.Ontapi.Filer.NaController:NaController) [Connect-NaController], EAPITRANSMISSION
    + FullyQualifiedErrorId : RpcConnectionFailed,DataONTAP.PowerShell.SDK.ConnectNaController

The DLL in your error message is unrelated to the Toolkit, so I suspect an issue with your local environment.  There was a similar report recently that turned out to be something other than a Toolkit issue.  A failure in Connect-NaController doesn't always throw a terminating error, so it's a good idea to either check for a null result or specify "-ErrorAction Stop" if that's what you want.

Re: Connect-NaController odd bug

Thanks for the reply.

I used "toaster" as an example in the code chunk I posted.  The name I used was the correct name for a filer in my environment, so that's not the nature of my issue.  Did you try to reproduce this with a valid filer name?

I was able to reproduce this on my development machine, and a foreign machine with a fresh install of the ONTAP toolkit (to be sure).  The .dll referenced in the error is interesting.  The name is completely random, and is different every time the error is thrown.  It's evidently some sort of dynamically-generated name, but for what purpose I've no idea.

This throws the error:

Import-Module DataONTAP -Verbose

Connect-NaController "your filer name here"

This does not:

Import-Module DataONTAP

Connect-NaController "your filer name here"

It's really strange.

I have the DataONTAP toolkit copied to C:\Windows\System32\WindowsPowershell\v1.0\Modules\DataONTAP folder.

I'm running 1.2 version of the toolkit.

Re: Connect-NaController odd bug

OK, thanks for that clarification.  With that, I can reproduce the issue.  It seems to be a strange interaction between PowerShell and the .NET XmlSerializer class.  The latter is what generates the randomly-named DLL files at runtime in the temp directory.  The workaround for the time being is to not load the module using -Verbose.

Re: Connect-NaController odd bug

Good.  I'm glad you were able to find it.

Thanks!

Re: Connect-NaController odd bug

I'm glad you were able to find it.

To clarify, I can reproduce the issue, but I don't understand the root cause of the issue or have a fix.  This is the failing line:

XmlSerializer serializer = new XmlSerializer(req.GetType());

But there is no good reason this .NET class should throw an exception in its constructor just because a PowerShell module was loaded with a -Verbose switch!

Connect-NaController odd bug

Any resolution for this issue? Am also facing the same error. However everytime the .dll file name is diferent in the error message. Also am using ONATP Simulator.

Thanks,

-Amir

Connect-NaController odd bug

Also without "-verbose" option am getting following error:

PS C:\Windows\system32> Import-Module DataONTAP

PS C:\Windows\system32> Connect-NaController ntap1

Connect-NaController : RPC Error - The RPC server is unavailable.

At line:1 char:21

+ Connect-NaController <<<<  ntap1

    + CategoryInfo          : InvalidResult: (ntap1:NaController) [Connect-NaController], EAPITRANSMISSION

    + FullyQualifiedErrorId : RpcConnectionFailed,DataONTAP.PowerShell.SDK.ConnectNaController

Am runing PS on Win7E

Thanks,

-Amir

Connect-NaController odd bug

Finally resolved th issue using your post on other thread(cifs setup):

http://communities.netapp.com/thread/11573

Also some httpd options were needed to be turned on: httpd.admin.*

BTW is this issue been root caused/resolved?

Thanks,

-Amir

Re: Connect-NaController odd bug

The subsequent errors seen after loading the DataONTAP module with the -Verbose switch are a known issue in PowerShell; it is reportedly fixed in PowerShell 3.0 CTP1.