ONTAP Discussions

Powershell: How change the tiering-policy for a volume?

Northman
1,654 Views

I am running ONTAP 9.11P8 .I have tried various commands, but I have had no luck with:

 

Update-Ncvol

Set-Ncvol

Set-Ncvoloption

 

I also consulted Google Bard (claiming it is updated to 9.11P8), which suggests:

 

# Import the NetApp ONTAP PowerShell module
Import-Module NetApp.Ontap.PowerShell

# Rename the volume
Set-NcVol -Name myvolume1 -NewName myvolume

# Get the current tiering policy
$tieringPolicy = Get-NcVol -Name myvolume | Select-Object -ExpandProperty TieringPolicy

# Set the new tiering policy
$tieringPolicy = "all"

# Update the volume with the new tiering policy
Set-NcVol -Name myvolume -TieringPolicy $tieringPolicy

 

But I keep getting the error: "Select-Object: Property "TieringPolicy" cannot be found"

 

Omitting the pipe to "Select-Object -ExpandProperty TieringPolicy" works:

 

i.e

$tieringPolicy = Get-NcVol -Name myvolume

 

Is this simply not supported in powershell for 9.11P8? Do I have to look into REST API calls?

 

 

 

 

1 ACCEPTED SOLUTION

TzwaynY
1,462 Views

Hi,

as far as I know there is only a command to get you the information about the tiering policy.

"Get-NcVolumeTieringPolicies"
 
The only two ways I can think of is via the Powershell Invoke SSH-Function or you can always go with the REST API POST (which I would recommend)
Best regards
Kai

View solution in original post

4 REPLIES 4

keitha
1,644 Views

Is it safe to say you have the volume on a FabricPoll Aggr already? Does it already have a tiering policy?

Northman
1,639 Views

hi, yes, it is a test volume, though. I can see it has the snapshot policy right now. It is in a aggregate that is setup with a FabricPool.

TzwaynY
1,463 Views

Hi,

as far as I know there is only a command to get you the information about the tiering policy.

"Get-NcVolumeTieringPolicies"
 
The only two ways I can think of is via the Powershell Invoke SSH-Function or you can always go with the REST API POST (which I would recommend)
Best regards
Kai

FED_ESB
525 Views

I understand this is an old question, and I came across it while searching for how to set the tiering policy for a new fsx instance. There is another way to get the status in powershell using the

VolumeCompAggrAttributes on any given volume.

 

 

PS C:\> (get-ncvol vol_1).VolumeCompAggrAttributes

NcController  TieringPolicy
------------  -------------
xxxxxxxxxxxx  all

 

 

 

You can set the tiering policy at volume creation in powershell using new-ncvol option of -TieringPolicy <string>.  And you can update the policy using update-nvcol

 

 

update-ncvol -query @{name="$vol"} -Attributes @{VolumeCompAggrAttributes=@{TieringPolicy="all"}}

 

 

A good thing to note is how update-nvol allows you to update any attribute/setting versus what is limited in set-ncvol. 

 

Good Luck

 

 

Public