This challenge was also thrown down by LucD, he asked for a list of mixed vols and any NFS exports/Cifs shares off the volume. Well this was a fairly straight forward process. First I would need every NFS export followed shortly by any Cifs shares. While I could have used my “cli-cheat” for the Cifs shares, I decided to write a function using the proper ZAPI calls. Finally the volumes… well maybe not, security style is assigned on a Qtree level, I called an audible… This script uses my Get-NaCifs , and Get-NaNFSExport scripts which can be found on poshcode.org.
Task: Get a list of all Cifs shares on a filer, and their permissions.
I’m going cheat a bit and just say that I spent two days searching through the API for this, before I realized that Filerview was echoing out the output from ‘cifs shares’… This changes the task slightly, the end goal is still the same, but the method will be via the cli. I used the same discovery functions as before. Good thing I wrote them because the API I needed is undocumented!
I’ve come to love PowerShells ability to perform reflection on any given object (I.e. Get-Member). The way the OnTap SDK was implemented does not support reflection… directly. The problem is the SDK consists of two classes that are able to interact with the ZAPI interfaces. Basically NaServer holds everything needed to connect->execute-> return results. Likewise the NaElement knows how to take input, and format that input into a valid XML request for ZAPI. NaElement also has all the logic needed to navigate, and use the information returned by a request. So what does that mean to us? Neither object has any knowledge of the actual API! This utterly kills the ability to “feel out” a given object. I can’t (new-object something|gm) till I find what I’m looking for, and I wanted that ability.
That small capability is almost a deal breaker for me. I’ve spent hours upon hours with the API on one monitor, and PowerShell on the other… it’s not fun! I sent out an open call during my last post, and was quickly taken up on it. As I sat down last night, and started digging through the API yet again. I decided enough was enough… I sat down and wrote a couple functions that more or less allow me to perform a primitive version of reflection. More accurately I can search the API reference right there from my console. I was so pleased with the outcome I decided to post a quick how to.
Late last night I stumbled upon this post in the NetApp Technology Network (NTN) announcing version 3.5 of the Manage OnTap SDK… My first reaction was that OnTap 7.3.1 might be getting closer to GA, seeing as they finalized the API. I downloaded the new bits, and was reading through the documentation when I noticed the following:
Supports multiple language interfaces – C/C++, C#, VB.NET, Java, and Perl
Well that pretty much made my whole PoshOnTap module irrelevant… but it’s still a great source for examples using the SDK. Speaking of, how about quick intro to the SDK…
Monday NetApp announced an automation contest here. As luck would have it. I’ve been writing some OnTap Powershell cmdlets for the past four months. The good is if i can get to a RC1 state by Jan 30th I like my chances. The bad I recently started going back through and adding inline help to all my cmdlets (long process). Oh yeah and I still have the FCP/NFS/CIFS apis left to port…. Long odds I’ll be done in time to enter, but if anyone else has built uppon Adam Weiger codeplex project here. Submit your stuff people, let’s flood Netapp with PowerShell entries. Send a message that Netapp needs to support PowerShell as a first class citizen in the automation universe.