Positional Parameters on clustershell

by Frequent Contributor on ‎2012-06-29 10:28 AM - edited on ‎2014-09-26 11:54 AM by Community Manager

[With inputs from John  DeGraaf]

 

Within the clustershell in Data ONTAP 8.1 Cluster-Mode we have the ability to position certain parameters within specific commands at any point within the command. These parameters are known as Positional Parameters. They can be identified on the CLI by the square brackets around the option setting. This note will provide examples with a couple of commands to show how the parameters can be placed while issuing the command in an interactive CLI session.

 

Not all mandatory parameters are positional parameters. In all the examples below the name of the Vserver is not a positional parameter but it is mandatory. If you do encounter an error on the interactive CLI session while exploring this capability it is recommended to check the command syntax for mandatory parameters that might have been missed.

 

CAUTION: The use of these positional parameters in scripts is discouraged. This is especially true for parameters that are optional or have optional parameters listed before them.

The examples below will cover the ‘volume’ and the ‘network interface’ command directories. The examples will cover the ‘create’, ‘modify’, ‘show’ and ‘delete’ scenarios.

 

In all examples below the text highlighted in green are the positional parameters.

 

Volume Create Example: In the ‘volume create’ command example there are three positional parameters. This means that the three parameters need to be specified in the same sequence in which they are listed. These parameters can be interspersed with other parameters that specified with their respective options.

cluster1::> volume create ?

-vserver <vserver name>                            Vserver Name

   [-volume] <volume name>                             Volume Name

   [-aggregate] <aggregate name>                       Aggregate Name

  [[-size] {<integer>[KB|MB|GB|TB|PB]}]                Volume Size

  [ -state {online|restricted|offline|mixed} ]         Volume State (default: online)

  [ -type {RW|DP} ]                                    Volume Type (default: RW)

  [ -policy <text> ]                                   Export Policy

  [ -user <user name> ]                                User ID

  [ -group <group name> ]                              Group ID

  [ -security-style {unix|ntfs|mixed} ]                Security Style

  [ -unix-permissions <unix perm> ] UNIX Permissions (default: ---rwx------)

  [ -junction-path <junction path> ]                   Junction Path

  [ -comment <text> ]                                  Comment

  [ -autosize {true|false} ]                           Autosize Enabled (for flexvols only) (default: false)

  [ -max-autosize {<integer>[KB|MB|GB|TB|PB]} ]        Maximum Autosize (for flexvols only) (default: 0B)

  [ -autosize-increment {<integer>[KB|MB|GB|TB|PB]} ]  Autosize Increment (for flexvols only) (default: 0B)

  [ -space-guarantee|-s {none|volume|file} ]           Space Guarantee Style (default: volume)

  [ -percent-snapshot-space <percent> ]                Space Reserved for Snapshots

  [ -snapshot-policy <snapshot policy> ]               Snapshot Policy (default: default)

  [ -foreground {true|false} ]                         Foreground Process (default: true)

  [ -antivirus-on-access-policy <antivirus policy> ]   Anti-Virus On-Access Policy (default: none)

  [ -nvfail {on|off} ]                                 NVFAIL Option

 

The ‘volume create’ command can be issued as either of the two combinations shown below.

cluster1::> volume create vol1 aggr1_03 1g -vserver vs01 -percent-snapshot-space 0

 

cluster1::> volume create -vserver vs01 vol2 -snapshot-policy default aggr1_03 -nvfail off 2g -space-guarantee none

 

 

Network Interface Create Example: In the ‘network interface create’ command there are seven positional parameters that come into play. In an example such as this it is recommended to be cautious and review the commands used.

sp::> network interface create ?

-vserver <vserver> Vserver Name

   [-lif] <lif-name> Logical Interface Name

   [-role] {cluster|data|node-mgmt|intercluster|cluster-mgmt}  Role

  [ -data-protocol {nfs|cifs|iscsi|fcp|fcache|none}, ... ]     Data Protocol

   [-home-node] <nodename>                                     Home Node

   [-home-port] {<netport>|<ifgrp>}                            Home Port

   { [-address] <IP Address>                                   Network Address

     [-netmask] <IP Address>                                   Netmask

   | [-auto] {true|false} }                                    IPv4 Link Local

  [ -routing-group <routing-group> ]                           Routing Group Name

  [ -status-admin {up|down} ] Administrative Status (default: up)

  [ -failover-policy {nextavail|priority|disabled} ]           Failover Policy (default: nextavail)

  [ -firewall-policy <policy> ]                                Firewall Policy

  [ -auto-revert {true|false} ]                                Auto Revert (default: false)

  [ -use-failover-group {system-defined|enabled|disabled} ]    Use Failover Group (default: system-defined)

  [ -dns-zone {zone-name|none} ]                               Fully Qualified DNS Zone Name

  [ -failover-group <failover-group> ]                         Failover Group Name

  [ -comment <text> ]                                          Comment

 

