Subscribe
Accepted Solution

Vol-get-iter (status="failed" errno="1" reason="Extra content at the end of the document ")

Hi,

 

I am trying to collect volume space info using python and am getting the error message show below. 

 

<results status="failed" errno="1" reason="Extra content at the end of the document "></results>

 

Function calling in python : query is a the locaiton where the api call for volume_space is present. Record limit is set to 500 and volume name is a string of vol name.

query.volume_space(apiconnect, recordlimit, volume)

query :

 

def volume_space(s, recordlimit, volume):
api = NaElement("volume-get-iter")

xi = NaElement("desired-attributes")
api.child_add(xi)

xi1 = NaElement("volume-attributes")
xi.child_add(xi1)

xi2 = NaElement("volume-space-attributes")
xi1.child_add(xi2)

xi2.child_add_string("size","<size>")
xi2.child_add_string("size-available","<size-available>")
xi2.child_add_string("size-total","<size-total>")
xi2.child_add_string("size-used","<size-used>")
api.child_add_string("max-records", recordlimit)

xi3 = NaElement("query")
api.child_add(xi3)

xi4 = NaElement("volume-attributes")
xi3.child_add(xi4)

xi5 = NaElement("volume-id-attributes")
xi4.child_add(xi5)

xi5.child_add_string("name", volume)
api.child_add_string("tag","<tag>")

xo = s.invoke_elem(api)
if (xo.results_status() == "failed") :
print ("Error:\n")
print (xo.sprintf())
sys.exit (1)

print ("Received:\n")
print (xo.sprintf())

 Can you please help me with resolving this error? 

 

It works fine in the ZEDI GUI. But it's failing when I make the same call in python.

Re: Vol-get-iter (status="failed" errno="1" reason="Extra content at the e


from
netapp.NaElement import NaElement
from netapp.NaServer import NaServer



def volume_space(s, recordlimit, volume):
api = NaElement("volume-get-iter")

xi = NaElement("desired-attributes")
api.child_add(xi)

xi1 = NaElement("volume-attributes")
xi.child_add(xi1)

xi2 = NaElement("volume-space-attributes")
xi1.child_add(xi2)

xi2.child_add_string("size","true")
xi2.child_add_string("size-available","true")
xi2.child_add_string("size-total","true")
xi2.child_add_string("size-used","true")
api.child_add_string("max-records", recordlimit)

xi3 = NaElement("query")
api.child_add(xi3)

xi4 = NaElement("volume-attributes")
xi3.child_add(xi4)

xi5 = NaElement("volume-id-attributes")
xi4.child_add(xi5)

xi5.child_add_string("name", volume)


xo = s.invoke_elem(api)
if (xo.results_status() == "failed") :
print ("Error:\n")
print (xo.sprintf())

print ("Received:\n")
print (xo.sprintf())

s = NaServer('cdotfiler', 1, 0)
s.set_style('LOGIN')
s.set_transport_type('HTTPS')
s.set_server_type('FILER')
s.set_admin_user('admin', 'pass')

volume_space(s, 20, 'volxxxx')

set the desired values with true  xi2.child_add_string("size","true")

 

tag is not necessary, you only need it if you have to relauch zapi if you reach maximum records that zapi can return.

 

François

 

Re: Vol-get-iter (status="failed" errno="1" reason="Extra content at the e

Thank You Franco. It worked.