Microsoft Virtualization Discussions

Highlighted

CDOT PowerShell toolkit 3.2.1 cmdlets

Hi All,

 

NetApp newbie here.

 

In the coming month we're going to implement CDOT in our environment, we're currently using the previous version and we have lots of scripts in Orchestrator that uses PowerShell toolkit for provisioning server storage. It's my tasks to review the old scripts we're using and to modify the scripts to adapt it to the new cmdlets introduced in PowerShell toolkit 3.2. I reviewed the documentation and release notes and found out that most of the command have been renamed (actually they set aliases on the psm1 file) to for example Get-Naxxx to Get-Ncxxx. But there are other cmdlets that I cannot find in PowerShell toolkit 3.2.1 like Get-NaSnapmirrorSchedule. while other cmdlets like Get-NaSystemInfo has been renamed to Get-NcNodeInfo in CDOT.


Is there any particular list of updated cmdlets or cmdlets that have been remove that I can review to be able to find out those old cmdlets that we cannot use when moving our scripts to CDOT? Or do I just need to modify the commands to use xxx-Ncxxx instead of xxx-Naxxx? 

 

Thanks in advance.

 

Regards,

gmf

 

21 REPLIES 21
Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

Hi,

 

You'll need to update your code to work with Clustered DataONTAP. The CmdLet names are *-nc*. This should give you a quick list of what CmdLets you have to work with

 

>Import-Module DataONTAP

>Get-Command -Module dataontap -Name *-nc* | Where-Object {$_.CommandType -eq "CmdLet"} | Select-Object -Property Name

 

And if there isn't an existing CmdLet to perform as a configuration task or query you can always use "Invoke-NcSsh". There are Functional and architecture differences between 7-Mode and cDOT, you will need to thrououghly review and update your code. If you have any trouble converting code to achieve the same results in cDOT as you are currently using on 7-Mode please post the code and i'll take a look.

 

/matt 

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

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

Thanks for the quick response Matt. 

 

I'll review the codes in our script and report any cmdlets from 7-mode that do not have same capability in cDOT.

 

Regards,

gmf

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

Hi,

 

What is the equivalent cmdlet for Set-NaSnapshotSchedule on cDOT? Is it Set-NcSnapshotPolicySchedule?

 

Thanks in advance.

 

gmf

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

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

 

 

 

 

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

Thanks for the quick response.

 

I modified our orchestrator runbook scripts to add support for the cDOT, I replace the 7mode cmdlets with the cDOT counterpart by referencing the Data ONTAP PowerShell toolkit release notes and comparing the 7mode cmdlets with the cDOT cmdlets. I basically replaced the following 7mode cmdlets with the cDOT counterpart, can you please check if there are any cmdlets here that is not a direct replacements when implementing cDOT?

 

 

Add-NaLunMap                        Add-NcLunMap
Connect-NaController             Connect-NcController
Get-NaSystemInfo                   Get-NcNodeInfo
Get-NaAggr                              Get-NcAggr
Get-NaVol                                Get-NcVol
Get-NaLun                                Get-NcLun
Get-NaQtree                            Get-NcQtree
Get-NaIgroup                           Get-NcIgroup
New-NaVol                               New-NcVol
New-NaQtree                           New-NcQtree
New-NaLun                               New-NcLun
Set-NaVolOption                      Set-NcVolOption
Set-NaSnapshotReserve          Set-NcSnapshotReserve
Set-NaVolAutosize                   Set-NcVolAutosize
Set-NaSnapshotAutodelete     Set-NcSnapshotAutodelete
Set-NaLunComment                 Set-NcLunComment
Set-NaVol                                 Set-NcVol

 

 

Thanks in advance.

 

 

gmf

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

You'll need to add the -vserver parameter for each CDOT command.  There may be other differences between each individual command.  If you don't have access to a CDOT cluster for testing, you may want to look into setting up the CDOT simulator for testing:

 

http://mysupport.netapp.com/NOW/cgi-bin/simulator

 

 

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

 

We now have a cluster simulator so I can play with it. I'm not the one who created our scripts for 7mode and I don't have advance knowledge regarding NetApp but my PowerShell skills is advance so I can understand what the 7mode scripts are trying to do. With regards to vserver I only find about it when reading the PowerShell toolkit release notes, can you point me to a documentation regarding vserver to be able to find out what it's all about?

Thanks billy.

 

 

Regards,

gmf

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

Some of the parameters have been renamed like for example in New-NaLun -Type parameter, in CDOT this parameter has been renamed to -OsType. I'm reviewing each 7mode cmdlets including their parameters when replacing it with the CDOT cmdlets counterpart. 

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

The cmdlets I need to replace is Set-NaSnapshotSchedule which is shown below:

# Snapshot schedule (space delimited cron format, <WeekliesToRetain> <DailiesToRetain> <HourliesToRetain>@<Which,Hours>)
# Assumes all schedule components are specified
$SchduleRetainWeeks = $SnapshotSchedule.split(" ")[0]
$SchduleRetainDays = $SnapshotSchedule.split(" ")[1]
$SchduleRetainHours = $SnapshotSchedule.split(" ")[2].split("@")[0]
$SchduleHourlyTimes = $SnapshotSchedule.split("@")[1]
Set-NaSnapshotSchedule -TargetName $VolumeName -Hours $SchduleRetainHours -Days $SchduleRetainDays -Weeks $SchduleRetainWeeks -WhichHours $SchduleHourlyTimes | Out-Null

 

On you sample solution, I cannot see where to define the schedule for hours, days and weeks. How can I define that using update-NcVol?

 

From our CDOT simulator I can query the volume and get the VolumeSnapshotAttributes, but how can I set the SnapshotPolicy property on this and what is the value that the cmdlet is expecting?

5/7/2015 1:58:55 PM [6] Monad P:\> Get-NcVol | select -ExpandProperty VolumeSnapshotAttributes


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

 

 

Thanks in advance.

 

gmf

 

 

 

 

Highlighted

Re: CDOT PowerShell toolkit 3.2.1 cmdlets

How can we use Get-NaQuotaEntry 

Highlighted

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)}

 

 

Highlighted

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

Highlighted

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

Highlighted

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

Highlighted

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

Check out the KB!
Knowledge Base
All Community Forums