def testReclaimAfterRECC(t, env): """If client does subsequent reclaims of locking state after RECLAIM_COMPLETE is done, server will return NFS4ERR_NO_GRACE. rfc5661 18.51.3 FLAGS: reclaim_complete all CODE: RECC2 """ name = env.testname(t) c = env.c1.new_client(name) sess = c.create_session() res = sess.compound([op.reclaim_complete(FALSE)]) check(res) owner = "owner_%s" % name path = sess.c.homedir + [name] fh, stateid = create_confirm(sess, owner) # Try to reclaims a file which is noexist after RECLAIM_COMPLETE res = open_file(sess, owner, path=fh, claim_type=CLAIM_PREVIOUS, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, deleg_type=OPEN_DELEGATE_NONE) check(res, NFS4ERR_NO_GRACE, warnlist=[NFS4ERR_EXIST | NFS4ERR_RECLAIM_BAD]) # Cleanup res = sess.compound([op.putfh(fh), op.close(0, stateid)]) check(res)
def testRebootValid(t, env): """REBOOT with valid CLAIM_PREVIOUS FLAGS: reboot DEPEND: CODE: REBT1 """ name = env.testname(t) owner = "owner_%s" % name c = env.c1.new_client(env.testname(t)) sess = c.create_session() reclaim_complete(sess) fh, stateid = create_confirm(sess, owner) sleeptime = 5 + _getleasetime(sess) _waitForReboot(c, sess, env) try: res = create_session(c) check(res, NFS4ERR_STALE_CLIENTID, "Reclaim using old clientid") c = env.c1.new_client(env.testname(t)) sess = c.create_session() newleasetime = _getleasetime(sess) sleeptime = max(sleeptime, 5 + newleasetime) res = open_file(sess, owner, path=fh, claim_type=CLAIM_PREVIOUS, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, deleg_type=OPEN_DELEGATE_NONE) check(res, msg="Reclaim using newly created clientid") reclaim_complete(sess) finally: env.sleep(sleeptime, "Waiting for grace period to end")
def testReclaimAfterRECC(t, env): """If client does subsequent reclaims of locking state after RECLAIM_COMPLETE is done, server will return NFS4ERR_NO_GRACE. rfc5661 18.51.3 FLAGS: reclaim_complete all CODE: RECC2 """ name = env.testname(t) c = env.c1.new_client(name) sess = c.create_session() res = sess.compound([op.reclaim_complete(FALSE)]) check(res) owner = "owner_%s" % name path = sess.c.homedir + [name] fh, stateid = create_confirm(sess, owner) # Try to reclaims a file which is noexist after RECLAIM_COMPLETE res = open_file(sess, owner, path=fh, claim_type=CLAIM_PREVIOUS, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, deleg_type=OPEN_DELEGATE_NONE) check(res, NFS4ERR_NO_GRACE, warnlist = [NFS4ERR_EXIST | NFS4ERR_RECLAIM_BAD]) # Cleanup res = sess.compound([op.putfh(fh), op.close(0, stateid)]) check(res)
def testRebootValid(t, env): """REBOOT with valid CLAIM_PREVIOUS FLAGS: reboot DEPEND: CODE: REBT1 """ name = env.testname(t) owner = "owner_%s" % name c = env.c1.new_client(env.testname(t)) sess = c.create_session() reclaim_complete(sess) fh, stateid = create_confirm(sess, owner) oldleasetime = _getleasetime(sess) _waitForReboot(c, sess, env) try: res = create_session(c) check(res, NFS4ERR_STALE_CLIENTID, "Reclaim using old clientid") c = env.c1.new_client(env.testname(t)) sess = c.create_session() newleasetime = _getleasetime(sess) sleeptime = 5 + max(oldleasetime, newleasetime) res = open_file(sess, owner, path=fh, claim_type=CLAIM_PREVIOUS, access=OPEN4_SHARE_ACCESS_BOTH, deny=OPEN4_SHARE_DENY_NONE, deleg_type=OPEN_DELEGATE_NONE) check(res, msg="Reclaim using newly created clientid") reclaim_complete(sess) finally: env.sleep(sleeptime, "Waiting for grace period to end")
def testSelfRenameFile(t, env): """RENAME that does nothing FLAGS: rename all CODE: RNM19 """ name = env.testname(t) sess = env.c1.new_client_session(name) fh, stateid = create_confirm(sess, name) basedir = env.c1.homedir + [name] res = rename_obj(sess, basedir, basedir) check(res) scinfo = res.resarray[-1].source_cinfo tcinfo = res.resarray[-1].target_cinfo if scinfo.before != scinfo.after or tcinfo.before != tcinfo.after: t.fail("RENAME of file %s into itself should do nothing, " "but cinfo was changed" % name)