Active IQ Unified Manager Discussions

unable to get volume list on each vserver using python

Nageswar
2,786 Views

Hi,

 

please help me to fix this 

 

my volume fun below

 

def volume_check():
get_vol = NaElement("volume-get-iter")
vol_out = s.invoke_elem(get_vol)
vol_alist = vol_out.child_get("attributes-list")
vol_attr = vol_alist.child_get("volume-attributes")
vol_id_attr = vol_attr.child_get("volume-id-attributes")
vol_list = vol_alist.children_get()
for vol in vol_list:
   vol_name = vol_id_attr.child_get_string("name")
   vol_vs_name = vol_id_attr.child_get_string("owning-vserver-name")
   print vol_name, vol_vs_name
volume_check()

 

when i run volume_check() i get below output, seems its repeating on avolume.

 

 

vol0 node-01
vol0 node-01
vol0 node-01
vol0 node-01
vol0 node-01
vol0 node-01
vol0 node-01
vol0 node-01
vol0 node-01
vol0 node-01

1 REPLY 1

jjxx
2,432 Views

Works for me

 

vol_alist = vol_out.child_get("attributes-list")
vol_attr = vol_alist.children_get()
for i in vol_attr:
#print "b is: " + str(i)
vid = i.child_get("volume-id-attributes")
#print "vid is " + str(vid)
vol_name = vid.child_get_string("name")
vol_ctime = vid.child_get_string("creation-time")
print vol_name, vol_ctime
Public