Subscribe
Accepted Solution

Command to change the cDOt volume State from online to offline

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

Re: Command to change the cDOt volume State from online to offline

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.

Re: Command to change the cDOt volume State from online to offline

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

Re: Command to change the cDOt volume State from online to offline

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