The transition to NetApp MS Azure AD B2C is complete. If you missed the pre-registration, you will be invited to reigister at next log in.
Please note that access to your NetApp data may take up to 1 hour.
To learn more, read the FAQ and watch the video.
Need assistance? Complete this form and select “Registration Issue” as the Feedback Category.

Software Development Kit (SDK) and API Discussions

VOLUME-GET-ITER (SDK 5.7) DOESNT SHOWS ALL VOLUMES UNDER CLUSTER(9.1)

Joyn_netapp

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>&lt;volume-get-iter-key-td&gt;
        &lt;key-0&gt;vserver1&lt;/key-0&gt;
        &lt;key-1&gt;vol101&lt;/key-1&gt;
&lt;/volume-get-iter-key-td&gt;
</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

1 ACCEPTED SOLUTION

francoisbnc

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")

View solution in original post

2 REPLIES 2

francoisbnc

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")

View solution in original post

Joyn_netapp

Thanks Francoisbnc! . This explains alot.

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public