Microsoft Virtualization Discussions

Issue with Get-NADisk in PowerShell Toolkit 3.2

begonetapp
7,033 Views

Hi all,

 

I just came across a possible issue with Get-NADisk from PowerShell Toolkit Version 3.2. I think the property Status and RaidType do not contain correct data. As a result, I cannot determine spare disks with Get-NADisk anymore

 

Example 1:
PowerShell Toolkit 3.0.1
Get-NaDisk 0d.03.11| fl name,status,raidstate,raidtype
Name      : 0d.03.11
Status    : spare
RaidState : spare
RaidType  : pending

 

PowerShell Toolkit 3.2
Get-NaDisk 0d.03.11| fl name,status,raidstate,raidtype
Name      : 0d.03.11
Status    : present
RaidState :
RaidType  : present

 


Example 2:
PowerShell Toolkit 3.0.1
Get-NaDisk | Group-Object status -NoElement
Count Name
----- ----
    3 dparity
   35 partner
   29 data
   14 spare
    3 parity

 

PowerShell Toolkit 3.2
Get-NaDisk | Group-Object status -NoElement
Count Name
----- ----
   49 present
   29 data
    3 dparity
    3 parity

 

Needless to mention that all commands were executed on the same host.

 

Any suggestion for a reasonable workaround?

 

Regards

 

 

1 ACCEPTED SOLUTION

NEILHOLMES
6,732 Views

Hi,

 

I had the same problem. This is the best compromise I came up with. As both filer spares and partner disks were showing as PRESENT instead of SPARE and PARTNER, the solution for me was to only capture disks from one filer at a time. That way, any PRESENT disks have to be spare disks. I dd this by combining the Get-NaDiskOwner and Get-NaDisk commands and exploiting the common denominator of the two commands, which is the disk name.

 

Here is an example of it in action, which connects to a filer called netapp01 and uses the IF command to only display the PRESENT (spare) disks.

 

[Int64]$Unit=1GB
$Filer="netapp01"

Connect-NaController $Filer
$disks=Get-NaDisk
$diskowner = Get-NaDiskOwner | ? {$_.owner -eq $Filer} | sort Name

Foreach ($dsk in $diskowner) {
    $thisdsk = $disks | ? {$_.Name -eq $dsk.Name}
    
    If ($thisdsk.Status -eq "present") {
        write-host "Disk Name   =" $dsk.Name
        write-host "Disk Aggr   =" $thisdsk.Aggregate
        write-host "Disk Serial =" $dsk.SerialNo
        write-host "Disk Pool   =" $dsk.Pool
        write-host "Disk Shelf  =" $thisdsk.Shelf
        write-host "Disk Bay    =" $thisdsk.Bay

        $UsedSpace = [System.Math]::Floor($thisdsk.UsedSpace/$unit)
        write-host "Used Space  ="  $UsedSpace

        $PhysSpace = [System.Math]::Floor($thisdsk.PhysSpace/$unit)
        write-host "Phys Space  =" $PhysSpace

        write-host "Disk RPM    =" $thisdsk.Rpm
        write-host "Disk FW     =" $thisdsk.FirmwareRevision
        write-host "Disk Model  =" $thisdsk.Model
        write-host "Disk Status =" $thisdsk.Status
        write-host " "
    }
}

 

 

 

View solution in original post

4 REPLIES 4

NEILHOLMES
6,733 Views

Hi,

 

I had the same problem. This is the best compromise I came up with. As both filer spares and partner disks were showing as PRESENT instead of SPARE and PARTNER, the solution for me was to only capture disks from one filer at a time. That way, any PRESENT disks have to be spare disks. I dd this by combining the Get-NaDiskOwner and Get-NaDisk commands and exploiting the common denominator of the two commands, which is the disk name.

 

Here is an example of it in action, which connects to a filer called netapp01 and uses the IF command to only display the PRESENT (spare) disks.

 

[Int64]$Unit=1GB
$Filer="netapp01"

Connect-NaController $Filer
$disks=Get-NaDisk
$diskowner = Get-NaDiskOwner | ? {$_.owner -eq $Filer} | sort Name

Foreach ($dsk in $diskowner) {
    $thisdsk = $disks | ? {$_.Name -eq $dsk.Name}
    
    If ($thisdsk.Status -eq "present") {
        write-host "Disk Name   =" $dsk.Name
        write-host "Disk Aggr   =" $thisdsk.Aggregate
        write-host "Disk Serial =" $dsk.SerialNo
        write-host "Disk Pool   =" $dsk.Pool
        write-host "Disk Shelf  =" $thisdsk.Shelf
        write-host "Disk Bay    =" $thisdsk.Bay

        $UsedSpace = [System.Math]::Floor($thisdsk.UsedSpace/$unit)
        write-host "Used Space  ="  $UsedSpace

        $PhysSpace = [System.Math]::Floor($thisdsk.PhysSpace/$unit)
        write-host "Phys Space  =" $PhysSpace

        write-host "Disk RPM    =" $thisdsk.Rpm
        write-host "Disk FW     =" $thisdsk.FirmwareRevision
        write-host "Disk Model  =" $thisdsk.Model
        write-host "Disk Status =" $thisdsk.Status
        write-host " "
    }
}

 

 

 

Aparajita
6,461 Views

This is probably a little late, but wanted to mention there is an easier alternative.

 

There is a Switch Parameter 'Old', which can be specified in later versions of Data ONTAP PowerShell Toolkit to produce the exact same result as version 3.0.1 (example usage below).

 

PS C:\Users\aparajir\Perforce\aparajir_BTC_pstk_1\main> Get-NaDisk 0c.22 -Old | fl name,status,raidstate,raidtype

 

Name      : 0c.22

Status    : parity

RaidState : present

RaidType  : parity

 

This was introduced because we upgraded Get-NaDisk to take advantage of newer Data ONTAP APIs (which return more information about the disks), but unfortunately the new APIs do not return the RaidState. So as a compromise this parameter was introduced to allow users to force use of the old API in case they are unhappy with the new output.

 

Hope this helps!

Aparajita

begonetapp
6,457 Views

Thanks for the update. It perfectly solves the problem. I guess you work together with Rajesh? I sent a message to him as he announced the latest version of the toolkit and I noticed that the assumed "bug" was still there. Rajesh also explained that this behavior is not a bug but can be circumvented by using the -old switch when using older Ontap versions.

 

Thanks again for your support.

 

Kind regards,

Thomas

Aparajita
6,454 Views

Yes I do work with Rajesh. We thought it will be best to mention the resolution here, for anyone who may have the same question in the future.

 

Thank you for bringing this to our notice.  Please continue helping us improve the Data ONTAP PowerShell Toolkit.

 

Cheers,

Aparajita

Public