Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
VOLUME-GET-ITER (SDK 5.7) DOESNT SHOWS ALL VOLUMES UNDER CLUSTER(9.1)
2018-04-29
07:04 AM
4,534 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Guys,
I am using Netapp SDK 5.7 and below is the python code. If I try to list all of the volumes under the cluster it shows only 50+ or sometimes 200+ volumes. I could confirm that the cluster(version 9.1) has 1000+ volumes.How could I list all the volumes?
s = NaServer("x.x.x.x", 1 , 31) s.set_server_type("FILER") s.set_transport_type("HTTPS") s.set_port(443) s.set_style("LOGIN") s.set_admin_user("someuser", "somepassword") result = s.invoke('volume-get-iter' , 'max-records', 1000) print(result.sprintf()) for volume in result.child_get('attributes-list').children_get(): volumename = volume.child_get('volume-id-attributes').child_get_string('name') print(volumename) #Below are the last few output lines of sprintf() </volume-attributes> </attributes-list> <next-tag><volume-get-iter-key-td> <key-0>vserver1</key-0> <key-1>vol101</key-1> </volume-get-iter-key-td> </next-tag> <num-records>250</num-records> </result>
Looks to me "next-tag" says there is a volume vol101 being followed up and this time it prints 250 volumes(this number changes everytime running the script). How can I print all of the volumes from the cluster? Why max-records parameter doesnt helps here?
I dont know how to make use of "next-tag" and "tag" in the code. Could someone please explain me with an example. Thanks in advance.
Regards,
Joy
Solved! See The Solution
1 ACCEPTED SOLUTION
Joyn_netapp has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can do something ike this
from netappzap import NaServer from netappzap import NaElement s = NaServer("xxxxxx", 1, 31) s.set_server_type("FILER") s.set_transport_type("HTTP") s.set_port(80) s.set_style("LOGIN") s.set_admin_user("xxxxx", "xxxxxx") # first loop tag = 'first' while tag: api = NaElement("volume-get-iter") api.child_add_string("max-records", "5") if tag != 'first': api.child_add_string("tag", tag) output = s.invoke_elem(api) volumesattributes = output.child_get('attributes-list').children_get() for volume in volumesattributes: volumename = volume.child_get('volume-id-attributes').child_get_string('name') print(volumename) tag = output.child_get_string("next-tag")
2 REPLIES 2
Joyn_netapp has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can do something ike this
from netappzap import NaServer from netappzap import NaElement s = NaServer("xxxxxx", 1, 31) s.set_server_type("FILER") s.set_transport_type("HTTP") s.set_port(80) s.set_style("LOGIN") s.set_admin_user("xxxxx", "xxxxxx") # first loop tag = 'first' while tag: api = NaElement("volume-get-iter") api.child_add_string("max-records", "5") if tag != 'first': api.child_add_string("tag", tag) output = s.invoke_elem(api) volumesattributes = output.child_get('attributes-list').children_get() for volume in volumesattributes: volumename = volume.child_get('volume-id-attributes').child_get_string('name') print(volumename) tag = output.child_get_string("next-tag")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Francoisbnc! . This explains alot.
