2020-12-19 18:33:14

by Thomas Haynes

[permalink] [raw]
Subject: [pynfs python3 0/7] Python3 patches for st_flex.py

From: Tom Haynes <[email protected]>

Hey Bruce,

This applies on top of the previous patch set.

This passes on my RHEL 8.2 client running python3 against a Hammerspace
server.

Thanks,
Tom

fwiw - In some of the error paths, the system would complain that the
exception StandardError was not defined.

I found this:
https://portingguide.readthedocs.io/en/latest/exceptions.html#the-removed-standarderror

Tom Haynes (7):
CB_LAYOUTRECALL: Make string a byte array
st_flex: Use NFS4_MAXFILELEN in layout calls
st_flex: Provide an empty ff_layoutreturn4 by default for LAYOUTRETURN
st_flex: Use range instead of xrange for python3
st_flex: Test is now redundant
st_flex: Return the layout before closing the file
st_flex: testFlexLayoutStatsSmall needed loving to pass python3

nfs4.1/nfs4client.py | 2 +-
nfs4.1/server41tests/st_flex.py | 124 +++++++++++++++++---------------
2 files changed, 68 insertions(+), 58 deletions(-)

--
2.26.2


2020-12-19 18:33:31

by Thomas Haynes

[permalink] [raw]
Subject: [pynfs python3 2/7] st_flex: Use NFS4_MAXFILELEN in layout calls

From: Tom Haynes <[email protected]>

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 50 ++++++++++++++++-----------------
1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
index d70b216..8150054 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -5,7 +5,7 @@ import nfs_ops
op = nfs_ops.NFS4ops()
from .environment import check, fail, create_file, close_file, open_create_file_op
from xdrdef.nfs4_pack import NFS4Packer as FlexPacker, \
- NFS4Unpacker as FlexUnpacker
+ NFS4Unpacker as FlexUnpacker
from nfs4lib import FancyNFS4Packer, get_nfstime

current_stateid = stateid4(1, '\0' * 12)
@@ -69,11 +69,11 @@ def testFlexGetLayout(t, env):
open_stateid = res.resarray[-2].stateid
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_READ,
- 0, 0xffffffffffffffff, 4196, open_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 4196, open_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
# Parse opaque
- for layout in res.resarray[-1].logr_layout:
+ for layout in res.resarray[-1].logr_layout:
if layout.loc_type == LAYOUT4_FLEX_FILES:
p = FlexUnpacker(layout.loc_body)
opaque = p.unpack_ff_layout4()
@@ -98,7 +98,7 @@ def testFlexLayoutReturnFile(t, env):
open_stateid = res.resarray[-2].stateid
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_READ,
- 0, 0xffffffffffffffff, 4196, open_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 4196, open_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
# Return layout
@@ -106,7 +106,7 @@ def testFlexLayoutReturnFile(t, env):
ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
- layoutreturn_file4(0, 0xffffffffffffffff, layout_stateid, "")))]
+ layoutreturn_file4(0, NFS4_MAXFILELEN, layout_stateid, "")))]
res = sess.compound(ops)
check(res)
res = close_file(sess, fh, stateid=open_stateid)
@@ -132,7 +132,7 @@ def testFlexLayoutOldSeqid(t, env):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_RW,
- 0, 0xffffffffffffffff, 8192, open_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 8192, open_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid = res.resarray[-1].logr_stateid
@@ -144,7 +144,7 @@ def testFlexLayoutOldSeqid(t, env):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_RW,
- 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 8192, lo_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid2 = res.resarray[-1].logr_stateid
@@ -156,7 +156,7 @@ def testFlexLayoutOldSeqid(t, env):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_RW,
- 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 8192, lo_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid3 = res.resarray[-1].logr_stateid
@@ -167,7 +167,7 @@ def testFlexLayoutOldSeqid(t, env):
ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
- layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))]
+ layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, "")))]
res = sess.compound(ops)
check(res, NFS4ERR_OLD_STATEID, "LAYOUTRETURN with an old stateid")
res = close_file(sess, fh, stateid=open_stateid)
@@ -192,8 +192,8 @@ def testFlexLayoutStress(t, env):
for i in range(1000):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
- LAYOUTIOMODE4_READ if i%2 else LAYOUTIOMODE4_RW,
- 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ LAYOUTIOMODE4_READ if i%2 else LAYOUTIOMODE4_RW,
+ 0, NFS4_MAXFILELEN, 8192, lo_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid = res.resarray[-1].logr_stateid
@@ -203,7 +203,7 @@ def testFlexLayoutStress(t, env):
ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
- layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))]
+ layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, "")))]
res = sess.compound(ops)
check(res)
res = close_file(sess, fh, stateid=open_stateid)
@@ -227,7 +227,7 @@ def testFlexGetDevInfo(t, env):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_RW,
- 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 8192, lo_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid = res.resarray[-1].logr_stateid
@@ -251,7 +251,7 @@ def testFlexGetDevInfo(t, env):
ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
- layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))]
+ layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, "")))]
res = sess.compound(ops)
check(res)
res = close_file(sess, fh, stateid=open_stateid)
@@ -275,7 +275,7 @@ def testFlexLayoutTestAccess(t, env):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_RW,
- 0, 0xffffffffffffffff, 8192, open_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 8192, open_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid = res.resarray[-1].logr_stateid
@@ -295,7 +295,7 @@ def testFlexLayoutTestAccess(t, env):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_READ,
- 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 8192, lo_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid = res.resarray[-1].logr_stateid
@@ -342,7 +342,7 @@ def testFlexLayoutStatsSmall(t, env):
open_op = open_create_file_op(sess, env.testname(t) + str(i), open_create=OPEN4_CREATE)
res = sess.compound( open_op +
[op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_RW,
- 0, 0xffffffffffffffff, 4196, current_stateid, 0xffff)])
+ 0, NFS4_MAXFILELEN, 4196, current_stateid, 0xffff)])
check(res, NFS4_OK)
lo_stateid = res.resarray[-1].logr_stateid
fh = res.resarray[-2].object
@@ -395,7 +395,7 @@ def testFlexLayoutStatsSmall(t, env):
ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
- layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, p.get_buffer()))),
+ layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, p.get_buffer()))),
op.close(0, open_stateid)]
res = sess.compound(ops)
check(res)
@@ -415,7 +415,7 @@ def _LayoutStats(t, env, stats):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_RW,
- 0, 0xffffffffffffffff, 8192, lo_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 8192, lo_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
lo_stateid = res.resarray[-1].logr_stateid
@@ -455,7 +455,7 @@ def _LayoutStats(t, env, stats):

# Did not capture these in the gathered traces
offset = 0
- file_length = 0xffffffffffffffff
+ file_length = NFS4_MAXFILELEN
rd_io.ii_count = 0
rd_io.ii_bytes = 0
wr_io.ii_count = 0
@@ -492,7 +492,7 @@ def _LayoutStats(t, env, stats):
ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
- layoutreturn_file4(0, 0xffffffffffffffff, lo_stateid, "")))]
+ layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, "")))]
res = sess.compound(ops)
check(res)
res = close_file(sess, fh, stateid=open_stateid)
@@ -602,7 +602,7 @@ def layoutget_return(sess, fh, open_stateid, allowed_errors=NFS4_OK,
# Get layout
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES, layout_iomode,
- 0, NFS4_UINT64_MAX, 4196, open_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 4196, open_stateid, 0xffff)]
res = sess.compound(ops)
check(res, allowed_errors)
if nfsstat4[res.status] is not 'NFS4_OK':
@@ -614,7 +614,7 @@ def layoutget_return(sess, fh, open_stateid, allowed_errors=NFS4_OK,
ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
- layoutreturn_file4(0, NFS4_UINT64_MAX,
+ layoutreturn_file4(0, NFS4_MAXFILELEN,
layout_stateid, "")))]
else: # Return layout with error
# Get device id
@@ -625,7 +625,7 @@ def layoutget_return(sess, fh, open_stateid, allowed_errors=NFS4_OK,

deviceid = layout.ffl_mirrors[0].ffm_data_servers[0].ffds_deviceid
deverr = device_error4(deviceid, layout_error, layout_error_op)
- ffioerr = ff_ioerr4(0, NFS4_UINT64_MAX, layout_stateid, [deverr])
+ ffioerr = ff_ioerr4(0, NFS4_MAXFILELEN, layout_stateid, [deverr])
fflr = ff_layoutreturn4([ffioerr], [])

p = FlexPacker()
@@ -634,7 +634,7 @@ def layoutget_return(sess, fh, open_stateid, allowed_errors=NFS4_OK,
ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
- layoutreturn_file4(0, NFS4_UINT64_MAX,
+ layoutreturn_file4(0, NFS4_MAXFILELEN,
layout_stateid,
p.get_buffer())))]

