pynfs41: Add some tests for RECLAIM_COMPLETE
Subsystems (2)
v3 cover pynfs41: Add some tests for RECLAIM_COMPLETE
Some tests for RECLAIM_COMPLETE.
Signature · 3 lines
---- thanks Mi Jinlong
PATCH v3 1/4 4.1 CLNT: add a simple test about RECLAIM_COMPLETE
--- nfs4.1/server41tests/__init__.py | 1 + nfs4.1/server41tests/st_reclaim_complete.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 nfs4.1/server41tests/st_reclaim_complete.py
nfs4.1/server41tests/__init__.py +1 -0
@@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21 "st_compound.py", "st_create_session.py", "st_destroy_session.py", + "st_reclaim_complete.py", "st_secinfo_no_name.py", "st_secinfo.py", "st_sequence.py",
nfs4.1/server41tests/st_reclaim_complete.py new file +21 -0
@@ -0,0 +1,21 @@ +from st_create_session import create_session +from nfs4_const import * +from environment import check, fail +import nfs4_ops as op +import nfs4lib + +def testSupported(t, env): + """Do a simple RECLAIM_COMPLETE + + FLAGS: reclaim_complete all + CODE: RECC1 + """ + c = env.c1.new_client(env.testname(t)) + sess = c.create_session() + + # RECLAIM_COMPLETE + res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)]) + check(res) + + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res)
Signature · 1 line
1.7.6
Re: [PATCH 1/4 v3] 4.1 CLNT: add a simple test about RECLAIM_COMPLETE
Quoted 1 line · Mi Jinlong
Signed-off-by Mi Jinlong <[email protected]>
Is it even possible to run this test without an earlier RECLAIM_COMPLETE failing? I guess so, if you just run this one test without --maketree.
OK.
--b.
Quoted 49 lines
--- nfs4.1/server41tests/__init__.py | 1 + nfs4.1/server41tests/st_reclaim_complete.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 nfs4.1/server41tests/st_reclaim_complete.pynfs4.1/server41tests/__init__.py +1
-0@@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21 "st_compound.py", "st_create_session.py", "st_destroy_session.py", + "st_reclaim_complete.py", "st_secinfo_no_name.py", "st_secinfo.py", "st_sequence.py",nfs4.1/server41tests/st_reclaim_complete.py new file +21
-0@@ -0,0 +1,21 @@ +from st_create_session import create_session +from nfs4_const import * +from environment import check, fail +import nfs4_ops as op +import nfs4lib + +def testSupported(t, env): + """Do a simple RECLAIM_COMPLETE + + FLAGS: reclaim_complete all + CODE: RECC1 + """ + c = env.c1.new_client(env.testname(t)) + sess = c.create_session() + + # RECLAIM_COMPLETE + res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)]) + check(res) + + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res)Signature · 1 line
1.7.6
Re: [PATCH 1/4 v3] 4.1 CLNT: add a simple test about RECLAIM_COMPLETE
J. Bruce Fields :
Quoted 5 lines · Mi Jinlong
Quoted 1 line
Signed-off-by Mi Jinlong <[email protected]>Is it even possible to run this test without an earlier
RECLAIM_COMPLETEfailing? I guess so, if you just run this one test without --maketree.
NO, it's OK. As:
]# ./testserver.py --outfile=first.log 127.0.0.1:/ RECC1
INFO :rpc.poll:got connection from ('127.0.0.1', 52268), assigned to fd=5
INFO :rpc.thread:Called connect(('127.0.0.1', 2049))
INFO :rpc.poll:Adding 6 generated by another thread
INFO :test.env:Created client to 127.0.0.1, 2049
INFO :nfs.client.cb:********************
INFO :nfs.client.cb:Handling CB_NULL
INFO :test.env:Called do_readdir()
INFO :test.env:do_readdir() = []
INFO :nfs.client.cb:********************
INFO :nfs.client.cb:Handling CB_NULL **************************************************
RECC1 st_reclaim_complete.testSupported : PASS
**************************************************
Command line asked for 1 of 165 tests
Of those: 0 Skipped, 0 Failed, 0 Warned, 1 Passed
thanks,
Mi Jinlong
Quoted 52 lines
Quoted 50 lines
--- nfs4.1/server41tests/__init__.py | 1 + nfs4.1/server41tests/st_reclaim_complete.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 0 deletions(-) create mode 100644 nfs4.1/server41tests/st_reclaim_complete.pynfs4.1/server41tests/__init__.py +1
-0@@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21 "st_compound.py", "st_create_session.py", "st_destroy_session.py", + "st_reclaim_complete.py", "st_secinfo_no_name.py", "st_secinfo.py", "st_sequence.py",nfs4.1/server41tests/st_reclaim_complete.py new file +21
-0@@ -0,0 +1,21 @@ +from st_create_session import create_session +from nfs4_const import * +from environment import check, fail +import nfs4_ops as op +import nfs4lib + +def testSupported(t, env): + """Do a simple RECLAIM_COMPLETE + + FLAGS: reclaim_complete all + CODE: RECC1 + """ + c = env.c1.new_client(env.testname(t)) + sess = c.create_session() + + # RECLAIM_COMPLETE + res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)]) + check(res) + + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res)Signature · 1 line
1.7.6
PATCH v3 2/4 4.1 CLNT: test reclaims after RECLAIM_COMPLETE
In reply to Mi Jinlong--- nfs4.1/server41tests/st_reclaim_complete.py | 30 ++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-)
nfs4.1/server41tests/st_reclaim_complete.py +29 -1
@@ -1,6 +1,6 @@ from st_create_session import create_session from nfs4_const import * -from environment import check, fail +from environment import check, fail, open_file, create_confirm import nfs4_ops as op import nfs4lib
@@ -19,3 +19,31 @@ def testSupported(t, env): res = sess.compound([op.reclaim_complete(FALSE)]) check(res) + +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() + + # RECLAIM_COMPLETE + 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 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)
Signature · 1 line
1.7.6
Re: [PATCH 2/4 v3] 4.1 CLNT: test reclaims after RECLAIM_COMPLETE
Quoted 4 lines · Mi Jinlong
Signed-off-by Mi Jinlong <[email protected]>--- nfs4.1/server41tests/st_reclaim_complete.py | 30 ++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-)
Just nits:
Quoted 21 lines
nfs4.1/server41tests/st_reclaim_complete.py +5
-1@@ -1,6 +1,6 @@ from st_create_session import create_session from nfs4_const import * -from environment import check, fail +from environment import check, fail, open_file, create_confirm import nfs4_ops as op import nfs4lib@@ -19,3 +19,31 @@ def testSupported(t, env): res = sess.compound([op.reclaim_complete(FALSE)]) check(res) + +def testReclaimAfterRECC(t, env): + """If client does subsequent reclaims of locking state after + RECLAIM_COMPLETE is done, server will return NFS4ERR_NO_GRACE.
nfs4.1/server41tests/st_reclaim_complete.py def testSupported(t, env): · line 35
Quoted 10 lines
nfs4.1/server41tests/st_reclaim_complete.py +10
-0+ rfc5661 18.51.3 + + FLAGS: reclaim_complete all + CODE: RECC2 + """ + name = env.testname(t) + c = env.c1.new_client(name) + sess = c.create_session() + + # RECLAIM_COMPLETE
This comment doesn't explain anything not already obvious from the code.
nfs4.1/server41tests/st_reclaim_complete.py def testSupported(t, env): · line 43
Quoted 8 lines
nfs4.1/server41tests/st_reclaim_complete.py +8
-0+ 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 after RECLAIM_COMPLETE
Ditto.
nfs4.1/server41tests/st_reclaim_complete.py def testSupported(t, env): · line 49
Quoted 6 lines
nfs4.1/server41tests/st_reclaim_complete.py +6
-0+ 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)
Make the "," a ", ".
Also: in this case:
- the file we're trying to open doesn't exist
- the client we just created probably isn't allowed to reclaim
So NFS4ERR_EXIST and NFS4ERR_RECLAIM_BAD are probably both legal error returns as well. I don't think the spec mandates that these be checked in any particular order.
--b.
Quoted 4 lines
Signature · 1 line
1.7.6
PATCH v3 3/4 4.1 CLNT: test open before RECLAIM_COMPLETE
In reply to Mi Jinlong--- nfs4.1/server41tests/st_reclaim_complete.py | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)
nfs4.1/server41tests/st_reclaim_complete.py +20 -1
@@ -1,6 +1,6 @@ from st_create_session import create_session from nfs4_const import * -from environment import check, fail, open_file, create_confirm +from environment import check, fail, open_file, create_file, create_confirm import nfs4_ops as op import nfs4lib
@@ -47,3 +47,22 @@ def testReclaimAfterRECC(t, env): deleg_type=OPEN_DELEGATE_NONE) check(res,NFS4ERR_NO_GRACE) + +def testOpenBeforeRECC(t, env): + """After a client establishes a new client ID, if non-reclaim + locking operations are done before the RECLAIM_COMPLETE, + error NFS4ERR_GRACE will be returned. rfc5661 18.51.3 + + FLAGS: reclaim_complete all + CODE: RECC3 + """ + name = env.testname(t) + c = env.c1.new_client(name) + sess = c.create_session() + + fname = "owner_%s" % name + path = sess.c.homedir + [name] + + # Try to open file before RECLAIM_COMPLETE + res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH) + check(res,NFS4ERR_GRACE)
Signature · 1 line
1.7.6
Re: [PATCH 3/4 v3] 4.1 CLNT: test open before RECLAIM_COMPLETE
Quoted 1 line · Mi Jinlong
Signed-off-by Mi Jinlong <[email protected]>
Same nits as previous ones (comments mostly repeat what the code says, space needed after comma between function arguments).
Looks reasonable otherwise.
--b.
Quoted 43 lines
--- nfs4.1/server41tests/st_reclaim_complete.py | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-)nfs4.1/server41tests/st_reclaim_complete.py +20
-1@@ -1,6 +1,6 @@ from st_create_session import create_session from nfs4_const import * -from environment import check, fail, open_file, create_confirm +from environment import check, fail, open_file, create_file, create_confirm import nfs4_ops as op import nfs4lib@@ -47,3 +47,22 @@ def testReclaimAfterRECC(t, env): deleg_type=OPEN_DELEGATE_NONE) check(res,NFS4ERR_NO_GRACE) + +def testOpenBeforeRECC(t, env): + """After a client establishes a new client ID, if non-reclaim + locking operations are done before the RECLAIM_COMPLETE, + error NFS4ERR_GRACE will be returned. rfc5661 18.51.3 + + FLAGS: reclaim_complete all + CODE: RECC3 + """ + name = env.testname(t) + c = env.c1.new_client(name) + sess = c.create_session() + + fname = "owner_%s" % name + path = sess.c.homedir + [name] + + # Try to open file before RECLAIM_COMPLETE + res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH) + check(res,NFS4ERR_GRACE)Signature · 1 line
1.7.6
PATCH v3 4/4 4.1 CLNT: test RECLAIM_COMPLETE twice
In reply to Mi Jinlong--- nfs4.1/server41tests/st_reclaim_complete.py | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
nfs4.1/server41tests/st_reclaim_complete.py +19 -0
@@ -66,3 +66,22 @@ def testOpenBeforeRECC(t, env): # Try to open file before RECLAIM_COMPLETE res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH) check(res,NFS4ERR_GRACE) + +def testDoubleRECC(t, env): + """If RECLAIM_COMPLETE is done a second time, error + NFS4ERR_COMPLETE_ALREADY will be returned. rfc5661 18.51.4 + + FLAGS: reclaim_complete all + CODE: RECC4 + """ + name = env.testname(t) + c = env.c1.new_client(name) + sess = c.create_session() + + # RECLAIM_COMPLETE + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res) + + # RECLAIM_COMPLETE again + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res, NFS4ERR_COMPLETE_ALREADY)
Signature · 1 line
1.7.6
Re: [PATCH 4/4 v3] 4.1 CLNT: test RECLAIM_COMPLETE twice
Quoted 4 lines · Mi Jinlong
Signed-off-by Mi Jinlong <[email protected]>--- nfs4.1/server41tests/st_reclaim_complete.py | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
Looks OK.
--b.
Quoted 32 lines
nfs4.1/server41tests/st_reclaim_complete.py +19
-0@@ -66,3 +66,22 @@ def testOpenBeforeRECC(t, env): # Try to open file before RECLAIM_COMPLETE res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH) check(res,NFS4ERR_GRACE) + +def testDoubleRECC(t, env): + """If RECLAIM_COMPLETE is done a second time, error + NFS4ERR_COMPLETE_ALREADY will be returned. rfc5661 18.51.4 + + FLAGS: reclaim_complete all + CODE: RECC4 + """ + name = env.testname(t) + c = env.c1.new_client(name) + sess = c.create_session() + + # RECLAIM_COMPLETE + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res) + + # RECLAIM_COMPLETE again + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res, NFS4ERR_COMPLETE_ALREADY)Signature · 1 line
1.7.6
PATCH v4 1/4 4.1 CLNT: add a simple test about RECLAIM_COMPLETE
In reply to Mi Jinlong--- nfs4.1/server41tests/__init__.py | 1 + nfs4.1/server41tests/st_reclaim_complete.py | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 nfs4.1/server41tests/st_reclaim_complete.py
nfs4.1/server41tests/__init__.py +1 -0
@@ -2,6 +2,7 @@ __all__ = ["st_exchange_id.py", # draft 21 "st_compound.py", "st_create_session.py", "st_destroy_session.py", + "st_reclaim_complete.py", "st_secinfo_no_name.py", "st_secinfo.py", "st_sequence.py",
nfs4.1/server41tests/st_reclaim_complete.py new file +20 -0
@@ -0,0 +1,20 @@ +from st_create_session import create_session +from nfs4_const import * +from environment import check, fail +import nfs4_ops as op +import nfs4lib + +def testSupported(t, env): + """Do a simple RECLAIM_COMPLETE + + FLAGS: reclaim_complete all + CODE: RECC1 + """ + c = env.c1.new_client(env.testname(t)) + sess = c.create_session() + + res = sess.compound([op.putrootfh(), op.reclaim_complete(TRUE)]) + check(res) + + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res)
Signature · 1 line
1.7.6
PATCH v4 2/4 4.1 CLNT: test reclaims after RECLAIM_COMPLETE
In reply to Mi Jinlong--- nfs4.1/server41tests/st_reclaim_complete.py | 29 ++++++++++++++++++++++++++- 1 files changed, 28 insertions(+), 1 deletions(-)
nfs4.1/server41tests/st_reclaim_complete.py +28 -1
@@ -1,6 +1,6 @@ from st_create_session import create_session from nfs4_const import * -from environment import check, fail +from environment import check, fail, open_file, create_confirm import nfs4_ops as op import nfs4lib
@@ -18,3 +18,30 @@ def testSupported(t, env): res = sess.compound([op.reclaim_complete(FALSE)]) check(res) + +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])
Signature · 1 line
1.7.6
PATCH v4 3/4 4.1 CLNT: test open before RECLAIM_COMPLETE
In reply to Mi Jinlong--- nfs4.1/server41tests/st_reclaim_complete.py | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-)
nfs4.1/server41tests/st_reclaim_complete.py +19 -1
@@ -1,6 +1,6 @@ from st_create_session import create_session from nfs4_const import * -from environment import check, fail, open_file, create_confirm +from environment import check, fail, open_file, create_file, create_confirm import nfs4_ops as op import nfs4lib
@@ -45,3 +45,21 @@ def testReclaimAfterRECC(t, env): deleg_type=OPEN_DELEGATE_NONE) check(res, NFS4ERR_NO_GRACE, warnlist = [NFS4ERR_EXIST | NFS4ERR_RECLAIM_BAD]) + +def testOpenBeforeRECC(t, env): + """After a client establishes a new client ID, if non-reclaim + locking operations are done before the RECLAIM_COMPLETE, + error NFS4ERR_GRACE will be returned. rfc5661 18.51.3 + + FLAGS: reclaim_complete all + CODE: RECC3 + """ + name = env.testname(t) + c = env.c1.new_client(name) + sess = c.create_session() + + fname = "owner_%s" % name + path = sess.c.homedir + [name] + + res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH) + check(res, NFS4ERR_GRACE)
Signature · 1 line
1.7.6
PATCH v4 4/4 4.1 CLNT: test RECLAIM_COMPLETE twice
In reply to Mi Jinlong--- nfs4.1/server41tests/st_reclaim_complete.py | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)
nfs4.1/server41tests/st_reclaim_complete.py +18 -0
@@ -63,3 +63,21 @@ def testOpenBeforeRECC(t, env): res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH) check(res, NFS4ERR_GRACE) + +def testDoubleRECC(t, env): + """If RECLAIM_COMPLETE is done a second time, error + NFS4ERR_COMPLETE_ALREADY will be returned. rfc5661 18.51.4 + + FLAGS: reclaim_complete all + CODE: RECC4 + """ + name = env.testname(t) + c = env.c1.new_client(name) + sess = c.create_session() + + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res) + + # RECLAIM_COMPLETE again + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res, NFS4ERR_COMPLETE_ALREADY)
Signature · 1 line
1.7.6
Re: [PATCH 4/4 v4] 4.1 CLNT: test RECLAIM_COMPLETE twice
Thanks, these four look OK; I'll run a quick test and then push them out to my repository.
--b.
Quoted 35 lines · Mi Jinlong
Signed-off-by Mi Jinlong <[email protected]>--- nfs4.1/server41tests/st_reclaim_complete.py | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-)nfs4.1/server41tests/st_reclaim_complete.py +18
-0@@ -63,3 +63,21 @@ def testOpenBeforeRECC(t, env): res = create_file(sess, fname, path, access=OPEN4_SHARE_ACCESS_BOTH) check(res, NFS4ERR_GRACE) + +def testDoubleRECC(t, env): + """If RECLAIM_COMPLETE is done a second time, error + NFS4ERR_COMPLETE_ALREADY will be returned. rfc5661 18.51.4 + + FLAGS: reclaim_complete all + CODE: RECC4 + """ + name = env.testname(t) + c = env.c1.new_client(name) + sess = c.create_session() + + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res) + + # RECLAIM_COMPLETE again + res = sess.compound([op.reclaim_complete(FALSE)]) + check(res, NFS4ERR_COMPLETE_ALREADY)Signature · 1 line
1.7.6