Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to list other dir? #7

Open
xingfengf21 opened this issue Apr 15, 2022 · 0 comments
Open

how to list other dir? #7

xingfengf21 opened this issue Apr 15, 2022 · 0 comments

Comments

@xingfengf21
Copy link

this is my fucking code

portmap initialization

portmap = Portmap(host, timeout=3600)
print(portmap.connect())

mount initialization

mnt_port = portmap.getport(Mount.program, Mount.program_version)
mount = Mount(host=host, port=mnt_port, timeout=3600, auth=auth)
mount.connect()

do mount

mnt_res =mount.mnt(mount_path, auth=auth)

if mnt_res["status"] == MNT3_OK:
root_fh =mnt_res["mountinfo"]["fhandle"]

print('root_fh',root_fh, type(root_fh))
try:
    nfs_port =portmap.getport(NFS_PROGRAM, NFS_V3)
    # nfs actions
    nfs3 =NFSv3(host, nfs_port, 3600, auth=auth)
    nfs3.connect()
    lookup_res = nfs3.readdirplus(root_fh+b'/a',auth=auth) #
    print(lookup_res)
except Exception as e:
    print(e)
finally:
    if nfs3:
        nfs3.disconnect()
    # mount.umnt(mount_path)
    mount.disconnect()
    portmap.disconnect()

else:
mount.disconnect()
portmap.disconnect()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant