Microsoft Virtualization Discussions

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

How can we use Get-NaQuotaEntry 

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

Hello gmf,

 

Snapshots are a bit different in CDOT versus 7-mode.  In 7-mode, you have one command which creates the snapshot schedule.  In CDOT, it's expanded for more granular scheduling.

 

You'll need to create a JobSchedule (Get-NcJobCronSchedule/Add-NcJobCronSchedule)  Here are the defaults if any of these work for you:

 

PS C:\> Get-NcJobCronSchedule

JobScheduleName JobScheduleDescription
--------------- ----------------------
5min @:00,:05,:10,:15,:20,:25,:30,:35,:40,:45,:50,:55
8hour @2:15,10:15,18:15
daily @0:10
hourly @:05
weekly Sun@0:15

 

 

 

Then you create a Snapshot Policy using the schedules created and setting a retention count.  Here are the defaults:

 

PS C:\> Get-NcSnapshotPolicy

Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
default True {hourly (6), daily (2), weekly (2)}
default-1weekly True {hourly (6), daily (2), weekly (1)}
none False

 

 

Once the snapshot policy has been created, you can then add it to the volume using the Update-NCVol command to set the policy for the volume.

 

For example, if I want to create a Test schedule using the default cron jobs, use New-NcSnapshotPolicy to create the schedule.

 

PS C:\> New-NcSnapshotPolicy -name Test -Schedule hourly -count 24 -enabled $true

Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
Test True {hourly (24)}

 

 

Then use Add-NcSnapshotPolicySchedule to add additional schedules to the existing policy.

 

PS C:\> Add-NcSnapshotPolicySchedule -Name Test -Schedule daily -count 14

Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
Test True {hourly (24), daily (14)}

 

PS C:\> Add-NcSnapshotPolicySchedule -name Test -Schedule weekly -count 4

Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
Test True {hourly (24), daily (14), weekly (4)}

 

 

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

Thanks billyd. I appreciate your quick response.

I'll try it using the example you've given and I'll let you know how it goes.

 

Regards,

gmf

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

I tried your examples and come up with the following output:

Define snashotschedule based on a value from Initialize data on Orchestrator runbook:

 

5/8/2015 2:19:42 PM [37] Monad P:\> $SnapShotSchedule = '0 2 6@8,12,16,20'
5/8/2015 2:19:52 PM [38] Monad P:\> $rScheduleRetainWeeks = ($SnapshotSchedule).split(" ")[0]
5/8/2015 2:20:00 PM [39] Monad P:\> $rScheduleRetainDays = ($SnapshotSchedule).split(" ")[1]
5/8/2015 2:20:09 PM [40] Monad P:\> $rScheduleRetainHours = ($SnapshotSchedule).split(" ")[2].split("@")[0]
5/8/2015 2:20:16 PM [41] Monad P:\> $rScheduleHourlyTimes = ($SnapshotSchedule).split("@")[1]
5/8/2015 2:20:24 PM [42] Monad P:\> Add-NcJobCronSchedule -Name HourlyTimes -Hour $rScheduleHourlyTimes

 

I'm not sure why it displays an error when I try to run AAdd-NcJobCronSchedule like this:

 

5/8/2015 2:20:24 PM [42] Monad P:\> Add-NcJobCronSchedule -Name HourlyTimes -Hour $rScheduleHourlyTimes
Add-NcJobCronSchedule : Invalid value specified for "job-schedule-cron-hour" element within "job-schedule-cron-create": "8121620".
At line:1 char:1
+ Add-NcJobCronSchedule -Name HourlyTimes -Hour $rScheduleHourlyTimes
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (10.127.135.70:NcController) [Add-NcJobCronSchedule], EINVALIDINPUTERROR
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Job.AddNcJobCronSchedule

 

BUt it succeed when I did not use the  $rScheduleHourlyTimes variable:

 

5/8/2015 2:21:14 PM [44] Monad P:\> Add-NcJobCronSchedule -Name HourlyTimes -Hour 8,12,16,20

