Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
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
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
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
Hi,
What is the equivalent cmdlet for Set-NaSnapshotSchedule on cDOT? Is it Set-NcSnapshotPolicySchedule?
Thanks in advance.
gmf
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
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
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)}
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
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
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
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.
How can we use Get-NaQuotaEntry
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
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
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
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
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
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
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
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
Just create a new vserver and you'll be set to test. Here's an example. You may need to create a new aggregate and can use New-NcAggregate to create that if you need it.
PS C:\scripts> Get-NcVserver Vserver State VserverType Comment ------- ----- ----------- ------- billyd-cl1 admin The administrative vserver. nas running data nasdr running data billyd-cl1-01 node billyd-cl1-02 node PS C:\scripts> Get-NcAggr Name State TotalSize Used Available Disks RaidType RaidSize Volumes ---- ----- --------- ---- --------- ----- -------- -------- ------- aggr0 online 7.0 GB 51% 3.5 GB 4 raid_dp, normal 16 1 aggr0_billyd_cl1_02_0 online 7.0 GB 73% 1.9 GB 4 raid_dp, normal 16 1 n01_aggr online 161.7 GB 12% 142.5 GB 50 raid_dp, normal 25 9 PS C:\scripts> New-NcVserver -name cdot_test -RootVolume root_cdot_test -RootVolumeAggregate n01_aggr -RootVolumeSecurityStyle ntfs -NameServerSwitch file,ldap,nis Vserver State VserverType Comment ------- ----- ----------- ------- cdot_test running data PS C:\scripts> PS C:\scripts> Get-NcVserver Vserver State VserverType Comment ------- ----- ----------- ------- billyd-cl1 admin The administrative vserver. cdot_test running data nas running data nasdr running data billyd-cl1-01 node billyd-cl1-02 node