Microsoft Virtualization Discussions

NetApp_PowerShell_Toolkit_4.3.0.msi can´t list SnapMirrorLabels in Ontap 9.1

Mannes
12,429 Views

Hello all together,

 

we check by our customers over powershell the snapshots with snapmirrorlabels daily, weekly and so on..

By systems running DataOntap 8.3x the output are with snapmirrorlabels.

 

By DataOntap 9.1 we don´t get the snapmirrorlabels over the powershell.

The outputs for the snapmirrorlabels over Powershell is "unknown".

 

We checked the output over the ssh session and we see the correct labels but Powershell doesn´t work. We use the Toolkit Version 4.3.

 

Have you got any idea to solve this issue in the toolkit?

 

Regards

 

1 ACCEPTED SOLUTION

asulliva
11,993 Views

Doing some tests against my ONTAP 9.0 cluster it appears that the behavior of ZAPI changed at some point.  The SnapMirror labels are not returned by ZAPI by default.  If a ZAPI request is issued which explicitly requests the snapmirror-label field in the desired-attributes field then the value is returned.

 

I'm going to ask internally, but I believe this is a bug in ZAPI.  I'm not sure if the correct fix will need to happen in ZAPI or in the PowerShell module.  As a workaround, you can force the request for the property using this syntax:

 

Get-NcVol $volName | Get-NcSnapshot -Attributes @{ "snapmirrorlabel" = "" } | Select-Object Name,SnapmirrorLabel

Hope that helps.

 

Andrew

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

View solution in original post

12 REPLIES 12

asulliva
12,052 Views

Hello @Mannes,

 

Can you provide more details?  In particular, what is the PowerShell you're using, the output you're getting, and the output you expect.

 

Thank you.

 

Andrew

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

Mannes
11,994 Views

Hello Andrew,

 

we are using Powershell Version 5.0.10586.117 on a Windows Server 2008 R2 Standard.

The Powershell Toolkit is 4.3 - the latest in the download from ToolChest

 

 

We start on two customer sites the same scripts

 

$Snaps = Get-NcSnapshot -Volume vmware

$Snaps | Format-Table -Property Volume,Name,SnapmirrorLabel -auto

 

On a Cluster with DataOntap 8.3.2P5 we can see the SnapMirrorLabels on the SnapShots like Daily

On a Cluster with DataOntap 9.1 we can´t see SnapMirrorLabels on the SnapShots. There is no entry.

 

regards

 

Jürgen

 

 

 

asulliva
11,994 Views

Doing some tests against my ONTAP 9.0 cluster it appears that the behavior of ZAPI changed at some point.  The SnapMirror labels are not returned by ZAPI by default.  If a ZAPI request is issued which explicitly requests the snapmirror-label field in the desired-attributes field then the value is returned.

 

I'm going to ask internally, but I believe this is a bug in ZAPI.  I'm not sure if the correct fix will need to happen in ZAPI or in the PowerShell module.  As a workaround, you can force the request for the property using this syntax:

 

Get-NcVol $volName | Get-NcSnapshot -Attributes @{ "snapmirrorlabel" = "" } | Select-Object Name,SnapmirrorLabel

Hope that helps.

 

Andrew

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

Mannes
11,936 Views

Hello Andrew,

 

Great - Thank you for this workaround.

 

i hope that bug will be fixed as soon as possible, but with this workaround we have a solution at this time.

 

Regards

mark_schuren
11,745 Views

+1 here.

 

How do I request more than only the SnapmirrorLabel attribute with Get-NcSnapshot in PSTK 4.3 in one query?

 

This works:

 

$snaps = Get-NcSnapshot -Volume "testvol" -Attributes @{ "snapmirrorlabel" = "" }

 

but populates only the label property.

 

This doesn't work:

 

$snaps = Get-NcSnapshot -Volume "testvol" -Attributes @{ "snapmirrorlabel" = ""; "created" = "" }

Get-NcSnapshot : Der Parameter "Attributes" kann nicht gebunden werden. Objekt vom Typ "DataONTAP.C.Types.Snapshot.SnapshotInfo. "AccessTimeDT" ist eine ReadOnly-Eigenschaft."
kann nicht erstellt werden.
In Zeile:1 Zeichen:64
+ ... testvol" -Attributes @@{ "snapmirrorlabel" = ""; "created" = ""}
+                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-NcSnapshot], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,DataONTAP.C.PowerShell.SDK.Cmdlets.Snapshot.GetNcSnapshot

 

Will a fix be included in PSTK 4.4 and when?

 

Regards,

Mark

asulliva
11,713 Views

Hello @mark_schuren,

 

Certain fields in the output object from PSTK are not returned by ZAPI, but rather created by PSTK to make life easier for us as users.  Created is one of those fields.  When PSTK receives a ZAPI response which includes the "AccessTime" property it calculates/creates and populates the properties "Created" and "AccessTimeDT" (and of course "AccessTime") in the object returned.

 