JobScheduleName JobScheduleDescription
--------------- ----------------------
HourlyTimes @8:00,12:00,16:00,20:00

 

 

Here's for the New-NcSnapshotPolicy (error again because Weekly has a uppercase W). I think the -Schedule parameter arguments expects lowercase value:

 

5/8/2015 2:25:59 PM [54] Monad P:\> New-NcSnapshotPolicy -Name CDOT -Schedule Weekly -Count 0 -Enabled $true
New-NcSnapshotPolicy : Schedule Weekly not found.
At line:1 char:1
+ New-NcSnapshotPolicy -Name CDOT -Schedule Weekly -Count 0 -Enabled $t ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (10.127.135.70:NcController) [New-NcSnapshotPolicy], EINVALIDINPUTERROR
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Snapshot.NewNcSnapshotPolicy

5/8/2015 2:26:42 PM [55] Monad P:\> New-NcSnapshotPolicy -Name CDOT -Schedule weekly -Count $rScheduleRetainWeeks -Enabled $true

Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
CDOT True {weekly (0)}

 

 

5/8/2015 2:28:37 PM [57] Monad P:\> Add-NcSnapshotPolicySchedule -Name CDOT -Schedule daily -Count $rScheduleRetainDays

Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
CDOT True {weekly (0), daily (2)}


5/8/2015 2:28:48 PM [58] Monad P:\> Add-NcSnapshotPolicySchedule -Name CDOT -Schedule hourly -Count $rScheduleRetainHours

Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
CDOT True {weekly (0), daily (2), hourly (6)}

 

 

After adding all of the above the JobCronSchedule and SnapshotPolicy now looks like this:


5/8/2015 2:29:03 PM [59] Monad P:\> Get-NcJobCronSchedule

JobScheduleName JobScheduleDescription
--------------- ----------------------
5min @:00,:05,:10,:15,:20,:25,:30,:35,:40,:45,:50,:55
8hour @2:15,10:15,18:15
avUpdateSchedule @2:00
daily @0:10
hourly @:05
HourlyTimes @8:00,12:00,16:00,20:00
weekly Sun@0:15


5/8/2015 2:40:40 PM [60] Monad P:\> Get-NcSnapshotPolicy

Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
CDOT True {weekly (0), daily (2), hourly (6)}
default True {hourly (6), daily (2), weekly (2)}
none False


5/8/2015 2:41:17 PM [61] Monad P:\>

 

 

 

Which means it succeeded.

 

After the above steps do I need to apply the changes like what you've shown in your earlier response? I mean like this:

###################################################################################

The replacement for set-nasnapshotschedule isn't as straight forward. 

 

#Read in volume template to variable $readobj

$readobj = get-ncvol -Template

$readobj.Name = "volume"

$readobj.Vserver = "vserver"

$readobj

 

 

############ Write the volume attributes back

$writeobj=get-ncvol -Template

Initialize-NcObjectProperty $writeobj VolumeSnapshotAttributes

$writeobj.VolumeSnapshotAttributes.SnapshotPolicy=”snapshot_policy”

$writeobj

#Updates the volume in $readobj with the snapshot policy from $writeobj

update-NcVol -query $readobj -Attributes $writeobj

 

 

 

Again, thanks for your help.

 

Regards,

gmf

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

 

The 7-mode cmdlet that needs to be replaced is:

Set-NaSnapshotSchedule -TargetName $rVolumeName -Hours $rScheduleRetainHours -Days $rScheduleRetainDays -Weeks $rScheduleRetainWeeks -WhichHours $rScheduleHourlyTimes | Out-Null

 

I have come up with the following CDOT cmdlets to replace the above 7-mode command:

 

$SnapShotSchedule = '0 2 6@8,12,16,20'

$rScheduleRetainWeeks = ($Using:LocalParams.SnapshotSchedule).split(" ")[0]
$rScheduleRetainDays = ($Using:LocalParams.SnapshotSchedule).split(" ")[1]
$rScheduleRetainHours = ($Using:LocalParams.SnapshotSchedule).split(" ")[2].split("@")[0]
[int[]]$rScheduleHourlyTimes = ($Using:LocalParams.SnapshotSchedule).split("@")[1].split(",")

 

# Possible CDOT cmdlets replacement for the above command
Add-NcJobCronSchedule -Name HourlyTimes -Hour $rScheduleHourlyTimes
New-NcSnapshotPolicy -Name CDOT -Schedule weekly -Count $rScheduleRetainWeeks -Enabled $true
Add-NcSnapshotPolicySchedule -Name CDOT -Schedule daily -Count $rScheduleRetainDays
Add-NcSnapshotPolicySchedule -Name CDOT -Schedule hourly -Count $rScheduleRetainHours

 

# Define Volume template
$rVolTemplate = Get-NcVol -Template
$rVolTemplate.Name = $rVolumeName
$rVolTemplate

 

# Update the volume attributes
$rUpdateVol = Get-NcVol -Template
Initialize-NcObjectProperty $rUpdateVol VolumeSnapshotAttributes
$rUpdateVol.VolumeSnapshotAttributes.SnapshotPolicy="CDOT"
$rUpdateVol
Update-NcVol -Query $rVolTemplate -Attributes $rUpdateVol

 

 

5/11/2015 10:17:44 AM [14] Monad P:\> Update-NcVol -Query $rVolTemplate -Attributes $rUpdateVol -Verbose
VERBOSE: Modifying one or more volumes.


NcController : 10.127.135.70
SuccessCount : 0
FailureCount : 1
SuccessList : {}
FailureList : {vol0}

 

 

After executing the above commands in our simulator the "VolumeSnapshotAttributes" attribute is still empty, I noticed that the command does not return any error on the PowerShell console but the failure count value is 1. How can find out what the error message is?


Thanks.

 

Regards,

gmf

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

Hi @billyd,

 

Can you help me with my previous inquiry? I tried to update the volume with the new snapshot policy but it seems that  the  change did not take effect, the output shows a failurecount of 1 and FailureList point to vol0.

NcController : 10.127.135.70
SuccessCount : 0
FailureCount : 1
SuccessList : {}
FailureList : {vol0}

 

Thanks in advance.

 

Regards,

gmf

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

I believe you are receiving a failure because the vserver in the template is not defined.

# Define Volume template
$rVolTemplate = Get-NcVol -Template
$rVolTemplate.Name = $rVolumeName
$rVolTemplate

Add the following and define the $rVserverName variable.
$volTemplate.Vserver = $rVserverName

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

 

Hi @billyd,

 

Thanks for your reply.

 

We have the following vservers in our CDOT simulator:

5/14/2015 7:53:02 AM [96] Monad P:\> Get-NcVserver

Vserver State VserverType Comment
------- ----- ----------- -------
cha1nc101 admin The administrative vserver.
cha1sanfiler101 node

 

 

When I assigned the vserver to this value:

$rVolTemplate.Vserver="cha1sanfiler101"

5/14/2015 7:39:27 AM [72] Monad P:\> $rVolTemplate

Name State TotalSize Used Available Dedupe Aggregate Vserver
---- ----- --------- ---- --------- ------ --------- -------
vol0 cha1sanfiler101

 

and try to execute the command again it still failed

5/14/2015 7:40:16 AM [77] Monad P:\> Update-NcVol -Query $rVolTemplate -Attributes $rUpdateVol


NcController : 10.127.135.70
SuccessCount : 0
FailureCount : 1
SuccessList : {}
FailureList : {vol0}

 

 

Setting the vserver to another value:

 

5/14/2015 7:41:24 AM [79] Monad P:\> $rVolTemplate.Vserver="cha1nc101"
5/14/2015 7:41:56 AM [80] Monad P:\> $rVolTemplate

Name State TotalSize Used Available Dedupe Aggregate Vserver
---- ----- --------- ---- --------- ------ --------- -------
vol0 cha1nc101

 

When I execute the command Update-NcVol the SuccessCount and FailureCount value are still 0:

 

