Hi Victor,
Here is some python code for using the volume-get-iter api. All of the "-iter" apis should work the same, so you should be able to change to use the quota-report-iter api and the properties being inspected.
#! /usr/bin/python
from NaServer import *
server = NaServer("your.cluster", 1, 3)
server.set_admin_user("username", "password")
server.set_transport_type("HTTP")
tag = "";
while tag != None:
if not tag:
result = server.invoke('volume-get-iter', 'max-records', 1)
else:
result = server.invoke('volume-get-iter', 'tag', tag, 'max-records', 1)
if result.results_status() == "failed":
reason = result.results_reason()
print( reason + "\n" )
sys.exit(2)
if result.child_get_int('num-records') == 0:
print( "No volumes returned" )
sys.exit(0)
tag = result.child_get_string('next-tag')
for volume in result.child_get('attributes-list').children_get():
name = volume.child_get('volume-id-attributes').child_get_string('name')
print( "Found volume with name: " + name )
Note that I used the "max-records" attribute with the ZAPI query to force it to have to do more than one request to the controller. In a real environment you'll want it to do as few ZAPI calls to the cluster as possible for speed purposes (and CPU/network utilization on both ends).
Hope that helps.
Andrew
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.