We can determine this using the Get-Member cmdlet for the snapshot object:

 

PS C:\Users\asull> Get-NcSnapshot -Template | Get-Member


   TypeName: DataONTAP.C.Types.Snapshot.SnapshotInfo

Name                                       MemberType    Definition                                                              
----                                       ----------    ----------                                                              
Created                                    AliasProperty Created = AccessTimeDT                                                  
Cumulative                                 AliasProperty Cumulative = CumulativeTotal                                            
Equals                                     Method        bool Equals(System.Object obj)                                          
GetHashCode                                Method        int GetHashCode()                                                       
GetType                                    Method        type GetType()                                                          
ToString                                   Method        string ToString()                                                       
Validate                                   Method        void Validate()                                                         
AccessTime                                 Property      System.Object AccessTime {get;set;}                                     
AccessTimeDT                               Property      System.Nullable[datetime] AccessTimeDT {get;}                           
AccessTimeSpecified                        Property      bool AccessTimeSpecified {get;set;}                                     
Busy                                       Property      System.Nullable[bool] Busy {get;set;}                                   
BusySpecified                              Property      bool BusySpecified {get;set;}                                           
Comment                                    Property      System.Object Comment {get;set;}                                        
CompressionType                            Property      System.Object CompressionType {get;set;}                                
ContainsLunClones                          Property      System.Nullable[bool] ContainsLunClones {get;set;}                      
ContainsLunClonesSpecified                 Property      bool ContainsLunClonesSpecified {get;set;}                              
CumulativePercentageOfTotalBlocks          Property      System.Object CumulativePercentageOfTotalBlocks {get;set;}              
CumulativePercentageOfTotalBlocksSpecified Property      bool CumulativePercentageOfTotalBlocksSpecified {get;set;}              
CumulativePercentageOfUsedBlocks           Property      System.Object CumulativePercentageOfUsedBlocks {get;set;}               
CumulativePercentageOfUsedBlocksSpecified  Property      bool CumulativePercentageOfUsedBlocksSpecified {get;set;}               
CumulativeTotal                            Property      System.Nullable[long] CumulativeTotal {get;}                            
CumulativeTotalBlocks                      Property      System.Object CumulativeTotalBlocks {get;set;}                          
CumulativeTotalSpecified                   Property      bool CumulativeTotalSpecified {get;set;}                                
Dependency                                 Property      System.Object Dependency {get;set;}                                     
ExpiryTime                                 Property      System.Object ExpiryTime {get;set;}                                     
ExpiryTimeDT                               Property      System.Nullable[datetime] ExpiryTimeDT {get;set;}                       
ExpiryTimeSpecified                        Property      bool ExpiryTimeSpecified {get;set;}                                     
InfiniteSnaplockExpiryTime                 Property      System.Nullable[bool] InfiniteSnaplockExpiryTime {get;set;}             
InfiniteSnaplockExpiryTimeSpecified        Property      bool InfiniteSnaplockExpiryTimeSpecified {get;set;}                     
InofileVersion                             Property      System.Object InofileVersion {get;set;}                                 
InofileVersionSpecified                    Property      bool InofileVersionSpecified {get;set;}                                 
Is7ModeSnapshot                            Property      System.Nullable[bool] Is7ModeSnapshot {get;set;}                        
Is7ModeSnapshotSpecified                   Property      bool Is7ModeSnapshotSpecified {get;set;}                                
IsConstituentSnapshot                      Property      System.Nullable[bool] IsConstituentSnapshot {get;set;}                  
IsConstituentSnapshotSpecified             Property      bool IsConstituentSnapshotSpecified {get;set;}                          
Name                                       Property      System.Object Name {get;set;}                                           
NcController                               Property      NetApp.Ontapi.Filer.C.NcController NcController {get;set;}              
PercentageOfTotalBlocks                    Property      System.Object PercentageOfTotalBlocks {get;set;}                        
PercentageOfTotalBlocksSpecified           Property      bool PercentageOfTotalBlocksSpecified {get;set;}                        
PercentageOfUsedBlocks                     Property      System.Object PercentageOfUsedBlocks {get;set;}                         
PercentageOfUsedBlocksSpecified            Property      bool PercentageOfUsedBlocksSpecified {get;set;}                         
SnaplockExpiryTime                         Property      System.Object SnaplockExpiryTime {get;set;}                             
SnaplockExpiryTimeDT                       Property      System.Nullable[datetime] SnaplockExpiryTimeDT {get;set;}               
SnaplockExpiryTimeSpecified                Property      bool SnaplockExpiryTimeSpecified {get;set;}                             
SnapmirrorLabel                            Property      System.Object SnapmirrorLabel {get;set;}                                
SnapshotInstanceUuid                       Property      System.Object SnapshotInstanceUuid {get;set;}                           
SnapshotOwnersList                         Property      DataONTAP.C.Types.Snapshot.SnapshotOwner[] SnapshotOwnersList {get;set;}
SnapshotVersionUuid                        Property      System.Object SnapshotVersionUuid {get;set;}                            
State                                      Property      System.Object State {get;set;}                                          
Total                                      Property      System.Nullable[long] Total {get;}                                      
TotalBlocks                                Property      System.Object TotalBlocks {get;set;}                                    
TotalSpecified                             Property      bool TotalSpecified {get;set;}                                          
Volume                                     Property      System.Object Volume {get;set;}                                         
VolumeProvenanceUuid                       Property      System.Object VolumeProvenanceUuid {get;set;}                           
Vserver                                    Property      System.Object Vserver {get;set;} 

