Microsoft Virtualization Discussions

Get-NaVolSpace returns an error (Data ONTAP 7.3.7 - Toolkit v3.0.0)

Bill_Freed
5,190 Views

Trying to get total, used, avail. for Snapshots (like I can with 'df')

Example:

/vol/NJTRDNS02_volT/   80GB   21GB   58GB  27%  /vol/NJTRDNS02_volT/
snap reserve          20GB   30MB   19GB   0%  /vol/NJTRDNS02_volT/..

I have tried most of the Get-NaVol* and Get-NaSnapshot* cmdlets with success. However, the Get-NaVolSpace returns an error each time.

Any suggestions?

Here is what I've tried...

Import-Module DataONTAP

Get-Module DataONTAP

$Cred = Get-Credential domain\userID

$objNaController = Connect-NaController -Name filer1 -Credential $Cred

============================================================================================================

PS C:\> Get-NaVol -Name NJTRDNS02_volT -Controller $objNaController

Name                      State       TotalSize  Used  Available Dedupe  FilesUsed FilesTotal Aggregate

----                      -----       ---------  ----  --------- ------  --------- ---------- ---------

NJTRDNS02_volT            online        80.0 GB   27%    58.6 GB False          8k         3M aggr1

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PS C:\> Get-NaSnapshotReserve -TargetName NJTRDNS02_volT -TargetType volume -Controller $objNaController |FL

Name       : NJTRDNS02_volT

Percentage : 20

Size       : 21474836480

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PS C:\> Get-NaSnapshotVolumeSpace -TargetName NJTRDNS02_volT -Controller $objNaController |FL

SizeAvailable : 84345376768

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PS C:\> Get-NaSnapshotSchedule -TargetName NJTRDNS02_volT -Controller $objNaController |FL

Volume       : NJTRDNS02_volT

Weeks        : 0

Days         : 2

Hours        : 6

Minutes      : 0

WhichHours   : 8,12,16,20

WhichMinutes :

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

PS C:\> Get-NaVolSpace -Name NJTRDNS02_volT -Controller $objNaController

Get-NaVolSpace : Unable to find API: volume-space-list-info-iter-start

At line:1 char:1

+ Get-NaVolSpace -Name NJTRDNS02_volT -Controller $objNaController

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (filer1:NaController) [Get-NaVolSpace], EAPINOTFOUND

    + FullyQualifiedErrorId : ApiException,DataONTAP.PowerShell.SDK.Cmdlets.Volume.GetNaVolSpace

============================================================================================================

Dismount-NaController -Name filer1

Remove-Module DataONTAP

1 ACCEPTED SOLUTION

beam
5,189 Views

The "unable to find API" error indicates that the API the cmdlet is calling is not available on your version of Data ONTAP.  The Get-NaVolSpace cmdlet uses the API volume-space-list-info-iter-start/next/end (you can find this information through Get-NaCommand) which is first available on Data ONTAP 8.2.

Thanks,

Steven

View solution in original post

6 REPLIES 6

JGPSHNTAP
5,190 Views

Ok, let's see if I can help out..

First, let's cover the basics

With powershell 3.0 and the latest data ontap, you don't need to load the module everytime. 

Also, once you import the module, i'm not sure why you are running get-module.

Also, once you connect to the controller you don't need to keep trying -controller $controllername,   That's a waste

Also for password, i tend to use prompted value

## Define Global PWD

$password = read-host "Enter Root password" -assecurestring

#$password = ConvertTo-SecureString "*" -AsPlainText -Force

$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "root",$password

So, let's see you connect to controller

$c  = connect-nacontroller $controllername -cred $cred

Now run something like this

get-navol | ? {$_.raidstatus -notmatch "read-only"} | ? {$_.state -eq "online"} |  ? {$_.name -ne "vol0"} | Select Name,@{N="Snapshot %";E={ Convertto-formattednumber $_.snapshotpercentreserved percent}},@{N="Snap used";E={ convertto-formattednumber ((get-naefficiency $_.name).snapusage).used datasize "0.0"}}`

,@{N="Total Snap Space";E={ convertto-formattednumber (get-nasnapshotreserve $_.name).size datasize "0.0"}}`

,@{N="Snap schedule";E={'{0} Weeks {1} Days, {2} Hours, {3} Minutes' -f  (Get-NaSnapshotSchedule $_.name).weeks,  (Get-NaSnapshotSchedule $_.name).days,(Get-NaSnapshotSchedule $_.name).hours,(Get-NaSnapshotSchedule $_.name).minutes}} | ft -autosize

If you want to export it you.  I tend to work in objects so i would have done it even differently, but i figured i would help you out and get started

JGPSHNTAP
5,190 Views

Also, if you want to add the volume size and used to it, just try to follow what I did for you

Bill_Freed
5,189 Views

Thanks for the very quick response.

The purpose of those commands (in my list) was only to show the community that all other NetApp CmdLets are working correctly except for "Get-NaVolSpace".

I wasn't displaying a script, just a bunch of commands that I may run individually, depending on what I am looking for.

Your examples, although valuable,  do not really get to the purpose of my inquiry.

As you can see, I do get the credentials and store in a variable and I do the same with the controller.

However, I can not get the "Get-NaVolSpace" CmdLet to work.

I just upgraded my Toolkit to the latest version (3.1.1.181).

I am running PowerShell v4

My version of OnTap is 7.3.7

I was just checking with the community to see if anyone else has experienced this problem with "Get-NaVolSpace". If they did or didn't, I'd like to know the versions of everything they are running to see if this is something specific to a version of PowerSheel, OnTap, or the Toolkit.

Thanks again !!!

beam
5,190 Views

The "unable to find API" error indicates that the API the cmdlet is calling is not available on your version of Data ONTAP.  The Get-NaVolSpace cmdlet uses the API volume-space-list-info-iter-start/next/end (you can find this information through Get-NaCommand) which is first available on Data ONTAP 8.2.

Thanks,

Steven

Bill_Freed
5,189 Views

Thanks so much. That is the answer I was looking for.

I guess I will have to upgrade to Data ONTAP 8.2 in order to use this command.

I really appreciated your quick response !!!

JGPSHNTAP
5,190 Views

Wow, I read that wrong.. i thought you needed helping putting together something... Well, hope it's useful

Public