Microsoft Virtualization Discussions

SnapShot Status in Perl

I am writing a Perl script to automate attaching a SnapManager SnapShot as a drive on a server.

I have most of the command working, but I need to confirm the snapshot is not currently in use by SnapMirror.

Based on the code below, how do I get the SnapShot status?

my $result = $s->invoke("snapshot-list-info", volume => $Volume);
if ($result->results_errno != 0) {
  print "\nError Code: " . $result->results_errno . " - " . $result->results_reason() . "\n";
  return (-1);
my $snapshotlist = $result->child_get("snapshots");
if (!defined($snapshotlist) || ($snapshotlist eq "")) {
  printf("No snapshots on volume %s\n\n", $parent_vol_name);
  return (-1);
my @snapshots = $snapshotlist->children_get();
my $tmp = 0;
my $snapshot;
my $snap;
foreach my $ss (@snapshots) {
  $MName = $ss->child_get_string("name");
  $MTime = $ss->child_get_int("access-time", 0);
  $MStatus = $ss->child_get_string("state");  ######### this is the value I am not able to get

Thank You,



Re: SnapShot Status in Perl


I think you are looking for the 'busy' child element of snapshot-info.

$MStatus = $ss->child_get_string("busy");

The raw results back from ONTAP look like this:



View solution in original post

Re: SnapShot Status in Perl

Thank you Ryan.

Through trial and error I was able to figure out that I needed to use "busy" last night.  Thank you for the quick reply and sample output.


Cloud Volumes ONTAP
Review Banner
All Community Forums