Subscribe

unable to get volume list on each vserver using python

[ Edited ]

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