--
2.26.2

2020-12-19 18:33:31

by Thomas Haynes

[permalink] [raw]
Subject: [pynfs python3 4/7] st_flex: Use range instead of xrange for python3

From: Tom Haynes <[email protected]>

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
index 7036271..80f5a85 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -1106,7 +1106,7 @@ def testFlexLayoutReturn100(t, env):
fh = res.resarray[-1].object
open_stateid = res.resarray[-2].stateid

- for i in xrange(count):
+ for i in range(count):
layout_error = None if i % layout_error_ratio else NFS4ERR_ACCESS
layoutget_return(sess, fh, open_stateid, layout_error=layout_error)

--
2.26.2

2020-12-19 18:33:46

by Thomas Haynes

[permalink] [raw]
Subject: [pynfs python3 6/7] st_flex: Return the layout before closing the file

From: Tom Haynes <[email protected]>

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 40 +++++++++++++++++++++++++++------
1 file changed, 33 insertions(+), 7 deletions(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
index 3aae441..2b1820c 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -56,6 +56,15 @@ def testStateid1(t, env):
# the server increments by one the value of the "seqid" in each
# subsequent LAYOUTGET and LAYOUTRETURN response,
check_seqid(lo_stateid, i + 2)
+
+ ops = [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, NFS4_MAXFILELEN,
+ lo_stateid, empty_p.get_buffer())))]
+ res = sess.compound(ops)
+ check(res)
+
res = close_file(sess, fh, stateid=open_stateid)
check(res)

@@ -79,13 +88,13 @@ def testFlexLayoutReturnFile(t, env):
res = sess.compound(ops)
check(res)
# Return layout
- layout_stateid = res.resarray[-1].logr_stateid
+ lo_stateid = res.resarray[-1].logr_stateid

ops = [op.putfh(fh),
op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
layoutreturn4(LAYOUTRETURN4_FILE,
layoutreturn_file4(0, NFS4_MAXFILELEN,
- layout_stateid, empty_p.get_buffer())))]
+ lo_stateid, empty_p.get_buffer())))]
res = sess.compound(ops)
check(res)
res = close_file(sess, fh, stateid=open_stateid)
@@ -150,6 +159,15 @@ def testFlexLayoutOldSeqid(t, env):
lo_stateid, empty_p.get_buffer())))]
res = sess.compound(ops)
check(res, NFS4ERR_OLD_STATEID, "LAYOUTRETURN with an old stateid")
+
+ ops = [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, NFS4_MAXFILELEN,
+ lo_stateid3, empty_p.get_buffer())))]
+ res = sess.compound(ops)
+ check(res)
+
res = close_file(sess, fh, stateid=open_stateid)
check(res)

@@ -260,8 +278,8 @@ def testFlexLayoutTestAccess(t, env):
0, NFS4_MAXFILELEN, 8192, open_stateid, 0xffff)]
res = sess.compound(ops)
check(res)
- lo_stateid = res.resarray[-1].logr_stateid
- check_seqid(lo_stateid, 1)
+ lo_stateid1 = res.resarray[-1].logr_stateid
+ check_seqid(lo_stateid1, 1)

layout = res.resarray[-1].logr_layout[-1]
p = FlexUnpacker(layout.loc_body)
@@ -277,11 +295,11 @@ def testFlexLayoutTestAccess(t, env):
ops = [op.putfh(fh),
op.layoutget(False, LAYOUT4_FLEX_FILES,
LAYOUTIOMODE4_READ,
- 0, NFS4_MAXFILELEN, 8192, lo_stateid, 0xffff)]
+ 0, NFS4_MAXFILELEN, 8192, lo_stateid1, 0xffff)]
res = sess.compound(ops)
check(res)
- lo_stateid = res.resarray[-1].logr_stateid
- check_seqid(lo_stateid, 2)
+ lo_stateid2 = res.resarray[-1].logr_stateid
+ check_seqid(lo_stateid2, 2)

layout = res.resarray[-1].logr_layout[-1]
p = FlexUnpacker(layout.loc_body)
@@ -300,6 +318,14 @@ def testFlexLayoutTestAccess(t, env):
if gid_rw != gid_rd:
fail("Expected gid_rd == %s, got %s" % (gid_rd, gid_rw))

