def testBadSlot(t, env): """Send a request with a bad slot FLAGS: sequence all CODE: SEQ8 """ c1 = env.c1.new_client(env.testname(t)) # Session has 8 slots (numbered 0 through 7) attrs = channel_attrs4(0, 8192, 8192, 8192, 128, 8, []) sess1 = c1.create_session(fore_attrs = attrs) # Send sequence on (non-existant) slot number 8 res = env.c1.compound([op.sequence(sess1.sessionid, 1, 8, 8, True)]) check(res, NFS4ERR_BADSLOT)
def testBadSlot(t, env): """Send a request with a bad slot FLAGS: sequence all CODE: SEQ8 """ c1 = env.c1.new_client(env.testname(t)) # Session has 8 slots (numbered 0 through 7) attrs = channel_attrs4(0, 8192, 8192, 8192, 128, 8, []) sess1 = c1.create_session(fore_attrs=attrs) # Send sequence on (non-existant) slot number 8 res = env.c1.compound([op.sequence(sess1.sessionid, 1, 8, 8, True)]) check(res, NFS4ERR_BADSLOT)
def testRequestTooBig(t, env): """Send a request bigger than session can handle FLAGS: sequence all CODE: SEQ6 """ c1 = env.c1.new_client(env.testname(t)) # Only allow 512 byte requests attrs = channel_attrs4(0, 512, 8192, 8192, 128, 8, []) sess1 = c1.create_session(fore_attrs=attrs) # Send a lookup request with a very long filename res = sess1.compound([op.putrootfh(), op.lookup("12345" * 100)]) # FIXME - NAME_TOO_BIG is valid, don't want it to be check(res, NFS4ERR_REQ_TOO_BIG)
def testRequestTooBig(t, env): """Send a request bigger than session can handle FLAGS: sequence all CODE: SEQ6 """ c1 = env.c1.new_client(env.testname(t)) # Only allow 512 byte requests attrs = channel_attrs4(0, 512, 8192, 8192, 128, 8, []) sess1 = c1.create_session(fore_attrs = attrs) # Send a lookup request with a very long filename res = sess1.compound([op.putrootfh(), op.lookup("12345"*100)]) # FIXME - NAME_TOO_BIG is valid, don't want it to be check(res, NFS4ERR_REQ_TOO_BIG)
def connect(self): # only support root with AUTH_SYS for now s1 = rpc.security.instance(rpc.AUTH_SYS) self.cred1 = s1.init_cred(uid=0, gid=0) self.c1 = nfs4client.NFS4Client(self.server, self.port, summary=self.summary) self.c1.set_cred(self.cred1) self.c1.null() c = self.c1.new_client("DS.init_%s" % self.server) # This is a hack to ensure MDS/DS communication path is at least # as wide as the client/MDS channel (at least for linux client) fore_attrs = type4.channel_attrs4(0, 16384, 16384, 2868, 8, 8, []) self.sess = c.create_session(fore_attrs=fore_attrs) self.sess.compound([op4.reclaim_complete(const4.FALSE)])
def testTooManyOps(t, env): """Send a request with more ops than the session can handle FLAGS: sequence all CODE: SEQ7 """ c1 = env.c1.new_client(env.testname(t)) # Create session asking for 4 ops max per request attrs = channel_attrs4(0, 8192, 8192, 8192, 4, 8, []) sess1 = c1.create_session(fore_attrs = attrs) # Send the max number of ops allowed by the server lots_of_ops = [op.putrootfh(), op.getfh()] lots_of_ops += [op.getattr(0) for num in xrange(sess1.fore_channel.maxoperations-3)] res = sess1.compound(lots_of_ops) check(res) # Add one more op to exceed the maximum lots_of_ops += [op.getattr(0)] res = sess1.compound(lots_of_ops) check(res, NFS4ERR_TOO_MANY_OPS)