From patchwork Mon Mar 30 09:34:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 6119081 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D78A9BF4A6 for ; Mon, 30 Mar 2015 09:34:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8C19A20303 for ; Mon, 30 Mar 2015 09:34:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1D4BB20357 for ; Mon, 30 Mar 2015 09:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752242AbbC3Jee (ORCPT ); Mon, 30 Mar 2015 05:34:34 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:35645 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751398AbbC3Jed (ORCPT ); Mon, 30 Mar 2015 05:34:33 -0400 Received: by pddn5 with SMTP id n5so54184056pdd.2 for ; Mon, 30 Mar 2015 02:34:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=iLwNRnR9LfcW6zG0q+iIBit+SntlXioyi23uLop/fyY=; b=q3ZHQf9KztPxrYcuctm/MyMam1J76leB3jXNh8oXiataN7AjVeERcR/qV9za7VeFvM HnFCKGf0Gr4kWpzGhRwPUF75Rp5Gj7H0cR5QEdEh0Emmdi1HUfrLxmyOimOw3T9pasko ioxcE9+eUo/UAuPR3vZoDmj2h7vMvHVh0ux1r6vnb133XEiMqT3h5JZwPubQ8a/2CK8X 4j1Tl70gjkXXwFh3PD6gRq07E582Vt2wUhyATIQDZwPBkwgcw+MOXMXnJN42atc/GOof j0VFfXBlVOUDAQLKRxJyc1cX9QmtMHl4JpbJEsfZqWlofSvVy2TZSl9RfPRIMUczG7tY anQw== X-Received: by 10.68.223.226 with SMTP id qx2mr57425309pbc.71.1427708073361; Mon, 30 Mar 2015 02:34:33 -0700 (PDT) Received: from [192.168.99.2] ([104.143.41.79]) by mx.google.com with ESMTPSA id r7sm9906128pdm.16.2015.03.30.02.34.30 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Mar 2015 02:34:32 -0700 (PDT) Message-ID: <551918A4.7060109@gmail.com> Date: Mon, 30 Mar 2015 17:34:28 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: "linux-nfs@vger.kernel.org" , kinglongmee@gmail.com Subject: [PATCH 2/3] 4.1 server tests: new helper new_pnfs_client_session for pnfs client Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kinglong Mee --- nfs4.1/nfs4client.py | 9 +++++ nfs4.1/server41tests/st_block.py | 12 +++---- nfs4.1/server41tests/st_current_stateid.py | 6 ++-- nfs4.1/server41tests/st_debug.py | 12 ++----- nfs4.1/server41tests/st_getdevicelist.py | 54 +++++------------------------- 5 files changed, 26 insertions(+), 67 deletions(-) diff --git a/nfs4.1/nfs4client.py b/nfs4.1/nfs4client.py index 9ffe310..62ccc3a 100644 --- a/nfs4.1/nfs4client.py +++ b/nfs4.1/nfs4client.py @@ -297,6 +297,15 @@ class NFS4Client(rpc.Client, rpc.Server): s.compound([op4.reclaim_complete(FALSE)]) return s + def new_pnfs_client_session(self, name, flags=EXCHGID4_FLAG_USE_PNFS_MDS, sec=None): + # Make sure E_ID returns MDS capabilities + c = self.new_client(name, flags=flags) + if not c.flags & EXCHGID4_FLAG_USE_PNFS_MDS: + fail("Server can not be used as pnfs metadata server") + s = c.create_session(sec=sec) + s.compound([op4.reclaim_complete(FALSE)]) + return s + def create_tag(self): current_stack = inspect.stack() stackid = 0 diff --git a/nfs4.1/server41tests/st_block.py b/nfs4.1/server41tests/st_block.py index a8c43dc..bf968f9 100644 --- a/nfs4.1/server41tests/st_block.py +++ b/nfs4.1/server41tests/st_block.py @@ -15,8 +15,7 @@ def testStateid1(t, env): FLAGS: block CODE: BLOCK1 """ - sess = env.c1.new_client_session(env.testname(t), - flags=EXCHGID4_FLAG_USE_PNFS_MDS) + sess = env.c1.new_pnfs_client_session(env.testname(t)) # Create the file res = create_file(sess, env.testname(t)) check(res) @@ -57,8 +56,7 @@ def testStateid2(t, env): FLAGS: block CODE: BLOCK2 """ - c1 = env.c1.new_client_session(env.testname(t), - flags=EXCHGID4_FLAG_USE_PNFS_MDS) + sess = env.c1.new_pnfs_client_session(env.testname(t)) # Create the file res = create_file(sess, env.testname(t)) check(res) @@ -117,8 +115,7 @@ def testEmptyCommit(t, env): FLAGS: block CODE: BLOCK3 """ - c1 = env.c1.new_client_session(env.testname(t), - flags=EXCHGID4_FLAG_USE_PNFS_MDS) + sess = env.c1.new_pnfs_client_session(env.testname(t)) # Create the file res = create_file(sess, env.testname(t)) check(res) @@ -179,8 +176,7 @@ def testSplitCommit(t, env): FLAGS: block CODE: BLOCK4 """ - sess = env.c1.new_client_session(env.testname(t), - flags=EXCHGID4_FLAG_USE_PNFS_MDS) + sess = env.c1.new_pnfs_client_session(env.testname(t)) # Create the file res = create_file(sess, env.testname(t)) check(res) diff --git a/nfs4.1/server41tests/st_current_stateid.py b/nfs4.1/server41tests/st_current_stateid.py index 98fc76f..aa1f689 100644 --- a/nfs4.1/server41tests/st_current_stateid.py +++ b/nfs4.1/server41tests/st_current_stateid.py @@ -125,8 +125,7 @@ def testOpenLayoutGet(t, env): FLAGS: currentstateid pnfs CODE: CSID7 """ - sess = env.c1.new_client_session(env.testname(t), - flags=EXCHGID4_FLAG_USE_PNFS_MDS) + sess = env.c1.new_pnfs_client_session(env.testname(t)) open_op = open_create_file_op(sess, env.testname(t), open_create=OPEN4_CREATE) res = sess.compound( open_op + @@ -142,8 +141,7 @@ def testOpenSetattr(t, env): CODE: CSID8 """ size = 8 - sess = env.c1.new_client_session(env.testname(t), - flags=EXCHGID4_FLAG_USE_PNFS_MDS) + sess = env.c1.new_pnfs_client_session(env.testname(t)) open_op = open_create_file_op(sess, env.testname(t), open_create=OPEN4_CREATE) res = sess.compound( open_op + diff --git a/nfs4.1/server41tests/st_debug.py b/nfs4.1/server41tests/st_debug.py index efef6b5..233ca54 100644 --- a/nfs4.1/server41tests/st_debug.py +++ b/nfs4.1/server41tests/st_debug.py @@ -94,11 +94,7 @@ def testLayout(t, env): FLAGS: layout all CODE: LAYOUT1 """ - # Make sure E_ID returns MDS capabilities - c1 = env.c1.new_client(env.testname(t), flags=EXCHGID4_FLAG_USE_PNFS_MDS) - if not c1.flags & EXCHGID4_FLAG_USE_PNFS_MDS: - fail("Server can not be used as pnfs metadata server") - sess = c1.create_session() + 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<