Data ONTAP PowerShell Toolkit - HOWTO: Automate Provisioning

by Frequent Contributor on ‎2010-06-08 12:12 PM

You can use the Data ONTAP PowerShell Toolkit to automate many administrative tasks.  In this example, I provision an ONTAP simulator:

Import-module DataONTAP

$SIM1=Connect-NaController SIM1

Add-nalicense -Codes GWNTKCL,BCJEAZL,ELNRLTG,MTVVGAF,NAZOMKC,NQBYFJJ,DFVXFJJ,PVOIVFK,PDXMQMI

set-naoption wafl.optimize_write_once off

New-NaAggr aggr1 -DiskCount 8

do { $aggr; $aggr=get-naaggr aggr1} until ($aggr.State -eq "online")

Set-NaSnapshotReserve aggr1 0 -Aggregate

foreach ($VOL in @("vol1", "vol2", "vol3", "vol4"))

{

                New-NaVol $VOL aggr1 1g

                set-navoloption $VOL nosnap on

                set-navoloption $VOL no_atime_update yes

                set-navoloption $VOL fractional_reserve 0

                set-nasnapshotreserve  $VOL 0

                set-nasnapshotschedule $VOL -Weeks 0 -Days 0 -Hours 0

                get-nasnapshot $VOL | remove-nasnapshot

}

Enable-NaIscsi

First, I connect to the filer.  Connections in the toolkit are transitive, so I don't need to specify the filer again unless I want to start woking with a different one (you can work with more than one at the same time in your scripts).  Next, I add some licenses.  I then set a WAFL option.  After that I create an aggregate.  I then loop waiting for the newly created aggregate to come online.

At that point I remove the aggregate snapshot reserve and proceed to my foreach statement.  In the foreach statement, I create four volumes and set various options and schedules.  Last but not least, I enable iSCSI.  It take about a minute for the script to complete.

John

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.