5/14/2015 7:42:00 AM [81] Monad P:\> Update-NcVol -Query $rVolTemplate -Attributes $rUpdateVol


NcController : 10.127.135.70
SuccessCount : 0
FailureCount : 0
SuccessList : {}
FailureList : {}

 

and the SnapshotPolicy attribute of the volume still has no value:

 

5/14/2015 7:42:19 AM [83] Monad P:\> Get-NcVol vol0 | select -ExpandProperty VolumeSnapshotAttributes


AutoSnapshotsEnabled :
NcController : 10.127.135.70
SnapdirAccessEnabled : True
SnapshotCloneDependencyEnabled : False
SnapshotCount :
SnapshotPolicy :
AutoSnapshotsEnabledSpecified : False
SnapdirAccessEnabledSpecified : True
SnapshotCloneDependencyEnabledSpecified : True
SnapshotCountSpecified : False

 

Can you advise what might be wrong on this?

 

Thanks in advance.

 

Regards,

gmf

 

 

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

vol0 is probably your node's root volume.  You won't be able to set the snapshot policy on node root volumes.  Use a volume on your vServer cha1sanfiler101 and it should work.  It worked for me:

 

$rVolumeName = "dfs_sccm"
$rVserverName = "nas" 

# Define Volume template
$rVolTemplate = Get-NcVol -Template
$rVolTemplate.Name = $rVolumeName
$rVolTemplate.Vserver = $rVserverName
$rVolTemplate

 

# Update the volume attributes
$rUpdateVol = Get-NcVol -Template
Initialize-NcObjectProperty $rUpdateVol VolumeSnapshotAttributes
$rUpdateVol.VolumeSnapshotAttributes.SnapshotPolicy="CDOT"
$rUpdateVol
Update-NcVol -Query $rVolTemplate -Attributes $rUpdateVol



 

 

NcController : 10.63.123.190
SuccessCount : 1
FailureCount : 0
SuccessList : {dfs_sccm}
FailureList : {}

 

 

 

(get-ncvol -Vserver nas -name dfs_sccm).VolumeSnapshotAttributes


AutoSnapshotsEnabled : True
NcController : 10.63.123.190
SnapdirAccessEnabled : True
SnapshotCloneDependencyEnabled : False
SnapshotCount : 11
SnapshotPolicy : CDOT
AutoSnapshotsEnabledSpecified : True
SnapdirAccessEnabledSpecified : True
SnapshotCloneDependencyEnabledSpecified : True
SnapshotCountSpecified : True


Re: CDOT PowerShell toolkit 3.2.1 cmdlets

 

I tried creating a new volume but failed with the below error:

 

5/15/2015 8:26:59 AM [116] Monad P:\> New-NcVol -Name TestCDOT -Aggregate a001vi15k01_cha1sanfiler101 -Size 1g -JunctionPath /vol1 -VserverRoot:$true
New-NcVol :
===================================================================================
| This cmdlet must be directed to a data vserver. You are currently connected |
| to the cluster admin vserver. See the Toolkit web docs (Show-NcHelp) or online |
| help (Get-Help Connect-NcController -Examples) to learn more about directing |
| Toolkit cmdlets to a cluster or data vserver as required by Data ONTAP. |
===================================================================================
At line:1 char:1
+ New-NcVol -Name TestCDOT -Aggregate a001vi15k01_cha1sanfiler101 -Size ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (10.127.135.70:NcController) [New-NcVol], Exception
+ FullyQualifiedErrorId : NcVserverCmdlet,DataONTAP.C.PowerShell.SDK.Cmdlets.Volume.NewNcVol

 

Currently we have no data vserver configured in our simulator, does this mean that we cannot create a new volume unless we create a new data vserver?

5/15/2015 8:27:33 AM [117] Monad P:\> Get-NcVserver

Vserver State VserverType Comment
------- ----- ----------- -------
cha1nc101 admin The administrative vserver.
cha1sanfiler101 node

 

Thanks @billyd. Appreciate it.

 

 

Regards,

gmf

Forums