Microsoft Virtualization Discussions

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

I am starting to do a lot of NetApp and VMWare scripting. Currently I am finding it difficult to pull the iSCSI node name from the vmware side and nocticed a nice command-let here "Get-NAIscsiSession" that shows all iscsi information. It would be nice if I could pull the InitiatorNodename section out into a variable to make it easy to create igroups. Something like:

$iscsiname = Get-NaIscsiSession.InitiatorNodename or something along those lines. Not sure how to do it if multiple sessions are there though. Just thinking outloud, but I love this toolkit.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

Hi Clinton -

Once again, great work.

The auto-discovery is actually less important to my customer.

More important is being able to do the entire Filer setup, from "out of the cardboard box" to "ready to deploy". Someone said there isn't the ability to set up vifs or network configuration? That seems like a show-stopper. Are there any workarounds?

Jeff Baxter

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

For the NetApp Controller, you'd use get-nsiscsinodename.  For the host?

PS C:\> $HostInitiator=get-naiscsisession;$HostInitiator.InitiatorNodeName
iqn.1991-05.com.microsoft:win-cjrn2t2kse0
PS C:\>


I just put the object returned by get-naiscsisession in a variable then output the InitiatiorNodeName of that variable.  Does that work for you?

J

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

Hi, Jeff, thanks.  The APIs for getting / setting the persistent network configuration appear to be new in Data ONTAP 7.3.3.  I've only just begun using them, but I consider that a fairly high priority for the Toolkit.  Possible workarounds might include modifying /etc/rc via the Write-NaFile cmdlet or using ssh to get to the ONTAP CLI.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

How about allowing the controller parameter to accept pipelined collections of NaController objects?

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

Hi Ben,

If you're working with a single connection, connections are transitive:

connect-nacontroller SIM1; get-navol

will list on the volumes on controller SIM1.  I can keep using other cmdlets without specifying the -Controller, and SIM1 will be used; until I connect to another controller that is.  Now if you're working with more than one controller, I suspect you'd like to put the connection objects in a collection.  Something like this simplistic example:

[object[]]$Simulators=$null;foreach ($SIM in @("SIM1", "SIM2", "SIM3")) {$NewSIM=Connect-nacontroller $SIM;$Simulators=$Simulators+$NewSIM}

Now that you've created a "connection collection", I also suspect you'd like to do something creative with it.  Perhaps you'd like to set some option on a group of controllers or list all the snapshots or volumes on a the controllers in your connection.  Sadly we don't accept pipeline for -Controller today, but perhaps you could use the foreach-object which does, something like:

$Simulators | foreach-object -Process {get-navol -Controller $_}

Which returns all the volumes on all three members of my "connection collection".

Happy Scripting

J

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

OK, Matthew, got it.  The system-cli ZAPI isn't supported, but sending commands via SSH is.  SSH support isn't built-in to .NET, but it can be done, so we'll definitely consider such a cmdlet.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

I could have missed this in the Initialize-NaController cmdlet documentation, but incase I did not over look it, it would be nice to intialize the controller and be able to configure a vif. Also, it would be nice if there was a built in dicsovery for the initialize cmdlet. This way someone would just need to know the network the device is on and not the IP address.  I am responsiable for providing either documentaion or a script to standup a filer to a group of people that have never seen or touched a netapp. If I could get away with just asking them what address they want on the filer, as well as the password and one or two other options and I could then create a vif and configure those options that would be great.

Lastly,

I know I sound like a pain, but getting back to my unique situtation, I deploy these filers for the Marine Corps, they have a list of the options that need to be set and configured a certain way. Is there a way I can import these options so I do not need to manually hand jam them?

Thanks again, and I love the tool. This has made automating the configuration of a  VM infrastructure as simple as 140 lines of code.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

With initialize-nacontroller you can set the first interface.  Sadly ifconfig and vifconfig didn't make the first cut as these are realitively new APIs.  Look for them in the near future.

As for options;  I have two small samples in documents on this community page.  In one, I show how to set options.  In the other, I show how to create an object collection from a text file, and perform a series of operations on the object collection (connect to a collection of controllers and set a couple options).  In short yes you can create an object collection consisting of options and their values, then loop through setting those option on all the controllers in another collection object.

