Software Development Kit (SDK) and API Discussions

NMSDK error: Zapi::parse_xml - Expected <netapp> element but got reason" errno="13001

i am using NetApp python NMSDK 9.4

 

when i try to get information of lun , some time it is passing and most of the time i am getting below error

 

Zapi::parse_xml - Expected <netapp> element but got reason" errno="13001

<results status="failed" reason="Zapi::parse_xml - Expected <netapp> element but got volume-errors" errno="13001"></results>

 

how can i resolve this

-Neha

7 REPLIES

Re: NMSDK error: Zapi::parse_xml - Expected <netapp> element but got reason" errno="

Check if you are using the correct version of API with correct ONTAP version. 

You specify API version here. 

s = NaServer("XXXXXXXXX", 1 , 130)  this is for API version 1.130. 

 

To check API version for that ONTAP use 

api = NaElement("system-get-ontapi-version")

 

 

Re: NMSDK error: Zapi::parse_xml - Expected <netapp> element but got reason" errno="

May I have details of your code?

Best

Re: NMSDK error: Zapi::parse_xml - Expected <netapp> element but got reason" errno="

@francoisbnc @gaurav_verma

i have written a function which get the lun info for specified "serial-number".

it is working fine, but when i tried to fetch multiple lun-info in multi-threaded environment. some threads are successful to fetch info. while some fail with the error i mention:

@gaurav_verma i have specified the on-tap version also:  server = NaServer(ip, 1 , 32)

<snip>

def get_lun_by_serial_no(self, serial_no):
try:
api = NaElement("lun-get-iter")
xi = NaElement("desired-attributes")
api.child_add(xi)
xi1 = NaElement("lun-info")
xi.child_add(xi1)
xi1.child_add_string("path","<path>")
xi1.child_add_string("serial-number","<serial-number>")
xi1.child_add_string("volume","<volume>")
xi1.child_add_string("size","<size>")
xi1.child_add_string("vserver","<vserver>")
xi1.child_add_string("uuid","<uuid>")
xi2 = NaElement("query")
api.child_add(xi2)
xi3 = NaElement("lun-info")
xi2.child_add(xi3)
 
xi3.child_add_string("serial-number",serial_no)
xo = self.serverobj.invoke_elem(api)
 
xmldata = xo.sprintf()
data = self.get_xml_to_dict_data(xmldata)
if (xo.results_status() == "failed") :
 
message = self.client_conn.format_exception(data)
raise Exception(message)
if data.get('num-records') != '0':
return data["attributes-list"]["lun-info"]
return []
except Exception as e:
message = "lib Fail to get luns: " + e
raise Exception(message)
 

<snip>

 

Error:

results status="failed" reason="Zapi::parse_xml - Expected <netapp> element but got volume-error" errno="13001">

 

Re: NMSDK error: Zapi::parse_xml - Expected <netapp> element but got reason" errno="

Did you tried to limit the number of threads you launch and start with a small number.

The Netapp api queue is limited, perhaps you reach this limit.

Try as well to create self.serverobj in the function as a local object Naserver,  In your case you use the same Naserver for each thread.

Highlighted

Re: NMSDK error: Zapi::parse_xml - Expected <netapp> element but got reason" errno="

@francoisbnc

yes i m using semaphore of count 10

for NaServer object i am using below senario:

class NetAppClientConnect():
def __init__(self, ip, username, password):
self.ip = ip
self.user = username
self.password = password
 
def getNaServerobj(self):
try:
server = NaServer(self.ip, 1 , 32)
server.set_server_type("FILER")
server.set_transport_type("HTTPS")
server.set_port(443)
server.set_style("LOGIN")
server.set_admin_user(self.user, self.password)
return server
except Exception as e:
logger.error("Fail to get NaServer object")
raise Exception(str(e))
 
all functions calls be like.
class NetAppRestApiLib():
def __init__(self, ip, username, password):
self.ip = ip
self.user = username
self.password = password
self.client_conn = NetAppClientConnect(
self.ip, self.user, self.password)
self.serverobj = self.client_conn.getNaServerobj()
 
def get_lun(self):
try:
api = NaElement("lun-get-iter")
xi = NaElement("desired-attributes")
api.child_add(xi)
xi1 = NaElement("lun-info")
----
-
xo = self.serverobj.invoke_elem(api) ---- > for all i m using this self.serverobj
 
should i try something else????

Re: NMSDK error: Zapi::parse_xml - Expected <netapp> element but got reason" errno="

Naserver Class is perhaps not thread safe. Try to create Naserver for each call.

Re: NMSDK error: Zapi::parse_xml - Expected <netapp> element but got reason" errno="

yes it worked when i try to create NaServer object for each api call

Forums