Software Development Kit (SDK) and API Discussions

SDK 5.1 Python



I am trying to use volume-get-iter (without max-records set) with Python SDK, a snippet of the code is as follows and is very similar to the that is given out with the PERL SDK:

tag = "NULL"

while tag:

   vol_get_iter = NaElement("volume-get-iter")

   if tag != "NULL":


   out = s.invoke_elem(vol_get_iter)

   tag = out.child_get_string("next-tag")

   vol_list = out.child_get("attributes-list").children_get()

The issue with the above is if I have more than 20 volumes in my c-mode cluster it only outputs 20, and the tag for the "next-tag" is not being set.



I think I'm having the same problem with the tag not being set correctly with SDK 5.1.

It is possible to retrieve up to 100 records at a time by setting the max-records to 100 like:


But that's hardly a proper fix.

I hope someone from Netapp can chime in on this...



Hi Evan,

If your problem is with the Python SDK as well, there are a few gotchas you need to be aware of. First, you must XML escape the next-tag value before executing the next iteration. Second, if you're reusing the same NaElement API object to execute the next iteration, you must update the value of the tag NaElement using the NaElement.set_content() method on the third and subsequent iterations, as calling api.child_add_string("tag", next_tag) a second time will append a new copy of the tag child object under the API object rather than updating the value of the existing tag object.

See if the abbreviated code example below gets you going. If you're still running into problems, please post some more details and a short code example so we can help further.

api = NaElement("volume-get-iter")

output = server.invoke_elem(api)

print "OUTPUT:\n%s\n\n" % (output.sprintf())

next_tag = output.child_get_string("next-tag")

while next_tag is not None:

   next_tag = xml.sax.saxutils.escape(next_tag)

   if api.child_get("tag") is None:

      api.child_add_string("tag", next_tag)



   output = server.invoke_elem(api)

   print "OUTPUT:\n%s\n\n" % (output.sprintf())

   next_tag = output.child_get_string("next-tag")



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