A couple of variations in which the command can be issued

cluster1::> network interface create lif1 -vserver vs01 data cluster1-03 e4a 10.12.14.16 255.255.255.0

cluster1::> network interface create lif2 data cluster1-01 e4a 10.12.14.20 255.255.255.0 -vserver vs01

 

 

Volume Modify Example: The ‘volume modify’ command has a single positional parameter.

cluster1::> volume modify ?

-vserver <vserver name>                            Vserver Name

   [-volume] <volume name>                             Volume Name

  [ -size {<integer>[KB|MB|GB|TB|PB]} ]                Volume Size

  [ -state {online|restricted|offline|mixed} ]         Volume State

  [ -policy <text> ]                                   Export Policy

  [ -user <user name> ]                                User ID

  [ -group <group name> ]                              Group ID

  [ -security-style {unix|ntfs|mixed} ]                Security Style

  [ -unix-permissions <unix perm> ]                    UNIX Permissions

  [ -comment <text> ]                                  Comment

  [ -autosize {true|false} ]                           Autosize Enabled (for flexvols only)

  [ -max-autosize {<integer>[KB|MB|GB|TB|PB]} ]        Maximum Autosize (for flexvols only)

  [ -autosize-increment {<integer>[KB|MB|GB|TB|PB]} ] Autosize Increment (for flexvols only)

  [ -files <integer> ]                                 Total Files (for user-visible data)

  [ -space-guarantee|-s {none|volume|file} ]           Space Guarantee Style

  [ -percent-snapshot-space <percent> ]                Space Reserved for Snapshots

  [ -snapshot-policy <snapshot policy> ]               Snapshot Policy

  [ -foreground {true|false} ]                         Foreground Process

  [ -antivirus-on-access-policy <antivirus policy> ]   Anti-Virus On-Access Policy

  [ -nvfail {on|off} ]                                 NVFAIL Option

  [ -filesys-size-fixed {true|false} ]                 Is File System Size Fixed

  [ -extent-enabled {off|on|space-optimized} ]         Extent Option

  [ -fractional-reserve <percent> ]                    Fractional Reserve

  [ -snapshot-clone-dependency {on|off} ]              Snapshot Cloning Dependency

  [ -space-mgmt-try-first {volume_grow|snap_delete} ]  Primary Space Management Strategy

  [ -read-realloc {off|on|space-optimized} ]           Read Reallocation Option

  [ -sched-snap-name {create_time|ordinal} ]           Naming Scheme for Automatic Snapshots

 

Here we are modifying specific attributes of both volumes that were created in the earlier command examples.

cluster1::> volume modify -percent-snapshot-space 0 -unix-permissions 0755 -vserver vs01 vol1|vol2

 

 

Network Interface Modify Example: Just like the command directory to modify attributes for volumes, we have a single positional parameter in this command directory as well.

cluster1::> network interface modify ?

-vserver <vserver>                                       Vserver Name

   [-lif] <lif-name> Logical Interface Name

  [ -home-node <nodename> ]                                  Home Node

  [ -home-port {<netport>|<ifgrp>} ]                         Home Port

  { [ -address <IP Address> ]                                Network Address

    [ -netmask <IP Address> ]                                Netmask

  | [ -auto {true|false} ] }                                 IPv4 Link Local

  [ -routing-group <routing-group> ]                         Routing Group Name

  [ -status-admin {up|down} ] Administrative Status

  [ -failover-policy {nextavail|priority|disabled} ]         Failover Policy

  [ -firewall-policy <policy> ]                              Firewall Policy

  [ -auto-revert {true|false} ]                              Auto Revert

  [ -use-failover-group {system-defined|enabled|disabled} ]  Use Failover Group

  [ -dns-zone {zone-name|none} ]                             Fully Qualified DNS Zone Name

  [ -failover-group <failover-group> ]                       Failover Group Name

  [ -comment <text> ]                                        Comment

 

In the example below we are making a single change to both LIFs that were created earlier in this document

cluster1::> network interface modify lif1..lif2 -comment "for nfs only" -vserver vs01

 

 

Volume Show Example: Again, just one positional parameter.

cluster1::> volume show ?

  [ -constituents | -instance | -junction | -fields <fieldname>, ... ]

  [ -vserver <vserver name> ]                                  Vserver Name

  [[-volume] <volume name>]                                    Volume Name

  [ -aggregate <aggregate name> ]                              Aggregate Name

  [ -size {<integer>[KB|MB|GB|TB|PB]} ]                        Volume Size

  [ -dsid <integer> ]                                          Volume Data Set ID

  [ -msid <integer> ] Volume Master Data Set ID

  [ -state {online|restricted|offline|mixed} ]                 Volume State

  [ -type {RW|DP} ]                                            Volume Type

  [ -volume-style {flex|striped|infinitevol} ]                 Volume Style

  [ -is-cluster-volume {true|false} ]                          Is Cluster-Mode Volume

  [ -is-constituent {true|false} ]                             Is Constituent Volume (default: false)

  [ -policy <text> ] Export Policy

  [ -user <user name> ]                                        User ID

  [ -group <group name> ]                                      Group ID

  [ -security-style {unix|ntfs|mixed} ]                        Security Style

  [ -unix-permissions <unix perm> ]                            UNIX Permissions

  [ -junction-path <junction path> ]                           Junction Path

  [ -junction-path-source {RW volume|LS mirror} ]              Junction Path Source

  [ -junction-active {true|false} ]                            Junction Active

  [ -junction-parent <volume name> ]                           Junction Parent Volume

  [ -comment <text> ] Comment

  [ -available {<integer>[KB|MB|GB|TB|PB]} ]                   Available Size

  [ -total {<integer>[KB|MB|GB|TB|PB]} ]                       Total User-Visible Size

  [ -used {<integer>[KB|MB|GB|TB|PB]} ]                        Used Size

  [ -percent-used <percent> ]                                  Used Percentage

  [ -autosize {true|false} ]                                   Autosize Enabled (for flexvols only)

  [ -max-autosize {<integer>[KB|MB|GB|TB|PB]} ]                Maximum Autosize (for flexvols only)

  [ -autosize-increment {<integer>[KB|MB|GB|TB|PB]} ] Autosize Increment (for flexvols only)

  [ -files <integer> ]                                         Total Files (for user-visible data)

  [ -files-used <integer> ]                                    Files Used (for user-visible data)

  [ -space-guarantee|-s {none|volume|file} ]                   Space Guarantee Style

  [ -space-guarantee-enabled {true|false} ]                    Space Guarantee in Effect

  [ -percent-snapshot-space <percent> ]                        Space Reserved for Snapshots

  [ -snapshot-space-used <percent_no_limit> ] Snapshot Reserve Used

  [ -snapshot-policy <snapshot policy> ]                       Snapshot Policy

  [ -create-time <Date> ]                                      Creation Time

  [ -clone-volume {true|false} ]                               Clone Volume

  [ -antivirus-on-access-policy <antivirus policy> ]           Anti-Virus On-Access Policy

  [ -nvfail {on|off} ]                                         NVFAIL Option

  [ -filesys-size-fixed {true|false} ]                         Is File System Size Fixed

  [ -extent-enabled {off|on|space-optimized} ]                 Extent Option

  [ -overwrite-reserve {<integer>[KB|MB|GB|TB|PB]} ] Reserved Space for Overwrites

  [ -fractional-reserve <percent> ]                            Fractional Reserve

  [ -snapshot-clone-dependency {on|off} ]                      Snapshot Cloning Dependency

  [ -space-mgmt-try-first {volume_grow|snap_delete} ] Primary Space Management Strategy

  [ -read-realloc {off|on|space-optimized} ]                   Read Reallocation Option

  [ -sched-snap-name {create_time|ordinal} ]                   Naming Scheme for Automatic Snapshots

  [ -is-inconsistent {true|false} ]                            Inconsistency in the File System

  [ -is-quiesced-on-disk {true|false} ]                        Is Volume Quiesced (On-Disk)

  [ -is-quiesced-in-memory {true|false} ]                      Is Volume Quiesced (In-Memory)

  [ -is-sis-volume {true|false} ]                              Volume Contains Shared or Compressed Data

  [ -sis-space-saved {<integer>[KB|MB|GB|TB|PB]} ] Space Saved by Storage Efficiency

  [ -sis-space-saved-percent <percent> ]                       Percentage Saved by Storage Efficiency

  [ -dedupe-space-saved {<integer>[KB|MB|GB|TB|PB]} ] Space Saved by Deduplication

  [ -dedupe-space-saved-percent <percent> ]                    Percentage Saved by Deduplication

  [ -dedupe-space-shared {<integer>[KB|MB|GB|TB|PB]} ] Space Shared by Deduplication

  [ -compression-space-saved {<integer>[KB|MB|GB|TB|PB]} ] Space Saved by Compression

  [ -compression-space-saved-percent <percent> ] Percentage Space Saved by Compression

  [ -block-type {32-bit|64-bit} ]                              Block Type

  [ -constituent-role <Repository Constituent Roles> ] Constituent Volume Role

  [ -is-moving {true|false} ]                                  Is Volume Moving

  [ -is-volume-in-cutover {true|false} ]                       Is Volume Move in Cutover Phase

  [ -hybrid-cache-eligibility {read|read-write} ]              Hybrid Cache Eligibility

  [ -hybrid-cache-write-caching-ineligibility-reason <text> ]  Hybrid Cache Write Caching Ineligibility Reason

 

