Software Development Kit (SDK) and API Discussions

query not working on SDK 4.1


hi There,

I most likely doing something wrong but I have started to use NMSDK and it looks to me the query doesnt work, at least as I think it's intended.

I have a C-mode cluster with 90 volumes on it, when I query to get attributes of just one volume using its properties: junction-path and name, I get nevertheless all of them. This is a piece of the code (in perl):

$nelem = NaElement->new("volume-get-iter");


$query = NaElement->new("query");

$volpath = NaElement->new("volume-id-attributes");

$volpath->child_add_string("junction-path", $mountpath);

#$volpath->child_add_string("name","edhp_backup01" );



my $desiredAttrs = NaElement->new("desired-attributes");

my $desiredAutoSpace = NaElement->new("volume-autosize-attributes");

my $desiredIdAttr = NaElement->new("volume-id-attributes");

my $desiredSpace = NaElement->new("volume-space-attributes");





my $out = $server->invoke_elem($nelem);

This give always the 90 volumes. am I missing something?, if I set max-records to 1, I do 90 round trips to get all volumes. The fact is that I never get just one. Name and Junction-path are like primary keys, they should return just one.

Thanks for any advice!


NetApp Alumni

Please state the ONTAP version.

   - Rick -


Hi Rick,

I am running Ontap 8.1.1 C-mode



NetApp Alumni

Hi Ruben -

I believe the above code is incorrect.

Here is how the XML should look:




















The code above forgot the <volume-attributes>.

I will post some code on my blog at:


   - Rick -

NetApp Alumni

The code is now posted at:


   - Rick -


Thanks Rick!

I test it in a moment. By the way,you get this nice layout of the XML document calling NAelement sprintf function?

Thanks again for your help!

NetApp Alumni

Also what is the format of the volume name you are using?

Are you using this API at the cluster or vserver level?


   - Rick -


This is how I define my NAserver:

  my ($ipaddr, ,$username, $password, $vserver) = @_;

          my $server = NaServer->new($ipaddr, 1, 17);


          $server->set_admin_user($username, $password);



I also set the vserver. All the volumes are defined for this vserver, called 'dbvs'.

I must say I dont understand the question about the name format. This are the properties of the volume I am trying to retrieve in this example:

cluster01::> vol show -vserver dbvs -volume edhp_backup01

  (volume show)

                                   Vserver Name: dbvs

                                    Volume Name: edhp_backup01

                                 Aggregate Name: aggr1_c01n01

                                    Volume Size: 1.05TB

                             Volume Data Set ID: 1120

                      Volume Master Data Set ID: 2147484772

                                   Volume State: online

                                    Volume Type: RW

                                   Volume Style: flex

                         Is Cluster-Mode Volume: true

                          Is Constituent Volume: false

                                  Export Policy:

                                        User ID: oracle

                                       Group ID: ci

                                 Security Style: unix

                               UNIX Permissions: ---rwxr-xr-x

                                  Junction Path: /backup/dbs01/EDHP

                           Junction Path Source: RW_volume

                                Junction Active: true

                         Junction Parent Volume: root_vol

Thanks for your help,


NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner