Skip to contentSkip to conversation

4.1 server tests: new helper get_blocksize for pnfs client

PATCH In review Kinglong Mee 2 participants 2 messages Mar 30, 2015 – Mar 31, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 4.1 server tests: new helper get_blocksize for pnfs client

---
 nfs4.1/server41tests/environment.py      | 19 ++++++++++
 nfs4.1/server41tests/st_debug.py         | 11 ++----
 nfs4.1/server41tests/st_getdevicelist.py | 59 ++++++++------------------------
 3 files changed, 36 insertions(+), 53 deletions(-)
nfs4.1/server41tests/environment.py +19 -0
index 7cc64b0..11c1b12 100644
@@ -587,6 +587,25 @@ def create_close(sess, owner, path=None, attrs={FATTR4_MODE: 0644},
     close_file(sess, fh, stateid=stateid)
     return fh;
 
+def get_blocksize(sess, path, layout_type=LAYOUT4_BLOCK_VOLUME):
+    """ Test that fs handles layouts type, and get the blocksize
+
+    Returns the blocksize
+    """
+    if path is None:
+        fail("Needs path!!!")
+
+    ops = path + [op.getattr(1<<FATTR4_FS_LAYOUT_TYPES |
+                             1<<FATTR4_LAYOUT_BLKSIZE)]
+    res = sess.compound(ops)
+    check(res)
+    attrdict = res.resarray[-1].obj_attributes
+    if FATTR4_FS_LAYOUT_TYPES not in attrdict:
+        fail("fs_layout_type not available")
+    if LAYOUT4_BLOCK_VOLUME not in attrdict[FATTR4_FS_LAYOUT_TYPES]:
+        fail("layout_type does not contain BLOCK")
+    return attrdict[FATTR4_LAYOUT_BLKSIZE]
+
 def _getname(owner, path):
     if path is None:
         return owner
nfs4.1/server41tests/st_debug.py +2 -9
index 233ca54..2b9890e 100644
@@ -95,14 +95,7 @@ def testLayout(t, env):
     CODE: LAYOUT1
     """
     sess = env.c1.new_pnfs_client_session(env.testname(t))
-    # Test that fs handles block layouts
-    ops = use_obj(env.opts.path) + [op.getattr(1<<FATTR4_FS_LAYOUT_TYPES)]
-    res = sess.compound(ops)
-    check(res)
-    if FATTR4_FS_LAYOUT_TYPES not in res.resarray[-1].obj_attributes:
-        fail("fs_layout_type not available")
-    if LAYOUT4_BLOCK_VOLUME not in res.resarray[-1].obj_attributes[FATTR4_FS_LAYOUT_TYPES]:
-        fail("layout_type does not contain BLOCK")
+    blocksize = get_blocksize(sess, use_obj(env.opts.path))
     # Open the file
     owner = "owner for %s" % env.testname(t)
     # openres = open_file(sess, owner, env.opts.path + ["simple_extent"])
@@ -112,7 +105,7 @@ def testLayout(t, env):
     fh = openres.resarray[-1].object
     ops = [op.putfh(fh),
            op.layoutget(False, LAYOUT4_BLOCK_VOLUME, LAYOUTIOMODE4_READ,
-                        0, 0xffffffff, 0, 0xffff)]
+                        0, 0xffffffff, 4*blocksize, 0xffff)]
     res = sess.compound(ops)
     check(res)
     
nfs4.1/server41tests/st_getdevicelist.py +15 -44

144 lines not on this page · raw message

Signature · 1 line
2.3.4
#1 lore raw

Thanks, I've applied all 3.

Also, I've pushed out a little clean up and some very minimal 4.2 support.

--b.

J. Bruce Fields (9):
4.0 server tests: skip test expecting STALE error 4.0 server tests: note acl tests assume auth_unix 4.1 server tests: remove out-of-date open tests 4.1: remove dead code
4.1 server tests: Allow tests to specify minor version range Update to draft 4.2 xdr
stop setup.py asking whether to setup all subdirectories 4.1 server tests: add basic ALLOCATE test
4.0 server tests: remove unused server workarounds

Kinglong Mee (3):
4.1 server tests: fix typos of FATTR4_FS_LAYOUT_TYPES 4.1 server tests: new helper new_pnfs_client_session for pnfs client 4.1 server tests: new helper get_blocksize for pnfs client