The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Active IQ Unified Manager Discussions

Command to change the cDOt volume State from online to offline

Adai

Hi,

       I am looking for a cdot volume modify command or volume set command that would change the state of the volume from online to offline.

I looked at out of box commands,  both modify volume and rename volume and both doesnt do it.

 

The state change is part of a Destory volume workflow, where we would like to rename the volume as volname_upfordecomissioning and then change the volume state to offline.

Then as a batch process destory all volume with _upfordecomissioning.

 

Anyone already written a cdot command to change to volume state from online to offline ?

 

Regards

adai

1 ACCEPTED SOLUTION

francoisbnc

Hello Adai,

You can use part of certified commmand "remove volume", only concerning checking, dismounting and offlining and create a new one that could be have this look:

 

param (
[parameter(Mandatory=$true, HelpMessage="Cluster IP address")]
[string]$Cluster,

[parameter(Mandatory=$true, HelpMessage="Volume name")]
[string]$VolumeName,

[parameter(Mandatory=$true, HelpMessage="Storage Virtual Machine name")]
[string]$VserverName


)

# connect to cluster
Connect-WfaCluster $Cluster
$lastConnectedCluster = $Cluster

$clusterInfo = Get-NcCluster

# Testing volume existence. As this command doesn't throw exception if
# ErrorAction is 'Stop' and the volume isn't found. So, an explicit check.
$vol = Get-NcVol -Name $VolumeName -Vserver $VserverName
if(!$vol)
{
throw "Volume '$VolumeName' not found on Storage Virtual Machine '$VserverName'"
}

# Dismount the volume from the Storage Virtual Machine namespace if it is not the Storage Virtual Machine root volume
if (!$vol.VolumeStateAttributes.IsVserverRoot)
{
Get-WFALogger -Info -message $("Dismounting volume: " + $VolumeName + " on Storage Virtual Machine " + $VserverName)
Dismount-NcVol -Name $VolumeName -VserverContext $VserverName -Force -ErrorAction Stop
}

$volState = (Get-NcVol -Name $VolumeName -VserverContext $VserverName).State

if($volState -ne "offline")
{
Get-WFALogger -Info -message $("Offlining volume: " + $VolumeName + " on Storage Virtual Machine " + $VserverName)
Set-NcVol -Name $VolumeName -VserverContext $VserverName -Offline -ErrorAction Stop
}

 

François

View solution in original post

3 REPLIES 3

francoisbnc

Hello Adai,

You can use part of certified commmand "remove volume", only concerning checking, dismounting and offlining and create a new one that could be have this look:

 

param (
[parameter(Mandatory=$true, HelpMessage="Cluster IP address")]
[string]$Cluster,

[parameter(Mandatory=$true, HelpMessage="Volume name")]
[string]$VolumeName,

[parameter(Mandatory=$true, HelpMessage="Storage Virtual Machine name")]
[string]$VserverName


)

# connect to cluster
Connect-WfaCluster $Cluster
$lastConnectedCluster = $Cluster

$clusterInfo = Get-NcCluster

# Testing volume existence. As this command doesn't throw exception if
# ErrorAction is 'Stop' and the volume isn't found. So, an explicit check.
$vol = Get-NcVol -Name $VolumeName -Vserver $VserverName
if(!$vol)
{
throw "Volume '$VolumeName' not found on Storage Virtual Machine '$VserverName'"
}

# Dismount the volume from the Storage Virtual Machine namespace if it is not the Storage Virtual Machine root volume
if (!$vol.VolumeStateAttributes.IsVserverRoot)
{
Get-WFALogger -Info -message $("Dismounting volume: " + $VolumeName + " on Storage Virtual Machine " + $VserverName)
Dismount-NcVol -Name $VolumeName -VserverContext $VserverName -Force -ErrorAction Stop
}

$volState = (Get-NcVol -Name $VolumeName -VserverContext $VserverName).State

if($volState -ne "offline")
{
Get-WFALogger -Info -message $("Offlining volume: " + $VolumeName + " on Storage Virtual Machine " + $VserverName)
Set-NcVol -Name $VolumeName -VserverContext $VserverName -Offline -ErrorAction Stop
}

 

François

View solution in original post

Adai

Hi Francois,

                 Thanks for your base code. I used it as a base and built the cDOT Volume Offline Comand.

 

Here it is for the convenience of all.

 

Regards

adai

trentino123

Hi Adai,

 

Don't know about the offline before for removing a volume there is a workflow called :  Remove a Clustered Data ONTAP VOlume

 

Which uses the following Commands : Split Volume Clone -> Wait for Volume Clone split -> Remove Volume

 

Hope it helps.

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public