NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Active IQ Unified Manager Discussions

unable to get volume list on each vserver using python

Nageswar
3,628 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
3,274 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