All of lore.kernel.org
 help / color / mirror / Atom feed
* [pynfs python3 0/7] Python3 patches for st_flex.py
@ 2020-12-19 18:29 Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 1/7] CB_LAYOUTRECALL: Make string a byte array Tom Haynes
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Tom Haynes @ 2020-12-19 18:29 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

From: Tom Haynes <loghyr@excfb.com>

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [pynfs python3 1/7] CB_LAYOUTRECALL: Make string a byte array
  2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
@ 2020-12-19 18:29 ` Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 2/7] st_flex: Use NFS4_MAXFILELEN in layout calls Tom Haynes
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tom Haynes @ 2020-12-19 18:29 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

From: Tom Haynes <loghyr@excfb.com>

Signed-off-by: Tom Haynes <loghyr@excfb.com>
---
 nfs4.1/nfs4client.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py
index f06d9c5..df573d6 100644
--- a/nfs4.1/nfs4client.py
+++ b/nfs4.1/nfs4client.py
@@ -296,7 +296,7 @@ class NFS4Client(rpc.Client, rpc.Server):
                       layoutreturn4(LAYOUTRETURN4_FILE,
                                     layoutreturn_file4(rclayout.lor_offset,
                                                        rclayout.lor_length, \
-                                                       rclayout.lor_stateid, "")))]
+                                                       rclayout.lor_stateid, b"")))]
             env.session.compound(ops)
         elif lo_recalltype not in [LAYOUTRECALL4_FSID, LAYOUTRECALL4_ALL]:
             res = NFS4ERR_NOTSUPP
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [pynfs python3 2/7] st_flex: Use NFS4_MAXFILELEN in layout calls
  2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 1/7] CB_LAYOUTRECALL: Make string a byte array Tom Haynes
@ 2020-12-19 18:29 ` Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 3/7] st_flex: Provide an empty ff_layoutreturn4 by default for LAYOUTRETURN Tom Haynes
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tom Haynes @ 2020-12-19 18:29 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

From: Tom Haynes <loghyr@excfb.com>

Signed-off-by: Tom Haynes <loghyr@excfb.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [pynfs python3 3/7] st_flex: Provide an empty ff_layoutreturn4 by default for LAYOUTRETURN
  2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 1/7] CB_LAYOUTRECALL: Make string a byte array Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 2/7] st_flex: Use NFS4_MAXFILELEN in layout calls Tom Haynes
