Quantcast
Channel: NetApp – The Practical Administrator
Viewing all articles
Browse latest Browse all 16

NetApp PowerShell Toolkit 101: Node Configuration

$
0
0

In the last post we looked at some settings that apply to the cluster. This time, let’s look at how to administer nodes.

In this post we will cover using the NetApp PowerShell Toolkit to manage these aspects of nodes:

  • Network Port Configuration
  • Node Management LIFs
  • Service Processor
  • CDP
  • Aggregates

Network Port Configuration

Clustered Data ONTAP has two types of network configuration: ports, which are the physical aspects of the network connectivity, and logicial interfaces (LIFs), which are the logicial entities that receive IP address (or WWPN) assignments.

A port can reference a single port on the controller, such as e0a (for an ethernet port) or 0d (for a FC port). Ports can also reference interface groups, for example when creating an LACP link aggregate, or VLAN ports, which are added onto the physical ports.

node_mgmt_1

Note: This image comes from the NetApp document “Clustered Data ONTAP Network Management Guide”

Getting information about ports is just a cmdlet away…

# get the ports for a specific node
Get-NcNode $nodeName | Get-NcNetPort
 
# get the non-cluster ports for the node
Get-NcNode $nodeName | Get-NcNetPort -Role !cluster
 
# get ports that have an active link
Get-NcNode $nodeName | Get-NcNetPort | ?{ $_.LinkStatus -eq "up" }

Let’s look at how we can automate creating some different port configurations.

Port groups provide the ability to aggregate links and provide high availability in the event of link or switch failure. Creating them is a single cmdlet:

# create a new single-mode interface group.  singlemode is a failover-only group.
New-NcNetPortIfgrp -Node $nodeName -Name a0a -Mode singlemode -DistributionFunction mac
 
# create a new static multi-mode interface group.  static multimode is the same
# as an always on Cisco port channel.
New-NcNetPortIfgrp -Node $nodeName -Name a1a -Mode multimode -DistributionFunction ip
 
# create a new dynamic multi-mode interface group. dynamic multimode is an LACP aggregate.
New-NcNetPortIfgrp -Node $nodeName -Name a2a -Mode multimode_lacp -DistributionFunction mac

Regardless of the type of interface group created, you will need to add ports before it actually works.

Add-NcNetPortIfgrpPort -Name a2a -Node $nodeName -Port e0a,e0b

The final step is to create any VLAN interfaces. These are tagged VLAN interfaces and can be created on individual ports or interface groups.

# create a VLAN port
New-NcNetPortVlan -Node $nodeName -ParentInterface $portName -VlanId $VLAN

Setting port configuration is equally important and can be managed using the Set-NcNetPort cmdlet.

# enable jumbo frames on an interface
Set-NcNetPort -Node $nodeName -Name a0a -Mtu 9000
 
# disable flow control for 10GbE interfaces
Get-NcNetPort | ?{ 
        $_.PortType -eq "physical" -and $_.OperationalSpeed -eq 10000 
    } | Set-NcNetPort -FlowControl none

Node Management LIF(s)

Node management LIFs are managed the same as any other LIF, however they have a specific role: node_mgmt. Additionally, node management LIFs can not be migrated off the node they are meant to manage.

# get all node management LIFs
Get-NcNetInterface -Role node_mgmt
 
# get a specific node's management LIF
Get-NcNetInterface -Vserver $nodeName -Role node_mgmt

Service Processor

# get the current network configuration of an SP
Get-NcNode $nodeName | Get-NcServiceProcessorNetwork -AddressType ipv4
 
# configure the service processor
$splat = @{
    Node = $nodeName
    AddressType = "ipv4"
    Address = $ipAddress
    Netmask = $netmask
    GatewayAddress = $gateway
}
 
Set-NcServiceProcessorNetwork @splat -Enable

CDP

Cisco Discovery Protocol (CDP) is extremely helpful for verifying that you have connected your NetApp’s physical network ports to the correct ports on the switch. It also enables the network admins to verify configuration from their end as well.

There is no cmdlet for enabling or disabling CDP on the nodes, so instead we use system-cli API calls and the Invoke-NcSystemApi cmdlet. Here is a convenient wrapper function:

function Set-NcNodeCdp {
    [CmdletBinding(SupportsShouldProcess=$true)]
    param(
        [Parameter(
            Mandatory=$true,
            ValueFromPipeline=$true,
            ValueFromPipelineByPropertyName=$true
        )]
        [System.String]
        $Node,
 
        [Parameter(
            Mandatory=$true
        )]
        [Switch]$Enabled
 
    )
    process {
        if ($Node.GetType().FullName -ne "System.String") {
            $NodeName = $Node.Node
        } else {
            $NodeName = $Node
        }
 
        if ($Enabled) {
            $status = "on"
        } else {
            $status = "off"
        }
 
        $zapi  = "<system-cli><args>"
        $zapi +=   "<arg>node</arg>"
        $zapi +=   "<arg>run</arg>"
        $zapi +=   "<arg>-node $($NodeName)</arg>"
        $zapi +=   "<arg>options</arg>"
        $zapi +=   "<arg>cdpd.enable</arg>"
        $zapi +=   "<arg>$($status)</arg>"
        $zapi += "</args></system-cli>"
 
        $execute = Invoke-NcSystemApi -Request $zapi
 
        $result = "" | Select-Object Node,CDP
        $result.Node = $NodeName
 
        if ($execute.results.'cli-result-value' -eq "1") {
            $result.CDP = $status
        } else {
            Write-Warning $execute.results.'cli-output'
        }
 
        $result
 
    }
}

With the above function we can now enable and disable CDP easily.

# enable for a specific node
Set-NcNodeCdp -Node $nodeName -Enabled
 
# enable for all nodes
Get-NcNode | Set-NcNodeCdp -Enabled
 
# disable for all nodes
Get-NcNode | Set-NcNodeCdp -Enabled:$false

And with CDP enabled, we can get CDP information using a cmdlet which is part of the toolkit.

# get discovered ports
Get-NcNode $nodeName | Get-NcNetDeviceDiscovery | Format-Table -AutoSize

Aggregates

Aggregates are the foundation of data storage in Data ONTAP. Without them you can’t create volumes, and without volumes you can’t store data. Let’s look at some common tasks:

# show all aggregates
Get-NcAggr
 
# show SATA aggregates.  I bet you thought this would be a Get-NcAggr command...
Get-NcDisk | ?{ 
        $_.DiskInventoryInfo.DiskType -match "SATA|BSAS" -and $_.Aggregate -ne $null 
    } | Group-Object -Property Aggregate
 
# show Flash Pool aggregates
Get-NcAggr | ?{ $_.AggrRaidAttributes.AggregateType -eq "hybrid" }
 
# create an aggreagate
$splat = @{
    'Name' = $aggrName;
    'Node' = $nodeName;
    'DiskCount' = $diskCount;
    'RaidSize' = 16;
    'RaidType' = "raid_dp";
}
 
New-NcAggr @splat
 
# add disks to an aggregate
Add-NcAggr $aggrName -DiskCount $diskCount
 
# enable free space reallocation
Get-NcAggr $aggrName | Set-NcAggrOption -Key free_space_realloc -Value on

I prefer to have my root aggregate names end with “_root” to make them easily identifiable. Here is a short script that will automatically rename them for you:

# get each of the nodes
Get-NcNode | %{ 
    $nodeName = $_.Node
 
    # determine the current root aggregate name
    $currentAggrName = (
        Get-NcAggr | ?{ 
             $_.AggrOwnershipAttributes.HomeName -eq $nodeName `
               -and $_.AggrRaidAttributes.HasLocalRoot -eq $true 
        }).Name
 
    # no dashes
    $newAggrName = $nodeName -replace "-", "_"
 
    # can't start with numbers
    $newAggrName = $newAggrName -replace "^\d+", ""
 
    # append the root identifier
    $newAggrName = "$($newAggrName)_root"
 
    if ($currentAggrName -ne $newAggrName) {
        Rename-NcAggr -Controller $Cluster -Name $currentAggrName -NewName 
    }
}

The post NetApp PowerShell Toolkit 101: Node Configuration appeared first on The Practical Administrator.


Viewing all articles
Browse latest Browse all 16

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>