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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi community,
I was trying to use the Python API to query a list of files on a specific volume on a specific vserver, so far i have been successfully able to do that using the powershell command:
Read-NcDirectory /vol/volume0 -VserverContext nfs_test | where {$_.Type -match "directory" -and $_.Name -notmatch "\."} | Read-NcDirectory
However, when I try to accomplish a similar task using the python API:
import sys
sys.path.append("C:\sdk\lib\python\NetApp")
from NaServer import *
s = NaServer("10.0.0.1", 1 , 20)
s.set_server_type("FILER")
s.set_transport_type("HTTPS")
s.set_port(443)
s.set_style("LOGIN")
s.set_admin_user("admin", "password")
api = NaElement("file-list-directory-iter")
api.child_add_string("encoded",True)
api.child_add_string("path","/vol/volume0")
xo = s.invoke_elem(api)
if (xo.results_status() == "failed") :
print ("Error:\n")
print (xo.sprintf())
sys.exit (1)
print "Received:\n"
print xo.sprintf()
I get the following output:
Error:
<results status="failed" errno="13005" reason="Unable to find API: file-list-directory-iter-start"></results>
Has anyone been able to accomplish this? My main task is to verify all .vmdk and .qcow files inside a specific volume and check its QoS policy, if there's none I must be able to add one.
Any tips? Any hints? Anything?
Solved! See The Solution
1 ACCEPTED SOLUTION
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The API is indeed called file-list-directory-iter. Note that it is a Vserver-specific API, so you need to either:
- Set the desired Vserver using s.set_vserver(vserver_name), OR
- Connect to the Vserver management IP rather than the cluster management IP.
-Ben
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The iter-start APIs calls aren't there any more, just file-list-directory-iter.
See the element next-tag.
I use the ZExplore utility to find clues on these issues.
I hope this response has been helpful to you.
At your service,
Eugene E. Kashpureff, Sr.
Independent NetApp Consultant, K&H Research http://www.linkedin.com/in/eugenekashpureff
Senior NetApp Instructor, IT Learning Solutions http://sg.itls.asia/netapp
(P.S. I appreciate points for helpful or correct answers.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I also tried the file-list-directory-iter, but I get the same error:
Error:
<results status="failed" errno="13005" reason="Unable to find API: file-list-directory-iter"></results>
I must also add that I'm with a clustered mode infrastructure.
migration has accepted the solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The API is indeed called file-list-directory-iter. Note that it is a Vserver-specific API, so you need to either:
- Set the desired Vserver using s.set_vserver(vserver_name), OR
- Connect to the Vserver management IP rather than the cluster management IP.
-Ben