@ 2020-12-19 18:29 ` Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 4/7] st_flex: Use range instead of xrange for python3 Tom Haynes
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tom Haynes @ 2020-12-19 18:29 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

From: Tom Haynes <loghyr@excfb.com>

Signed-off-by: Tom Haynes <loghyr@excfb.com>
---
 nfs4.1/server41tests/st_flex.py | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
index 8150054..7036271 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -10,6 +10,11 @@ from nfs4lib import FancyNFS4Packer, get_nfstime
 
 current_stateid = stateid4(1, '\0' * 12)
 
+empty_fflr = ff_layoutreturn4([], [])
+
+empty_p = FlexPacker()
+empty_p.pack_ff_layoutreturn4(empty_fflr)
+
 def check_seqid(stateid, seqid):
     if stateid.seqid != seqid:
         fail("Expected stateid.seqid==%i, got %i" % (seqid, stateid.seqid))
@@ -103,10 +108,12 @@ def testFlexLayoutReturnFile(t, env):
     check(res)
     # Return layout
     layout_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, "")))]
+                                         layoutreturn_file4(0, NFS4_MAXFILELEN,
+                                                            layout_stateid, empty_p.get_buffer())))]
     res = sess.compound(ops)
     check(res)
     res = close_file(sess, fh, stateid=open_stateid)
@@ -167,7 +174,8 @@ def testFlexLayoutOldSeqid(t, env):
     ops = [op.putfh(fh),
            op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
                            layoutreturn4(LAYOUTRETURN4_FILE,
-                                         layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, "")))]
+                                         layoutreturn_file4(0, NFS4_MAXFILELEN,
+                                                            lo_stateid, empty_p.get_buffer())))]
     res = sess.compound(ops)
     check(res, NFS4ERR_OLD_STATEID, "LAYOUTRETURN with an old stateid")
     res = close_file(sess, fh, stateid=open_stateid)
@@ -203,7 +211,8 @@ def testFlexLayoutStress(t, env):
     ops = [op.putfh(fh),
            op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
                            layoutreturn4(LAYOUTRETURN4_FILE,
-                                         layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, "")))]
+                                         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)
@@ -251,7 +260,8 @@ def testFlexGetDevInfo(t, env):
     ops = [op.putfh(fh),
            op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
                            layoutreturn4(LAYOUTRETURN4_FILE,
-                                         layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, "")))]
+                                         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)
@@ -395,7 +405,8 @@ def testFlexLayoutStatsSmall(t, env):
         ops = [op.putfh(fh),
                op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
                                layoutreturn4(LAYOUTRETURN4_FILE,
-                                             layoutreturn_file4(0, NFS4_MAXFILELEN, 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)
@@ -492,7 +503,8 @@ def _LayoutStats(t, env, stats):
     ops = [op.putfh(fh),
            op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
                            layoutreturn4(LAYOUTRETURN4_FILE,
-                                         layoutreturn_file4(0, NFS4_MAXFILELEN, lo_stateid, "")))]
+                                         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)
@@ -615,7 +627,7 @@ def layoutget_return(sess, fh, open_stateid, allowed_errors=NFS4_OK,
                op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_ANY,
                                layoutreturn4(LAYOUTRETURN4_FILE,
                                              layoutreturn_file4(0, NFS4_MAXFILELEN,
-                                                                layout_stateid, "")))]
+                                                                layout_stateid, empty_p.get_buffer())))]
     else:  # Return layout with error
         # Get device id
         locb = res.resarray[-1].logr_layout[0].lo_content.loc_body
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [pynfs python3 4/7] st_flex: Use range instead of xrange for python3
  2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
                   ` (2 preceding siblings ...)
  2020-12-19 18:29 ` [pynfs python3 3/7] st_flex: Provide an empty ff_layoutreturn4 by default for LAYOUTRETURN Tom Haynes
@ 2020-12-19 18:29 ` Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 5/7] st_flex: Test is now redundant Tom Haynes
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tom Haynes @ 2020-12-19 18:29 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

From: Tom Haynes <loghyr@excfb.com>

Signed-off-by: Tom Haynes <loghyr@excfb.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [pynfs python3 5/7] st_flex: Test is now redundant
  2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
                   ` (3 preceding siblings ...)
  2020-12-19 18:29 ` [pynfs python3 4/7] st_flex: Use range instead of xrange for python3 Tom Haynes
@ 2020-12-19 18:29 ` Tom Haynes
  2020-12-19 18:29 ` [pynfs python3 6/7] st_flex: Return the layout before closing the file Tom Haynes
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Tom Haynes @ 2020-12-19 18:29 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

From: Tom Haynes <loghyr@excfb.com>

Signed-off-by: Tom Haynes <loghyr@excfb.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [pynfs python3 6/7] st_flex: Return the layout before closing the file
  2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
                   ` (4 preceding siblings ...)
  2020-12-19 18:29 ` [pynfs python3 5/7] st_flex: Test is now redundant Tom Haynes
@ 2020-12-19 18:29 ` Tom Haynes
  2020-12-20 15:56   ` Mkrtchyan, Tigran
  2020-12-19 18:29 ` [pynfs python3 7/7] st_flex: testFlexLayoutStatsSmall needed loving to pass python3 Tom Haynes
  2020-12-21 20:00 ` [pynfs python3 0/7] Python3 patches for st_flex.py J. Bruce Fields
  7 siblings, 1 reply; 10+ messages in thread
From: Tom Haynes @ 2020-12-19 18:29 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

From: Tom Haynes <loghyr@excfb.com>

Signed-off-by: Tom Haynes <loghyr@excfb.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [pynfs python3 7/7] st_flex: testFlexLayoutStatsSmall needed loving to pass python3
  2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
                   ` (5 preceding siblings ...)
  2020-12-19 18:29 ` [pynfs python3 6/7] st_flex: Return the layout before closing the file Tom Haynes
@ 2020-12-19 18:29 ` Tom Haynes
  2020-12-21 20:00 ` [pynfs python3 0/7] Python3 patches for st_flex.py J. Bruce Fields
  7 siblings, 0 replies; 10+ messages in thread
From: Tom Haynes @ 2020-12-19 18:29 UTC (permalink / raw)
  To: Bruce Fields; +Cc: Linux NFS Mailing list

