Software Development Kit (SDK) and API Discussions

volume-get-iter error when retrieving volume attributes

tom_yuyitung
2,385 Views

I am using Ontap API and I am talking to 7-Mode NetApp filer. I am able to get a list of volumes, but I cannot figure out how to get volume attributes. I tried to use VolumeGetIterResponse class, here is a code snippet

VolumeGetIterRequest volumeGetIter = new VolumeGetIterRequest();
volumeGetIter.setMaxRecords(100);
List<VolumeAttributes> volAttributes = volumeGetIterResponse.getAttributesList();
for (VolumeAttributes vas : volAttributes) {
VolumeExportAttributes vs = vas.getVolumeExportAttributes();
}


When running this code, I get error:
Unable to find API: volume-get-iter
Please point me where I am wrong, your help is highly appreciated

1 REPLY 1

robinpeter
2,370 Views

There is no  "volume-get-ltr" call in 7-Mode ontapi 

 

this is what i used a while back... while i muck around with 7-mode system.

 

    #Collecting 7Mode Volume Information and Storing in Perl %volinfo:
    my $outv = $ss->invoke( "volume-list-info" );
    if ($outv->results_status() eq "failed"){
        print ((caller(0))[3], $filer, $outv->results_reason(), "\n");
    } else {
        my $volume_info = $outv->child_get("volumes");
        my @result = $volume_info->children_get();
        foreach my $vol (@result){
            my $volname                                 = $vol->child_get_string("name");
            my $volid                                   = join (":", $filer, $volname);
            $volinfo{$volid}{'volid'}                   = $volid;
            $volinfo{$volid}{'uuid'}                    = $vol->child_get_string("uuid");
            $volinfo{$volid}{'name'}                    = $vol->child_get_string("name");
            $volinfo{$volid}{'state'}                   = $vol->child_get_string("state");
            $volinfo{$volid}{'type'}                    = $vol->child_get_string("type");
            $volinfo{$volid}{'sizeTotal'}               = $vol->child_get_int("size-total");
            $volinfo{$volid}{'sizeUsed'}                = $vol->child_get_int("size-used");
            $volinfo{$volid}{'sizeAvailable'}           = $vol->child_get_int("size-available");
            $volinfo{$volid}{'percentageUsed'}          = $vol->child_get_int("percentage-used");
            $volinfo{$volid}{'filesTotal'}              = $vol->child_get_int("files-total");
            $volinfo{$volid}{'filesUsed'}               = $vol->child_get_int("files-used");
            $volinfo{$volid}{'containingAggr'}          = $vol->child_get_string("containing-aggregate");
            $volinfo{$volid}{'filer'}                   = $filer;
        }
    }

Yes, back in days.. i was using Perl..  😛 

Public