+ ops = [op.putfh(fh),
+ op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
+ layoutreturn4(LAYOUTRETURN4_FILE,
+ layoutreturn_file4(0, NFS4_MAXFILELEN,
+ lo_stateid2, empty_p.get_buffer())))]
+ res = sess.compound(ops)
+ check(res)
+
res = close_file(sess, fh, stateid=open_stateid)
check(res)

--
2.26.2

2020-12-19 18:33:51

by Thomas Haynes

[permalink] [raw]
Subject: [pynfs python3 5/7] st_flex: Test is now redundant

From: Tom Haynes <[email protected]>

Signed-off-by: Tom Haynes <[email protected]>
---
nfs4.1/server41tests/st_flex.py | 28 ----------------------------
1 file changed, 28 deletions(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
index 80f5a85..3aae441 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -59,39 +59,11 @@ def testStateid1(t, env):
res = close_file(sess, fh, stateid=open_stateid)
check(res)

-def testFlexGetLayout(t, env):
- """Verify layout handling
-
- FLAGS: flex
- CODE: FFGLO1
- """
- sess = env.c1.new_pnfs_client_session(env.testname(t))
- # Create the file
- res = create_file(sess, env.testname(t))
- check(res)
- # Get layout
- fh = res.resarray[-1].object
- open_stateid = res.resarray[-2].stateid
- ops = [op.putfh(fh),
- op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_READ,
- 0, NFS4_MAXFILELEN, 4196, open_stateid, 0xffff)]
- res = sess.compound(ops)
- check(res)
- # Parse opaque
- for layout in res.resarray[-1].logr_layout:
- if layout.loc_type == LAYOUT4_FLEX_FILES:
- p = FlexUnpacker(layout.loc_body)
- opaque = p.unpack_ff_layout4()
- p.done()
- res = close_file(sess, fh, stateid=open_stateid)
- check(res)
-
def testFlexLayoutReturnFile(t, env):
"""
Return a file's layout

FLAGS: flex
- DEPEND: FFGLO1
CODE: FFLOR1
"""
sess = env.c1.new_pnfs_client_session(env.testname(t))
--
2.26.2

2020-12-20 15:58:04

by Mkrtchyan, Tigran

[permalink] [raw]
Subject: Re: [pynfs python3 6/7] st_flex: Return the layout before closing the file

Hi Tom,

works for me as well with fedora33 and dcache server.

Thanks,
Tigran.

----- Original Message -----
> From: "Tom Haynes" <[email protected]>
> To: "bfields" <[email protected]>
> Cc: "linux-nfs" <[email protected]>
> Sent: Saturday, 19 December, 2020 19:29:47
> Subject: [pynfs python3 6/7] st_flex: Return the layout before closing the file