From: Tom Haynes <loghyr@excfb.com>

Signed-off-by: Tom Haynes <loghyr@excfb.com>
---
 nfs4.1/server41tests/st_flex.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py
index 2b1820c..169db69 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -8,7 +8,7 @@ from xdrdef.nfs4_pack import NFS4Packer as FlexPacker, \
     NFS4Unpacker as FlexUnpacker
 from nfs4lib import FancyNFS4Packer, get_nfstime
 
-current_stateid = stateid4(1, '\0' * 12)
+current_stateid = stateid4(1, b'\0' * 12)
 
 empty_fflr = ff_layoutreturn4([], [])
 
@@ -347,8 +347,8 @@ def testFlexLayoutStatsSmall(t, env):
     sess = env.c1.new_pnfs_client_session(env.testname(t))
 
     for i in range(len(lats)):
-        open_op = open_create_file_op(sess, env.testname(t) + str(i), open_create=OPEN4_CREATE)
-        res = sess.compound( open_op +
+        open_op = open_create_file_op(sess, b'%s_%i' % (env.testname(t), i), open_create=OPEN4_CREATE)
+        res = sess.compound(open_op +
                [op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_RW,
                             0, NFS4_MAXFILELEN, 4196, current_stateid, 0xffff)])
         check(res, NFS4_OK)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [pynfs python3 6/7] st_flex: Return the layout before closing the file
  2020-12-19 18:29 ` [pynfs python3 6/7] st_flex: Return the layout before closing the file Tom Haynes
@ 2020-12-20 15:56   ` Mkrtchyan, Tigran
  0 siblings, 0 replies; 10+ messages in thread
From: Mkrtchyan, Tigran @ 2020-12-20 15:56 UTC (permalink / raw)
  To: Tom Haynes; +Cc: bfields, linux-nfs

Hi Tom,

works for me as well with fedora33 and dcache server.

Thanks,
   Tigran.

----- Original Message -----
> From: "Tom Haynes" <loghyr@gmail.com>
> To: "bfields" <bfields@redhat.com>
> Cc: "linux-nfs" <linux-nfs@vger.kernel.org>
> 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 <loghyr@excfb.com>
> 
> Signed-off-by: Tom Haynes <loghyr@excfb.com>
> ---
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [pynfs python3 0/7] Python3 patches for st_flex.py
  2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
                   ` (6 preceding siblings ...)
  2020-12-19 18:29 ` [pynfs python3 7/7] st_flex: testFlexLayoutStatsSmall needed loving to pass python3 Tom Haynes
@ 2020-12-21 20:00 ` J. Bruce Fields
  7 siblings, 0 replies; 10+ messages in thread
From: J. Bruce Fields @ 2020-12-21 20:00 UTC (permalink / raw)
  To: Tom Haynes; +Cc: Bruce Fields, Linux NFS Mailing list

On Sat, Dec 19, 2020 at 10:29:41AM -0800, Tom Haynes wrote:
> From: Tom Haynes <loghyr@excfb.com>
> 
> 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-12-21 20:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-19 18:29 [pynfs python3 0/7] Python3 patches for st_flex.py Tom Haynes
2020-12-19 18:29 ` [pynfs python3 1/7] CB_LAYOUTRECALL: Make string a byte array Tom Haynes
2020-12-19 18:29 ` [pynfs python3 2/7] st_flex: Use NFS4_MAXFILELEN in layout calls Tom Haynes
2020-12-19 18:29 ` [pynfs python3 3/7] st_flex: Provide an empty ff_layoutreturn4 by default for LAYOUTRETURN Tom Haynes
2020-12-19 18:29 ` [pynfs python3 4/7] st_flex: Use range instead of xrange for python3 Tom Haynes
2020-12-19 18:29 ` [pynfs python3 5/7] st_flex: Test is now redundant Tom Haynes
2020-12-19 18:29 ` [pynfs python3 6/7] st_flex: Return the layout before closing the file Tom Haynes
2020-12-20 15:56   ` Mkrtchyan, Tigran
2020-12-19 18:29 ` [pynfs python3 7/7] st_flex: testFlexLayoutStatsSmall needed loving to pass python3 Tom Haynes
2020-12-21 20:00 ` [pynfs python3 0/7] Python3 patches for st_flex.py J. Bruce Fields

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.