From patchwork Sun Nov 27 06:26:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Haynes X-Patchwork-Id: 9448705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C871C6071C for ; Sun, 27 Nov 2016 06:27:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1BF9212D9 for ; Sun, 27 Nov 2016 06:27:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A695422376; Sun, 27 Nov 2016 06:27:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2495820855 for ; Sun, 27 Nov 2016 06:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753358AbcK0G1q (ORCPT ); Sun, 27 Nov 2016 01:27:46 -0500 Received: from us-smtp-delivery-194.mimecast.com ([63.128.21.194]:23273 "EHLO us-smtp-delivery-194.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753079AbcK0G1p (ORCPT ); Sun, 27 Nov 2016 01:27:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=PrimaryData.onmicrosoft.com; s=selector1-primarydata-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Lz9sx/2Jd1UIwmyFvXvJfGOevMeJmmvR8Y5SQ2eDaV0=; b=ZrpdZCyHKJgQCPLsgA88H7IUTJJcdTlGkycyWoexUC8kTpi7R8kliII20m/532r4zRTb7osLnmEnhGHjNabzUcJ1r4CxmdiXQHmS/4EXszgDOsspimL5vcPsQrzWPjOd2azXfD0u/yvSnzzZ8PoddSXpDNCASOR7WHZbwTKE+DY= Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02lp0018.outbound.protection.outlook.com [216.32.180.18]) (Using TLS) by us-smtp-1.mimecast.com with ESMTP id us-mta-66-WVmX8kJZMK22d3FPVwBN7A-6; Sun, 27 Nov 2016 01:27:38 -0500 Received: from jhereg.localdomain (73.202.55.195) by BN6PR11MB1364.namprd11.prod.outlook.com (10.173.33.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.10; Sun, 27 Nov 2016 06:27:27 +0000 From: Tom Haynes To: "J. Bruce Fields" CC: Linux NFS Mailing list Subject: [PATCH pynfs 11/12] Factor out checking seqid for flex file layouts Date: Sat, 26 Nov 2016 22:26:40 -0800 Message-ID: <1480228001-64821-12-git-send-email-loghyr@primarydata.com> X-Mailer: git-send-email 2.3.6 In-Reply-To: <1480228001-64821-1-git-send-email-loghyr@primarydata.com> References: <1480228001-64821-1-git-send-email-loghyr@primarydata.com> MIME-Version: 1.0 X-Originating-IP: [73.202.55.195] X-ClientProxiedBy: DM2PR07CA0047.namprd07.prod.outlook.com (10.141.52.175) To BN6PR11MB1364.namprd11.prod.outlook.com (10.173.33.8) X-MS-Office365-Filtering-Correlation-Id: bc81d54f-5034-478c-7083-08d4168e75c2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN6PR11MB1364; X-Microsoft-Exchange-Diagnostics: 1; BN6PR11MB1364; 3:H1c6BKE1pe2/vHf4AqPqrcTVYedlEnDeQasFXozAjdZ3wmfQNgAvihPv6qLXuG1lNkNNGl6RXC6yjf6aSTO/tHmQBne+SVzjXK04sbnHG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EsGH/PKNzQDyQIZMIp7mRgSJ4tFIGD8y2v1rbP9Pwzx6qyAIvmakeFF9ir26U= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6060326)(6045199)(6040361)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6041248)(6061324)(20161123560025)(2016111802025)(20161123555025)(20161123564025)(20161123562025)(6072148)(6043046); SRVR:BN6PR11MB1364; BCL:0; PCL:0; RULEID:; SRVR:BN6PR11MB1364; X-Microsoft-Exchange-Diagnostics: 1; BN6PR11MB1364; 4:RGJ+XALbavXlDIQYH4UPbdrk18PjQUBSXYk0hzOJcdaCIyz+4bVIDHpvM0FTMz9n5kGXRw08+3k/FwI6hBZfmw/9Ut0fnOLOoMW7+CYm9kSnv9F9a6xLLuhnyIKor0m5HtHg8SBcyzOrPrJLeLk8Tdvg+ZD/ItE1NWD9DMT05vLO1lngjtA2tk+a+9I7XeTPokFnrI1JTTxodsUYhWc3xi1XmGFWS/wbMBpo3mnNM50FKO5hWVJKpTTHHbOf4ln6qKWGlTr3Aw3hCpQmnAHpdJFh2iOXGnqvM7xEzOtCsg3pJ+qormGH43NKvbriv/mW3fDhw9yenSAIhRGIoSieQt/5KkZpIGCFz3OB7GJ6hUI5HVVo6jRP2Uq3cTmqq6JB2BpU82QvqT/mMTZlU3IQKpjJbwJksyYhGKlByMRkrbLlpKSTHXTEzqTg4j/juM/SI38dH/kpwTdIiJBLdHTKhsslZwRqzjHXEwaLfqs4AoSLf6E/CY1hj27EBTp+i/PAoWp0QyMA4ssB+eGj2Ct/pZ45yUOpi10BTZ6/H6siscTSTJpvRxZ2LqLE0NtXPqYc4M0O9NO7QfJb+s8crJqI9EYOYCzkrFVF9EsJiuKfhoOxJWZRwnTmYwESZeo9jLWvZ2JWSwLvhr97WbwCWLe4xG4nWVkBSbQf23iFx9PZS+WtH5z7C9AKbI8oFPj98ix2S12LNMxhGqJq1Z4MUlfYM5ZZJukjXwYcfX9r49uRaQU= X-Forefront-PRVS: 0139052FDB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(50986999)(86362001)(5003940100001)(68736007)(305945005)(7736002)(7846002)(105586002)(101416001)(97736004)(42186005)(92566002)(76176999)(36756003)(66066001)(38730400001)(47776003)(110136003)(33646002)(106356001)(39450400002)(733004)(2950100002)(50466002)(8676002)(6916009)(6666003)(81166006)(81156014)(4326007)(50226002)(5660300001)(48376002)(2906002)(6116002)(3846002)(39400400001)(39380400001)(39410400001)(6486002)(189998001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR11MB1364; H:jhereg.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR11MB1364; 23:TjP2QYhi/wxY1TrOTPOaoue8Pmbt3SlA/NShaONKu?= =?us-ascii?Q?2/wKmo22XLNKl50lnHReGo4GYx068MAtesRZCpEBxiJQD4S0rUwmpat8wIV9?= =?us-ascii?Q?D+sKsLaSWwdBtsChdZ5K+dkCd2oPQ8GIus8mbewPAY/jkjlrZaq00Aq67R2m?= =?us-ascii?Q?BLmGTVBJ/gRaGhvOGvfTFnd5Tyemuwb0fB3c/bgeGIIuyIGthXM1H6GRSsnB?= =?us-ascii?Q?ePLU1M9KN46gWksk5UTouQgyOxBdpLn1Lin4WDzWJf5EyEdLMJB50hlS47YN?= =?us-ascii?Q?H/l/wkAJcmN1HouoURFFs258tmSp+p5mbiFkT3cEC5xqmp5i1QVlsMCJJJq4?= =?us-ascii?Q?OSEZzcbkh6HJl4sx+JpnGGcldd56wxUwQl1+n2ts6PpfVedvd2+WVO9Urf7h?= =?us-ascii?Q?oV6w8PzXnQM0i77oAxxYqdOuvPu5hIwmj6Q8/rayMxuOuGDnIOEZLRIlwjAi?= =?us-ascii?Q?2yAu++SScIQYlSiT9fOe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ZXC6QIy/CSa+Z04NNVntEloPJMSQ==; 20:5IRhQ5BB7ynh/QYpdqxUXfelWRFZuf1a/QnYcL++UjTyVck0udkWX7ygGHCaR76B1VD8FUwb4KxotsPJR41M3X5Wi/vMSFC7xovwD7Fn58V9JvX2fUFnUwLqf+Z/0nUfs/zoH4CjEbWbWi4AC8YvIVXjM9YhUu7Z0X1JPFQJY74= X-OriginatorOrg: primarydata.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2016 06:27:27.9173 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1364 X-MC-Unique: WVmX8kJZMK22d3FPVwBN7A-6 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tom Haynes --- nfs4.1/server41tests/st_flex.py | 48 +++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 26 deletions(-) diff --git a/nfs4.1/server41tests/st_flex.py b/nfs4.1/server41tests/st_flex.py index 6398592..06dbba8 100644 --- a/nfs4.1/server41tests/st_flex.py +++ b/nfs4.1/server41tests/st_flex.py @@ -10,6 +10,10 @@ from nfs4lib import FancyNFS4Packer, get_nfstime current_stateid = stateid4(1, '\0' * 12) +def check_seqid(stateid, seqid): + if stateid.seqid != seqid: + fail("Expected stateid.seqid==%i, got %i" % (seqid, stateid.seqid)) + def testStateid1(t, env): """Check for proper sequence handling in layout stateids. @@ -29,11 +33,12 @@ def testStateid1(t, env): res = sess.compound(ops) check(res) lo_stateid = res.resarray[-1].logr_stateid - if lo_stateid.seqid != 1: - # From draft23 12.5.2 "The first successful LAYOUTGET processed by - # the server using a non-layout stateid as an argument MUST have the - # "seqid" field of the layout stateid in the response set to one." - fail("Expected stateid.seqid==1, got %i" % lo_stateid.seqid) + + # From draft23 12.5.2 "The first successful LAYOUTGET processed by + # the server using a non-layout stateid as an argument MUST have the + # "seqid" field of the layout stateid in the response set to one." + check_seqid(lo_stateid, 1) + for i in range(6): # Get subsequent layouts ops = [op.putfh(fh), @@ -42,11 +47,10 @@ def testStateid1(t, env): res = sess.compound(ops) check(res) lo_stateid = res.resarray[-1].logr_stateid - if lo_stateid.seqid != i + 2: - # From draft23 12.5.3 "After the layout stateid is established, - # the server increments by one the value of the "seqid" in each - # subsequent LAYOUTGET and LAYOUTRETURN response, - fail("Expected stateid.seqid==%i, got %i" % (i+2, lo_stateid.seqid)) + # From draft23 12.5.3 "After the layout stateid is established, + # the server increments by one the value of the "seqid" in each + # subsequent LAYOUTGET and LAYOUTRETURN response, + check_seqid(lo_stateid, i + 2) res = close_file(sess, fh, stateid=open_stateid) check(res) @@ -133,8 +137,7 @@ def testFlexLayoutOldSeqid(t, env): check(res) lo_stateid = res.resarray[-1].logr_stateid - if lo_stateid.seqid != seqid_next: - fail("Expected stateid.seqid==%i, got %i" % (seqid_next, lo_stateid.seqid)) + check_seqid(lo_stateid, seqid_next) seqid_next += 1 # Get the first with the lo_stateid @@ -146,8 +149,7 @@ def testFlexLayoutOldSeqid(t, env): check(res) lo_stateid2 = res.resarray[-1].logr_stateid - if lo_stateid2.seqid != seqid_next: - fail("Expected stateid.seqid==%i, got %i" % (seqid_next, lo_stateid2.seqid)) + check_seqid(lo_stateid2, seqid_next) seqid_next += 1 # Get the second with the original lo_stateid @@ -159,8 +161,7 @@ def testFlexLayoutOldSeqid(t, env): check(res) lo_stateid3 = res.resarray[-1].logr_stateid - if lo_stateid3.seqid != seqid_next: - fail("Expected stateid.seqid==%i, got %i" % (seqid_next, lo_stateid3.seqid)) + check_seqid(lo_stateid3, seqid_next) seqid_next += 1 ops = [op.putfh(fh), @@ -196,8 +197,7 @@ def testFlexLayoutStress(t, env): res = sess.compound(ops) check(res) lo_stateid = res.resarray[-1].logr_stateid - if lo_stateid.seqid != seqid_next: - fail("Expected stateid.seqid==%i, got %i" % (seqid_next, lo_stateid.seqid)) + check_seqid(lo_stateid, seqid_next) seqid_next += 1 ops = [op.putfh(fh), @@ -231,8 +231,7 @@ def testFlexGetDevInfo(t, env): res = sess.compound(ops) check(res) lo_stateid = res.resarray[-1].logr_stateid - if lo_stateid.seqid != 1: - fail("Expected stateid.seqid==%i, got %i" % (1, lo_stateid.seqid)) + check_seqid(lo_stateid, 1) layout = res.resarray[-1].logr_layout[-1] p = FlexUnpacker(layout.loc_body) @@ -280,8 +279,7 @@ def testFlexLayoutTestAccess(t, env): res = sess.compound(ops) check(res) lo_stateid = res.resarray[-1].logr_stateid - if lo_stateid.seqid != 1: - fail("Expected stateid.seqid==%i, got %i" % (1, lo_stateid.seqid)) + check_seqid(lo_stateid, 1) layout = res.resarray[-1].logr_layout[-1] p = FlexUnpacker(layout.loc_body) @@ -301,8 +299,7 @@ def testFlexLayoutTestAccess(t, env): res = sess.compound(ops) check(res) lo_stateid = res.resarray[-1].logr_stateid - if lo_stateid.seqid != 2: - fail("Expected stateid.seqid==%i, got %i" % (2, lo_stateid.seqid)) + check_seqid(lo_stateid, 2) layout = res.resarray[-1].logr_layout[-1] p = FlexUnpacker(layout.loc_body) @@ -351,8 +348,7 @@ def testFlexLayoutStatsSmall(t, env): fh = res.resarray[-2].object open_stateid = res.resarray[-3].stateid - if lo_stateid.seqid != 1: - fail("Expected stateid.seqid==%i, got %i" % (1, lo_stateid.seqid)) + check_seqid(lo_stateid, 1) layout = res.resarray[-1].logr_layout[-1] p = FlexUnpacker(layout.loc_body)