Data ONTAP PowerShell Toolkit - HOWTO: Work with Many Controllers

Data ONTAP PowerShell Toolkit - HOWTO: Set Options

Happy Scripting

J

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

The Toolkit makes it very simple to standardize options across controllers.  For example, here's a script to export two entire sections of options from one controller to a file, and then set those same values on a different controller:

Import-Module DataONTAP

Connect-NaController dunn

Get-NaOption kerberos.* ldap.* | Export-CliXml Options.xml

Connect-NaController benson

Import-CliXml Options.xml | Set-NaOption

You can also use the Compare-NaOption cmdlet to find differences in option settings between any two controllers.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

Hello, Brian.  The Data ONTAP API supports tunneling commands to vfilers, so the Toolkit supports this as well:

Connect-NaController dunn -Vfiler vfiler1


OntapiMajorVersion : 1
OntapiMinorVersion : 12
Protocol           : RPC
Vfiler             : vfiler1
Name               : dunn
Address            : 10.61.167.60
Port               : 0
Credentials        :
ValidateIncoming   : False
ValidateOutgoing   : False
Trace              : False


Test-NaCifs


stopped


Get-NaNfsExport


ActualPathname             Pathname                   SecurityRules
--------------             --------                   -------------
                           /vol/testvol               {}

Not all APIs may be sent to vfilers, but many can.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

Thanks so much for the information. I will be looking more at this and posting up.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

Thanks for the input. This little bit of code will make my life so much easier.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

I followed your example above but I am outputting my options to a CSV file. I did this, so I could sample the output and know how to format my options from what I have been told that needs to be set. It seems that some of the options I am not able to set. I know it works, because I started first by exporting the options I wanted, so I could back them up and revert if needed. If I import the backup, I donot get any errors, but when I try to enable these options from a new file, I get errors. Can you help me with what i am doing? I know this is not the proper place to paste this, and for that I am sorry. Just thought I would attach it since it is the latest thread.

I have attached my code, my config file I want to use, and some of the options that are failing with the error messages. Some work just fine. I looked over the backup I made and it appears to be identical with the exception of some of the set values for the options. I have attached that csv as well. I thought it could have been an issue with the ONTap version, but I tried on 7.2.5.1 and 7.3.3 with the same options failing to be set.

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

Get-NaOption auditlog.* autologout.* autosupport.* backup.* bootfs.* cf.* cifs.* cksum.* console.* coredump.* disk.* dns.* ems.* ext_cache.* fcp.* flexcache.* fpolicy.* ftpd.* httpd.* ip.* iscsi.* kerberos.* ldap.* locking.* lun.* ndmpd.* nfs.* nis.* nlm.* pcnfsd.* ra.* raid.* replication.* rlm.* rmc.* rpc.* rsh.* security.* snaplock.* snapmirror.* snapvalidator.* snapvault.* snmp.* ssh.* ssh1.* ssh2.* ssl.* tape.* telnet.* tftpd.* timed.* trusted.* vfiler.* vol.* wafl.* webdav.* | Export-Csv Backup.csv #-Force

and then

Import-CSV Backup.csv | Set-NaOption

Certainly works as you stated.  Now if I import backup.csv to another filer of the same version with the same licenses enabled, that works as well.  Be aware that, as you mentioned, not all options are available in all versions (opions available in 7.3.3 might not be in 7.2.6 depending on when the feature was implemented).  Also be aware that some options require a license to be enabled.  Also, instead of editing the CSV manually, try setting desired option with set-naoption, then export it.

Happy Scripting

J

Highlighted

Re: What would YOU like to see in the Data ONTAP PowerShell Toolkit?

I guess I have an issue with the licenses. On the filer I am testing with I exported all my options, then I imported the filerconfig.csv and it barfed on some of the options. I will take your suggestion though and set the options first and then try to export. I was just trying to avoid setting some 250+ options.

Check out the KB!
NetApp Insights To Action
All Community Forums