Software Development Kit (SDK) and API Discussions

Vserver snapshot-set-reserve

Daredia
2,267 Views

I have a problem with Vserver snapshot-set-reserve.

 

Sets the size of the indicated volume's snapshot reserve to the specified percentage. Reserve space can be used only by snapshots and not by the active file system.

 

Input Name

Range

Type

Description

percentage

 

integer

Percentage to set. Range [0-100].

volume

 

string

Name of volume on which to set the snapshot space reserve.

     

 

the percentage range is [0-100] but when I set percentage is integer 0. I get the following:

 

Invalid integer value for percentage: (null)

 

but when I set percentage is inter 1. Snapshot-set-reserve works..

 

Could you please let me know how to set snapshot reserve is 0?

1 REPLY 1

mbeattie
2,198 Views

Hi,

 

I tested this and it works, can you post the code you are using which generates the error?

 

 

using System;
using System.Text;
using System.Collections.Generic;
using NetApp.Manage;

namespace NetApp.NMSDK.Example
{
  class ApiClient 
  {
	 static void Main(string[] args)
	 {
		 try
		 {
			NaServer s = new NaServer("<cluster_name>", 1 , 110);
			s.ServerType = NaServer.SERVER_TYPE.FILER;
			s.TransportType = NaServer.TRANSPORT_TYPE.HTTPS;
			s.Port = 443;
			s.Style = NaServer.AUTH_STYLE.LOGIN_PASSWORD;
			s.SetAdminUser("admin", "<password>");
			s.Vserver = "<vserver_name>";


			NaElement api = new NaElement("snapshot-set-reserve");
			api.AddNewChild("percentage","10");
			api.AddNewChild("volume","<volume_name>");

			NaElement xo = s.InvokeElem(api);
			Console.WriteLine(xo.ToPrettyString(""));


		}
		catch (NaAuthException e)
		{
			Console.Error.WriteLine("Authorization Failed: " + e.Message);
		}
		catch (NaApiFailedException e)
		{
			Console.Error.WriteLine("API FAILED: " + e.Message);
		}
		 catch (Exception e)
		{
			Console.Error.WriteLine(e.Message);
		}
	 }
  }
}

Have you tried using the "Set-NcSnapshotReserve" cmdlet? EG:

 

PS C:\> import-module dataontap
PS C:\> get-nccommand -api snapshot-set-reserve

Name                                Category        Family               Api
----                                --------        ------               ---
Set-NcSnapshotReserve               snapshot        {vserver}            {snapshot-set-reserve}

PS C:\> get-help Set-NcSnapshotReserve

NAME
    Set-NcSnapshotReserve

SYNOPSIS
    Sets the size of the indicated volume's snapshot reserve to the specified percentage.

SYNTAX
    Set-NcSnapshotReserve [-Volume] <String> [-Percentage] <Int32> [-VserverContext <String>] [-Controller
    <NcController[]>] [-ZapiRetryCount <Int32>] [<CommonParameters>]

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.
Public