With the command below, all Vservers that have a volume named ‘vol1’ will be returned.

cluster1::> volume show -fields security-style,unix-permissions,percent-used vol1

 

 

Network Interface Show Example: Just one positional parameter

cluster1::> network interface show ?

  [ -failover | -instance | -fields <fieldname>, ... ]

  [ -vserver <vserver> ]                                        Vserver Name

  [[-lif] <lif-name>] Logical Interface Name

  [ -role {cluster|data|node-mgmt|intercluster|cluster-mgmt} ]  Role

  [ -data-protocol {nfs|cifs|iscsi|fcp|fcache|none}, ... ]      Data Protocol

  [ -home-node <nodename> ] Home Node

  [ -home-port {<netport>|<ifgrp>} ]                            Home Port

  [ -curr-node <nodename> ]                                     Current Node

  [ -curr-port {<netport>|<ifgrp>} ]                            Current Port

  [ -status-oper {up|down} ]                                    Operational Status

  [ -status-extended <text> ]                                   Extended Status

  [ -is-home {true|false} ]                                     Is Home

  [ -address <IP Address> ]                                     Network Address

  [ -netmask <IP Address> ]                                     Netmask

  [ -auto {true|false} ]                                        IPv4 Link Local

  [ -netmask-length <integer> ] Bits in the Netmask

  [ -routing-group <routing-group> ]                            Routing Group Name

  [ -status-admin {up|down} ] Administrative Status

  [ -failover-policy {nextavail|priority|disabled} ]            Failover Policy

  [ -firewall-policy <policy> ]                                 Firewall Policy

  [ -auto-revert {true|false} ]                                 Auto Revert

  [ -use-failover-group {system-defined|enabled|disabled} ]     Use Failover Group

  [ -dns-zone {zone-name|none} ]                                Fully Qualified DNS Zone Name

  [ -failover-group <failover-group> ]                          Failover Group Name

  [ -wwpn <text> ]                                              FCP WWPN

  [ -comment <text> ] Comment

 

In the command example below we are filtering for a specific routing group.

cluster1::> network interface show lif* -routing-group d10.12.14.0/24 -fields address,failover-policy,failover-group

 

 

 

Volume Delete Example: Just one positional parameter here.

cluster1::> volume delete ?

-vserver <vserver name> Vserver Name

[-volume] <volume name> Volume Name

  [ -foreground {true|false} ]  Foreground Process (default: true)

 

It is important to remember that a volume needs to be unmounted from the namespace and turned offline before it can be deleted. In this example these volumes have been unmounted and turned offline.

cluster1::> volume delete -vserver vs01 vol1..vol2

 

 

 

Network Interface Delete Example: Just one positional parameter here.

cluster1::> network interface delete ?

-vserver <vserver> Vserver Name

   [-lif] <lif-name>          Logical Interface Name

 

Here we delete the two LIFs that were created at the start of the document

cluster1::> network interface delete lif1|lif2 -vserver vs01

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.