#API wierdness...

1 messages · Page 1 of 1 (latest)

cinder rampart
#

I'm trying to write a simple script that looks at snapshots on a set of volumes, and gathers things like (number of snapshots, latest snapshot, oldest snapshot).
For each snapshot I would like things like Name, AccessTime(snap create time), SnapLockExpiryTime, SnapMirrorLabel)...
Sounds simple... but it seems that the API still seems to have a lot of the old issue that I used to fight with in the past...
I start with:
Get-NcSnapshot -vserver blah -volume volblah | Select Name, AccessTime, SnapLockExpiryTime, SnapMirrorLabel

I then run the resulting object via this:
$Snapshots | Where-Object -Property Name -NotLike "snapmirror*" | Sort-Object -Property AccessTime | Select-Object -Last 1

To get the latest snapshot and replace "-Last" with "-First" to get the oldest snapshot.

`Name : 6hourly.2025-12-09_1816
AccessTime : 2025-12-09T15:16:01+01:00
SnaplockExpiryTime : 1765793323
SnapmirrorLabel : 6hourly

Name : Au NFS01_08-02-2025_00.00.03.0255
AccessTime : 2025-08-02T00:00:19+02:00
SnaplockExpiryTime : 1762009548
SnapmirrorLabel : daily`

Problem is, this takes forever. And notice that the two versions of time that is returned... just beautiful ?

#

Now the thing that takes the most time is the "Get-NcSnapshot"... and then the Connect-NcController...
Not actually sure why the "Connect..." takes 3-5 secs. ?
I know that I would add the infamous "-ZapiCall" to the "Get-NcSnapshot" to speed things up... but then the values change...
So the AccessTime is now a unixtime like "1754085619" like "SnapLockExpiryTime" at least this is consistent here... But the "SnapmirrorLabel" is blank....
So is't that just great? 🙄

Is it just me that run into these simple issues?
I'm running version 9.16.1.2501 of the PowerShellToolkit...
Does anyone have an idea to speed up any of this?
Because this script will take hours to complete on the systems, which is just crazy when I could just go an run "set rows 0; snapshot show -instance" and and process that output instead, and it would be way faster...

But maybe I'm using it wrong? 😂

long fern
#

what do you mean by "two versions of time are returned"? You mean the timestamp in the snapshot name and the access time? Those are not necessarily the same