Notice how Created and Cumulative properties are both aliases.

 

The easiest way to get what you're asking for is to simply specify both the SnapmirrorLabel and AccessTime properties...

 

Get-NcVol $volume | Get-NcSnapshot -SnapName $snapshot -Attributes @{ AccessTime = ""; SnapmirrorLabel = "" } | Format-List

You could also use template objects if desired...

 

$template = Get-NcSnapshot -Template
$template.AccessTime = ""
$template.SnapmirrorLabel = ""

Get-NcVol $volume | Get-NcSnapshot -SnapName $snapshot -Attributes $template | Format-List

Finally, it's imperfect, but you can attempt to specify that all fields should be returned using this bit of script:

 

$template = Get-NcSnapshot -Template

$template.psobject.Properties | ?{ $_.IsGettable -eq $true -and $_.IsSettable -eq $true } | %{
    $property = $_.Name 

    try {
        $template.($property) = $true
    } catch {
        $template.($property) = $null
    }
}

Get-NcVol $volume | Get-NcSnapshot -SnapName $snapshot -Attributes $template | Format-List

Note that it simply guesses as to an acceptable value for the property in order to force it to be returned by PSTK.

 

Hope that helps.

 

Andrew

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

mark_schuren
11,702 Views

Thanks a lot. Works for me Smiley Happy

dietermann
11,542 Views

Hello @asulliva,

 

very intriguing workaround, but when I try to find the snapmirror label and the creation time of a snapshot with this ZAPI access method  I either get an unreadable integer for AccessTime or an "Cannot bind parameter" for AccessTimeDT  

 

PS:> (get-ncsnapshot <vol> -SnapName <snap> -Attributes @{ "AccessTime"="";"snapmirrorlabel"=""}).AccessTime
1493143910


PS:> (get-ncsnapshot <vol> -SnapName <snap> -Attributes @{ "AccessTimeDT"="";"snapmirrorlabel"=""}).AccessTimeDT

Get-NcSnapshot : Cannot bind parameter 'Attributes'. Cannot create object of type "DataONTAP.C.Types.Snapshot.SnapshotInfo". "AccessTimeDT" is a ReadOnly

property.
At line:1 char:116
+ ... up -Attributes @{ "AccessTimeDT"="";"snapmirrorlabel"=""}).AccessTimeDT
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-NcSnapshot], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,DataONTAP.C.PowerShell.SDK.Cmdlets.Snapshot.GetNcSnapshot

 

Is there another possibility to get both values in one API-call?

 

Kind regards

 

Matthias

 

 

PS: I would also prefer a DataOntap Powershell Module with a bugfix.

 

mark_schuren
11,529 Views

Hello Matthias,

 

Just treat the AccessTime integer value as seconds (add to UNIX epoch time) to get a DateTime value.

 

Since PSToolkit's API wrapper is not working reliably with SM-Labels, I more or less retrieve the raw API values I need using the bove workaround, and then handle formatting myself where needed. I did it like this (just a very simple example):

 

[datetime]$origin = '1970-01-01 00:00:00'
Get-NcSnapshot -Attributes @{ AccessTime = ""; SnapmirrorLabel = ""} | % {
    $_.Name; $origin.AddSeconds($_.AccessTime); $_.SnapmirrorLabel
}

 

It's not nice, but works for me.

 

HTH,

Mark

dietermann
8,573 Views

Hello Mark,

 

thank you for the explanation. I didnt recognize the UNIX format. Yor formula is helpful indeed.

 

KInd regards,

 

Matthias

NADRS
8,237 Views

I've run the api via the zexplore tool in the nmsdk version 5.7 and api version 1.110. The labels are being correctly returned - I would say its actually an issue in the toolskits dll wrapping the api calls causing the issue.

 

Also 4.30 isnt the latest - has any one tried with v4.4 of the toolkit?

 

NADRS
8,228 Views

Now tested against 4.2, 4.3 and 4.4 of the powershell toolkit and the bug exists in all.

 

Directly invoking the api call via Invoke-NcSystemApi does work though and is an alternative method to that in the solution.

 

 

Public