def O_GetAttr(self, ncl, op): print "SERVER GETATTR" print " ATTRMASK: %s" % str(nfs4lib.attrmask2attrs(op.opgetattr.attr_request)) attrs = nfs4lib.attrmask2list(op.opgetattr.attr_request) attrvals = self.curr_fh.get_attributes(ncl, attrs) f4 = nfs4lib.dict2fattr(attrvals, ncl) garesok = GETATTR4resok(ncl, f4) gares = GETATTR4res(ncl, NFS4_OK, garesok) argop = nfs_resop4(ncl, resop=OP_GETATTR, opgetattr=gares) return (NFS4_OK, argop)
def O_GetAttr(self, ncl, op): print "SERVER GETATTR" print " ATTRMASK: %s" % str( nfs4lib.attrmask2attrs(op.opgetattr.attr_request)) attrs = nfs4lib.attrmask2list(op.opgetattr.attr_request) attrvals = self.curr_fh.get_attributes(ncl, attrs) f4 = nfs4lib.dict2fattr(attrvals, ncl) garesok = GETATTR4resok(ncl, f4) gares = GETATTR4res(ncl, NFS4_OK, garesok) argop = nfs_resop4(ncl, resop=OP_GETATTR, opgetattr=gares) return (NFS4_OK, argop)
def O_ReadDir(self, ncl, op): print "SERVER READDIR" print " CURRENT FILEHANDLE %s" % self.curr_fh.ref print " COOKIEVERF: %s, %s" % (op.opreaddir.cookieverf, op.opreaddir.cookie) print " ATTRMASK: %s" % str( nfs4lib.attrmask2attrs(op.opreaddir.attr_request)) if op.opreaddir.cookie == 0: cookie = str(int(time.time()))[2:] self.client.dirlist[cookie] = self.curr_fh.read_dir() ncoky = 1 start = 0 else: cookie = op.opreaddir.cookieverf start = op.opreaddir.cookie * 50 ncoky = op.opreaddir.cookie + 1 # FIXME: Bad system for counting the size of the readdir requests attrs = nfs4lib.attrmask2list(op.opreaddir.attr_request) e4 = [] cnt = 100 while len(self.client.dirlist[cookie]) > (start) and cnt > 0: cnt = cnt - 1 entry = self.client.dirlist[cookie][start] attrvals = entry.get_attributes(ncl, attrs) f4 = nfs4lib.dict2fattr(attrvals, ncl) e4 = [entry4(ncl, ncoky, name=entry.ref, attrs=f4, nextentry=e4)] start = start + 1 if start < len(self.client.dirlist[cookie]): d4 = dirlist4(ncl, e4, eof=0) else: del self.client.dirlist[cookie] d4 = dirlist4(ncl, e4, eof=1) rdresok = READDIR4resok(ncl, cookieverf=cookie, reply=d4) rdres = READDIR4res(ncl, NFS4_OK, rdresok) argop = nfs_resop4(ncl, resop=OP_READDIR, opreaddir=rdres) return (NFS4_OK, argop)
def O_ReadDir(self, ncl, op): print "SERVER READDIR" print " CURRENT FILEHANDLE %s" % self.curr_fh.ref print " COOKIEVERF: %s, %s" % ( op.opreaddir.cookieverf, op.opreaddir.cookie) print " ATTRMASK: %s" % str(nfs4lib.attrmask2attrs(op.opreaddir.attr_request)) if op.opreaddir.cookie == 0: cookie = str(int(time.time()))[2:] self.client.dirlist[cookie] = self.curr_fh.read_dir() ncoky = 1 start = 0 else: cookie = op.opreaddir.cookieverf start = op.opreaddir.cookie*50 ncoky = op.opreaddir.cookie+1 # FIXME: Bad system for counting the size of the readdir requests attrs = nfs4lib.attrmask2list(op.opreaddir.attr_request) e4 = [] cnt = 100 while len(self.client.dirlist[cookie])>(start) and cnt >0: cnt = cnt - 1 entry = self.client.dirlist[cookie][start] attrvals = entry.get_attributes(ncl, attrs) f4 = nfs4lib.dict2fattr(attrvals, ncl) e4 = [ entry4(ncl, ncoky, name=entry.ref, attrs=f4, nextentry=e4)] start = start + 1 if start < len(self.client.dirlist[cookie]): d4 = dirlist4(ncl, e4, eof=0) else: del self.client.dirlist[cookie] d4 = dirlist4(ncl, e4, eof=1) rdresok = READDIR4resok(ncl, cookieverf=cookie, reply=d4) rdres = READDIR4res(ncl, NFS4_OK, rdresok) argop = nfs_resop4(ncl, resop=OP_READDIR, opreaddir=rdres) return (NFS4_OK, argop)