linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Haynes <loghyr@primarydata.com>
To: "J. Bruce Fields" <bfields@redhat.com>
Cc: Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: [PATCH pynfs 10/12] FFLS1: Simulate LAYOUTSTATS for 20 small file creations
Date: Sat, 26 Nov 2016 22:26:39 -0800	[thread overview]
Message-ID: <1480228001-64821-11-git-send-email-loghyr@primarydata.com> (raw)
In-Reply-To: <1480228001-64821-1-git-send-email-loghyr@primarydata.com>

Signed-off-by: Tom Haynes <loghyr@primarydata.com>
---
 nfs4.1/server41tests/st_flex.py | 84 +++++++++++++++++++++++++++++++++++++=
+++-
 1 file changed, 83 insertions(+), 1 deletion(-)

diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex=
.py
index fdcfd32..6398592 100644
--- a/nfs4.1/server41tests/st_flex.py
+++ b/nfs4.1/server41tests/st_flex.py
@@ -3,11 +3,13 @@ from xdrdef.nfs4_type import *
 from xdrdef.nfs4_pack import *
 import nfs_ops
 op =3D nfs_ops.NFS4ops()
-from environment import check, fail, create_file, close_file
+from environment import check, fail, create_file, close_file, open_create_=
file_op
 from xdrdef.nfs4_pack import NFS4Packer as FlexPacker, \
 =09NFS4Unpacker as FlexUnpacker
 from nfs4lib import FancyNFS4Packer, get_nfstime
=20
+current_stateid =3D stateid4(1, '\0' * 12)
+
 def testStateid1(t, env):
     """Check for proper sequence handling in layout stateids.
=20
@@ -321,3 +323,83 @@ def testFlexLayoutTestAccess(t, env):
=20
     res =3D close_file(sess, fh, stateid=3Dopen_stateid)
     check(res)
+
+def testFlexLayoutStatsSmall(t, env):
+    """Open 20 "small" files and simulate LAYOUTSTATS for them
+    1) OPEN, LAYOUTGET
+    2) GETDEVINFO
+    3) LAYOUTRETURN, CLOSE
+
+    FLAGS: flex
+    CODE: FFLS1
+    """
+    lats =3D [93089, 107683, 112340, 113195, 130412, 138390, 140427, 15882=
4, 193078, 201879, 391634, 404757, 2201181, 2232614, 2280089, 2296343, 2341=
763, 2392984, 3064546, 3070314]
+    durs =3D [3387666, 3439506, 3737081, 4448315, 4380523, 4419273, 441974=
6, 5903420, 5932432, 5932938, 7573082, 11085497, 11125274, 11126513, 137203=
03, 15990926, 16020425, 16020948, 20181628, 20213871]
+
+    if len(lats) !=3D len(durs):
+        fail("Lats and durs not same")
+
+    sess =3D env.c1.new_pnfs_client_session(env.testname(t))
+
+    for i in range(len(lats)):
+        open_op =3D open_create_file_op(sess, env.testname(t) + str(i), op=
en_create=3DOPEN4_CREATE)
+        res =3D sess.compound( open_op +
+               [op.layoutget(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_RW,
+                            0, 0xffffffffffffffff, 4196, current_stateid, =
0xffff)])
+        check(res, NFS4_OK)
+        lo_stateid =3D res.resarray[-1].logr_stateid
+        fh =3D res.resarray[-2].object
+        open_stateid =3D res.resarray[-3].stateid
+
+        if lo_stateid.seqid !=3D 1:
+            fail("Expected stateid.seqid=3D=3D%i, got %i" % (1, lo_stateid=
.seqid))
+
+        layout =3D res.resarray[-1].logr_layout[-1]
+        p =3D FlexUnpacker(layout.loc_body)
+        opaque =3D p.unpack_ff_layout4()
+        p.done()
+
+        # Assume one mirror/storage device
+        ds =3D opaque.ffl_mirrors[-1].ffm_data_servers[-1]
+
+        stats_hint =3D opaque.ffl_stats_collect_hint
+
+        deviceid =3D ds.ffds_deviceid
+
+        ops =3D [op.putfh(fh),
+               op.getdeviceinfo(deviceid, LAYOUT4_FLEX_FILES, 0xffffffff, =
0)]
+        res =3D sess.compound(ops)
+        check(res)
+
+        gda =3D res.resarray[-1].gdir_device_addr
+
+        p =3D FlexUnpacker(gda.da_addr_body)
+        da =3D p.unpack_ff_device_addr4()
+        p.done()
+
+        rd_io =3D io_info4(0, 0)
+        wr_io =3D io_info4(1, 16384)
+
+        rd_lat =3D ff_io_latency4(0, 0, 0, 0, 0, nfstime4(0, 0), nfstime4(=
0, 0))
+        wr_lat =3D ff_io_latency4(1, 16384, 1, 16384, 0, nfstime4(0, lats[=
i]), nfstime4(0, lats[i]))
+
+        offset =3D 0
+        file_length =3D 16384
+
+        dur =3D durs[i]
+        fflu =3D ff_layoutupdate4(da.ffda_netaddrs[-1], ds.ffds_fh_vers[-1=
],
+                                rd_lat, wr_lat, nfstime4(0, dur), True)
+
+        ffio =3D ff_iostats4(offset, file_length, lo_stateid, rd_io, wr_io=
, deviceid, fflu)
+        fflr =3D ff_layoutreturn4([], [ffio])
+
+        p =3D FlexPacker()
+        p.pack_ff_layoutreturn4(fflr)
+
+        ops =3D [op.putfh(fh),
+               op.layoutreturn(False, LAYOUT4_FLEX_FILES, LAYOUTIOMODE4_AN=
Y,
+                               layoutreturn4(LAYOUTRETURN4_FILE,
+                                             layoutreturn_file4(0, 0xfffff=
fffffffffff, lo_stateid, p.get_buffer()))),
+               op.close(0, open_stateid)]
+        res =3D sess.compound(ops)
+        check(res)
--=20
2.3.6


  parent reply	other threads:[~2016-11-27  6:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-27  6:26 [PATCH pynfs 00/12] Flex File support Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 01/12] According to RFC7863, this is not an array Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 02/12] Close the files opened in the OPEN tests Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 03/12] Some more file closes to cleanup state on the server Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 04/12] Get rid of the client records as well as the session records Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 05/12] Really, really close those open temp files to remove state on the server Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 06/12] Add xdr for Flex Files Layout Type Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 07/12] Simple tests of the flex file layout type Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 08/12] Add a check to see if NFS4ERR_OLD_STATEID is issued on concurrent layoutgets Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 09/12] Check that the flex file access uid/gid are correct for the different iomodes Tom Haynes
2016-11-27  6:26 ` Tom Haynes [this message]
2016-11-27  6:26 ` [PATCH pynfs 11/12] Factor out checking seqid for flex file layouts Tom Haynes
2016-11-27  6:26 ` [PATCH pynfs 12/12] Add layoutstats tests for flex files Tom Haynes
2016-11-28 17:22   ` J. Bruce Fields
2016-11-28 17:52     ` Tom Haynes
2016-11-28 16:33 ` [PATCH pynfs 00/12] Flex File support J. Bruce Fields
2016-11-28 16:53   ` Tom Haynes
2016-11-28 21:47   ` J. Bruce Fields
2016-11-28 23:38     ` Tom Haynes
2016-11-29  1:55       ` J. Bruce Fields
2016-11-29 23:44   ` Frank Filz
2016-11-30 14:24     ` J. Bruce Fields
2016-11-30 16:56       ` Frank Filz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480228001-64821-11-git-send-email-loghyr@primarydata.com \
    --to=loghyr@primarydata.com \
    --cc=bfields@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).