> From: Tom Haynes <[email protected]>
>
> Signed-off-by: Tom Haynes <[email protected]>
> ---
> nfs4.1/server41tests/st_flex.py | 40 +++++++++++++++++++++++++++------
> 1 file changed, 33 insertions(+), 7 deletions(-)
>
> diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
> index 3aae441..2b1820c 100644
> --- a/nfs4.1/server41tests/st_flex.py
> +++ b/nfs4.1/server41tests/st_flex.py
> @@ -56,6 +56,15 @@ def testStateid1(t, env):
> # the server increments by one the value of the "seqid" in each
> # subsequent LAYOUTGET and LAYOUTRETURN response,
> check_seqid(lo_stateid, i + 2)
> +
> + ops = [op.putfh(fh),
> + op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
> + layoutreturn4(LAYOUTRETURN4_FILE,
> + layoutreturn_file4(0, NFS4_MAXFILELEN,
> + lo_stateid,
> empty_p.get_buffer())))]
> + res = sess.compound(ops)
> + check(res)
> +
> res = close_file(sess, fh, stateid=open_stateid)
> check(res)
>
> @@ -79,13 +88,13 @@ def testFlexLayoutReturnFile(t, env):
> res = sess.compound(ops)
> check(res)
> # Return layout
> - layout_stateid = res.resarray[-1].logr_stateid
> + lo_stateid = res.resarray[-1].logr_stateid
>
> ops = [op.putfh(fh),
> op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
> layoutreturn4(LAYOUTRETURN4_FILE,
> layoutreturn_file4(0, NFS4_MAXFILELEN,
> - layout_stateid,
> empty_p.get_buffer())))]
> + lo_stateid,
> empty_p.get_buffer())))]
> res = sess.compound(ops)
> check(res)
> res = close_file(sess, fh, stateid=open_stateid)
> @@ -150,6 +159,15 @@ def testFlexLayoutOldSeqid(t, env):
> lo_stateid, empty_p.get_buffer())))]
> res = sess.compound(ops)
> check(res, NFS4ERR_OLD_STATEID, "LAYOUTRETURN with an old stateid")
> +
> + ops = [op.putfh(fh),
> + op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
> + layoutreturn4(LAYOUTRETURN4_FILE,
> + layoutreturn_file4(0, NFS4_MAXFILELEN,
> + lo_stateid3,
> empty_p.get_buffer())))]
> + res = sess.compound(ops)
> + check(res)
> +
> res = close_file(sess, fh, stateid=open_stateid)
> check(res)
>
> @@ -260,8 +278,8 @@ def testFlexLayoutTestAccess(t, env):
> 0, NFS4_MAXFILELEN, 8192, open_stateid, 0xffff)]
> res = sess.compound(ops)
> check(res)
> - lo_stateid = res.resarray[-1].logr_stateid
> - check_seqid(lo_stateid, 1)
> + lo_stateid1 = res.resarray[-1].logr_stateid
> + check_seqid(lo_stateid1, 1)
>
> layout = res.resarray[-1].logr_layout[-1]
> p = FlexUnpacker(layout.loc_body)
> @@ -277,11 +295,11 @@ def testFlexLayoutTestAccess(t, env):
> ops = [op.putfh(fh),
> op.layoutget(False, LAYOUT4_FLEX_FILES,
> LAYOUTIOMODE4_READ,
> - 0, NFS4_MAXFILELEN, 8192, lo_stateid, 0xffff)]
> + 0, NFS4_MAXFILELEN, 8192, lo_stateid1, 0xffff)]
> res = sess.compound(ops)
> check(res)
> - lo_stateid = res.resarray[-1].logr_stateid
> - check_seqid(lo_stateid, 2)
> + lo_stateid2 = res.resarray[-1].logr_stateid
> + check_seqid(lo_stateid2, 2)
>
> layout = res.resarray[-1].logr_layout[-1]
> p = FlexUnpacker(layout.loc_body)
> @@ -300,6 +318,14 @@ def testFlexLayoutTestAccess(t, env):
> if gid_rw != gid_rd:
> fail("Expected gid_rd == %s, got %s" % (gid_rd, gid_rw))
>
> + ops = [op.putfh(fh),
> + op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
> + layoutreturn4(LAYOUTRETURN4_FILE,
> + layoutreturn_file4(0, NFS4_MAXFILELEN,
> + lo_stateid2,
> empty_p.get_buffer())))]
> + res = sess.compound(ops)
> + check(res)
> +
> res = close_file(sess, fh, stateid=open_stateid)
> check(res)
>
> --
> 2.26.2

2020-12-21 20:02:19

by J. Bruce Fields

[permalink] [raw]
Subject: Re: [pynfs python3 0/7] Python3 patches for st_flex.py

On Sat, Dec 19, 2020 at 10:29:41AM -0800, Tom Haynes wrote:
> From: Tom Haynes <[email protected]>
>
> Hey Bruce,
>
> This applies on top of the previous patch set.
>
> This passes on my RHEL 8.2 client running python3 against a Hammerspace
> server.

Thanks, and thanks to Tigran for testing; applied.--b.

>
> Thanks,
> Tom
>
> fwiw - In some of the error paths, the system would complain that the
> exception StandardError was not defined.
>
> I found this:
> https://portingguide.readthedocs.io/en/latest/exceptions.html#the-removed-standarderror
>
> Tom Haynes (7):
> CB_LAYOUTRECALL: Make string a byte array
> st_flex: Use NFS4_MAXFILELEN in layout calls
> st_flex: Provide an empty ff_layoutreturn4 by default for LAYOUTRETURN
> st_flex: Use range instead of xrange for python3
> st_flex: Test is now redundant
> st_flex: Return the layout before closing the file
> st_flex: testFlexLayoutStatsSmall needed loving to pass python3
>
> nfs4.1/nfs4client.py | 2 +-
> nfs4.1/server41tests/st_flex.py | 124 +++++++++++++++++---------------
> 2 files changed, 68 insertions(+), 58 deletions(-)
>
> --
> 2.26.2