Software Development Kit (SDK) and API Discussions
Software Development Kit (SDK) and API Discussions
At customer site:
When iterating through the tags for volume-get-iter we get strange errors.
E.g. returned by na_results_errno and na_results_reason after na_server_invoke:
Error:13001, PCDATA invalid Char value 18 .
Error:1, Extra content at the end of the document .
We asked the customer to run the ApiTest pgm with volume-get-iter to see if there was something strange in their settings.
There was:
<results status="passed">
<attributes-list>
<volume-attributes>
... (20 volumes elided)
</volume-attributes>
</attributes-list>
<next-tag><volume-get-iter-key-td>
<key-0>CIFS</key-0>
<key-1>veeam_repo1</key-1>
</volume-get-iter-key-td>
</next-tag>
<num-records>20</num-records>
</results>
The text in bold seems to be garabage. I have not been able to reproduce this behavior in our lab.
Does anyone have any input on this?
Adrian
The <next-tag> data is certainly not garbage, although it's not designed for human consumption. You requested 20 records in your query (default, see max-records if you want to request more) but there are more than 20 records that match your query so the output has been "paged". <next-tag> is the pointer to the next page of results, which you can feed back into another volume-get-iter as the "tag" input. As long as you have a <next-tag> returned, you still have more results to process. If there is no <next-tag>, you have fetched all your records. All *-iter APIs should support max-records and tag/next-tag.
So that doesn't solve your real issue but hopefully you understand what <next-tag> is now.
OK. I knew about the next-tag but was just surprised by getting unprocessed xml entities from ApiTest.
I found the bug in my code, wrong scoping for the return value from na_server_invoke.
Thanks.
Hi,
Same here by calling luns, have you resolvd this issue?
Thanks
Here it something i wrote a while back (lil more than 4 years..) in perl.
#Collecting CDOT Volume Information and Storing in perl hash %volinfo: my $volapi = new NaElement('volume-get-iter'); $volapi->child_add_string('max-records','999'); my $xi = new NaElement('query'); $volapi->child_add($xi); my $xi1 = new NaElement('volume-attributes'); $xi->child_add($xi1); my $xi3 = new NaElement('desired-attributes'); $volapi->child_add($xi3); my $xi4 = new NaElement('volume-attributes'); $xi3->child_add($xi4); my $xi5 = new NaElement('volume-id-attributes'); $xi4->child_add($xi5); my $xi6 = new NaElement('volume-state-attributes'); $xi4->child_add($xi6); my $xi7 = new NaElement('volume-space-attributes'); $xi4->child_add($xi7); my $xi8 = new NaElement('volume-inode-attributes'); $xi4->child_add($xi8); my $outv = $ss->invoke_elem($volapi); if ($outv->results_status() eq 'failed') { print ((caller(0))[3], $filer, $outv->results_reason(), "\n"); } else { my $nor = $outv->child_get_string("num-records"); if ($nor > 0 ) { my @volattr = $outv->child_get("attributes-list")->children_get("volume-attributes"); foreach my $vol (@volattr) { my $volidattr = $vol->child_get("volume-id-attributes"); my $volspattr = $vol->child_get("volume-space-attributes"); my $volstattr = $vol->child_get("volume-state-attributes"); my $volinattr = $vol->child_get("volume-inode-attributes"); if ($volidattr and $volstattr and $volspattr and $volinattr) { my $volname = $volidattr->child_get_string("name"); my $volid = join (":", $na, $volname); $volinfo{$volid}{'volid'} = $volid; $volinfo{$volid}{'uuid'} = $volidattr->child_get_string("uuid"); $volinfo{$volid}{'name'} = $volidattr->child_get_string("name"); $volinfo{$volid}{'type'} = $volidattr->child_get_string("type"); $volinfo{$volid}{'containingAggr'} = $volidattr->child_get_string("containing-aggregate-name"); $volinfo{$volid}{'junctionPath'} = $volidattr->child_get_string("junction-path"); $volinfo{$volid}{'state'} = $volstattr->child_get_string("state"); $volinfo{$volid}{'sizeTotal'} = $volspattr->child_get_int("size-total"); $volinfo{$volid}{'sizeUsed'} = $volspattr->child_get_int("size-used"); $volinfo{$volid}{'sizeAvailable'} = $volspattr->child_get_int("size-available"); $volinfo{$volid}{'percentageUsed'} = $volspattr->child_get_int("percentage-size-used"); $volinfo{$volid}{'filesTotal'} = $volinattr->child_get_int("files-total"); $volinfo{$volid}{'filesUsed'} = $volinattr->child_get_int("files-used"); $volinfo{$volid}{'filer'} = $filer; } } } }
hope this helps...