Software Development Kit (SDK) and API Discussions

SDK Snapshot size reporting

krutaw
3,727 Views

Working with the perl SDK and attempting to determine the actual size of each snapshot in a given volume.  Unfortunately, the SDK is reporting wildly varying sizes in comparison with CLI.  

 

Export from CLI:

 

FILERNAME::> volume snapshot show -volume *********

                                                                 ---Blocks---

Vserver  Volume   Snapshot                                  Size Total% Used%

-------- -------- ------------------------------------- -------- ------ -----

*********_01

         ********_dv01

                  weekly.2016-07-31_0015                 118.2GB     1%    4%

                  weekly.2016-08-07_0015                 33.94GB     0%    1%

 

 

Export on the exact same snapshots via the SDK:

 

Snapshot name: weekly.2016-07-31_0015
AFS used: n/a
Compression savings: n/a
Cumulative percent of total blocks: 3
Cumulative percent of used blocks: 11
Cumulative total size: 383158032
Dedup savings: n/a
Percentage of total blocks: 1
Percentage of used blocks: 4
Total size: 123914508
vbn0-savings:
----------
Snapshot name: weekly.2016-08-07_0015
AFS used: n/a
Compression savings: n/a
Cumulative percent of total blocks: 2
Cumulative percent of used blocks: 8
Cumulative total size: 259243524
Dedup savings: n/a
Percentage of total blocks: n/a
Percentage of used blocks: 2
Total size: 62664036
vbn0-savings:

 

 

The first snapshot is very, very close in the "total" size column.  But the second snapshot is dramatically different.

 

Excerpt from code:

 

my $xi = new NaElement('desired-attributes');
$snap_iterator->child_add($xi);
my $xi1 = new NaElement('snapshot-info');
$xi->child_add($xi1);
$xi1->child_add_string('afs-used','afs-used');
$xi1->child_add_string('compress-savings','compress-savings');
$xi1->child_add_string('cumulative-percentage-of-total-blocks','cumulative-percentage-of-total-blocks');
$xi1->child_add_string('cumulative-percentage-of-used-blocks','cumulative-percentage-of-used-blocks');
$xi1->child_add_string('cumulative-total','cumulative-total');
$xi1->child_add_string('dedup-savings','dedup-savings');
$xi1->child_add_string('name','name');
$xi1->child_add_string('percentage-of-total-blocks','percentage-of-total-blocks');
$xi1->child_add_string('percentage-of-used-blocks','percentage-of-used-blocks');
$xi1->child_add_string('total','total');
$xi1->child_add_string('vbn0-savings ','vbn0-savings');
$xi1->child_add_string('volume','volume');
$xi1->child_add_string('access-time','access-time');

 

....

 

if ($vol_name eq "SPECIFIC_NAME_HERE") {
unless(grep(/$vol_name/, @snapmirrors)){
my $afs_used = "n/a";
my $comp_savings = "n/a";
my $cumulative_perc_total_blocks = "n/a";
my $cumulative_perc_used_blocks = "n/a";
my $cumulative_total = "n/a";
my $dedup_savings = "n/a";
my $snap_name = $snap->child_get_string("name");
my $perc_total_blocks = "n/a";
my $perc_used_blocks = "n/a";
my $snap_size = $snap->child_get_string("total");


my $vbn0_savings = "";
if ($snap->child_get_string("compress-savings")) {
$comp_savings = $snap->child_get_string("compress-savings");
}
if ($snap->child_get_string("dedup-savings")) {
$dedup_savings = $snap->child_get_string("dedup-savings");
}
if ($snap->child_get_string("vbn0-savings")) {
$vbn0_savings = $snap->child_get_string("vbn0-savings");
}
if ($snap->child_get_string("cumulative-percentage-of-used-blocks")) {
$cumulative_perc_used_blocks = $snap->child_get_string("cumulative-percentage-of-used-blocks");
}
if ($snap->child_get_string("cumulative-percentage-of-total-blocks")) {
$cumulative_perc_total_blocks = $snap->child_get_string("cumulative-percentage-of-total-blocks");
}
if ($snap->child_get_string("percentage-of-total-blocks")) {
$perc_total_blocks = $snap->child_get_string("percentage-of-total-blocks");
}
if ($snap->child_get_string("percentage-of-used-blocks")) {
$perc_used_blocks = $snap->child_get_string("percentage-of-used-blocks");
}
if ($snap->child_get_string("cumulative-total")) {
$cumulative_total = $snap->child_get_string("cumulative-total");
}


print "Snapshot name: ".$snap_name."\r\n";
print "AFS used: ".$afs_used."\r\n";
print "Compression savings: ".$comp_savings."\r\n";
print "Cumulative percent of total blocks: ".$cumulative_perc_total_blocks."\r\n";
print "Cumulative percent of used blocks: ".$cumulative_perc_used_blocks."\r\n";
print "Cumulative total size: ".$cumulative_total."\r\n";
print "Dedup savings: ".$dedup_savings."\r\n";
print "Percentage of total blocks: ".$perc_total_blocks."\r\n";
print "Percentage of used blocks: ".$perc_used_blocks."\r\n";
print "Total size: ".$snap_size."\r\n";
print "vbn0-savings: ".$vbn0_savings."\r\n";
print "----------\r\n";

 

 

 

 

Okay, so I obviously didn't include all of the code, but I think that's enough to get the gist.  So, is this a bug or did I just miss something obvious?

 

2 REPLIES 2

francoisbnc
3,687 Views

I experienced the same playing with cumulative-total size with sdk.

 

This is caused as the ZAPI response received cumulative totals associated with each snapshot. The cumulative total values calculated by Data ONTAP are reset after every 25th snapshot
The issue  is explained in the following bug: http://mysupport.netapp.com/NOW/cgi-bin/bol?Type=Detail&Display=955836

 

I had to use snapshot total and summarize cumul in a loop to fix that.

 

hope that help,

François

krutaw
3,457 Views

Sorry for the delayed response.  Excellent idea, worked like a charm.  Thanks for that! 🙂


@francoisbnc wrote:

I experienced the same playing with cumulative-total size with sdk.

 

This is caused as the ZAPI response received cumulative totals associated with each snapshot. The cumulative total values calculated by Data ONTAP are reset after every 25th snapshot
The issue  is explained in the following bug: http://mysupport.netapp.com/NOW/cgi-bin/bol?Type=Detail&Display=955836

 

I had to use snapshot total and summarize cumul in a loop to fix that.

 

hope that help,

François




Public