From patchwork Thu Aug 6 19:15:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 11704135 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AC18913 for ; Thu, 6 Aug 2020 19:15:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4850C2224D for ; Thu, 6 Aug 2020 19:15:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725927AbgHFTPY (ORCPT ); Thu, 6 Aug 2020 15:15:24 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:32916 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725272AbgHFTPX (ORCPT ); Thu, 6 Aug 2020 15:15:23 -0400 Received: by mail-pl1-f193.google.com with SMTP id g19so15704526plq.0 for ; Thu, 06 Aug 2020 12:15:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RvtTADagnnCiX9G36QO3CyWOxm7jHsOMd2MXrfM8ToI=; b=hcAoj5/1pXHa0pykwtx+TZ7c3eFenWv5jYACYdmgc4rwIIwgWNHD8hIfkEuFOeC4H4 7S0qfBIsNTaIww2U5/a7/0MmjpbaMoDPRarDCt8hDZLkYDuNi1OUWpgIrlaZpG1j6IMc O5gNU25X6FFFTHCIX1qgyh5G1KX0oe2FW/N+D/THq603WP7XxOPDJeMxmQNEdL25CpgV BCiXzk6fWgnJn9cAjJ3dFxUNA00E6KGBSDuvusGOpoaL0AuXGgzA6pk4X/J+HBxwgvko eYkW7IVrDAxN+NreBa1iC0gu8Xd1tvWX1EGj414IaDa07G8yRuusw31OLX1WJOdP970w WREg== X-Gm-Message-State: AOAM532cieHyI1nPWZmeRD4so83tq5jsK67TPk/rdJk1O1uLpXGT+rgw RcEsdBoFOsobCLgQwyRzyKI= X-Google-Smtp-Source: ABdhPJxD5AKNbbVHzMOi9nkvOXkPELZwPaQtTPIDtqsgg+h8dHpMuRz5hir7Yq7kHJsTa5jZFiZnTQ== X-Received: by 2002:a17:90a:eb98:: with SMTP id o24mr8950271pjy.150.1596741322656; Thu, 06 Aug 2020 12:15:22 -0700 (PDT) Received: from localhost.localdomain ([2601:647:4802:9070:d88d:857c:b14c:519a]) by smtp.gmail.com with ESMTPSA id q16sm9784014pfg.153.2020.08.06.12.15.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 12:15:21 -0700 (PDT) From: Sagi Grimberg To: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Chaitanya Kulkarni , Johannes Thumshirn , Christoph Hellwig , Keith Busch Subject: [PATCH v2 1/7] nvme: consolidate nvme requirements based on transport type Date: Thu, 6 Aug 2020 12:15:12 -0700 Message-Id: <20200806191518.593880-2-sagi@grimberg.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200806191518.593880-1-sagi@grimberg.me> References: <20200806191518.593880-1-sagi@grimberg.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Right now, only pci and loop have tests, hence these are the only ones that are allowed. The user can pass an env variable nvme_trtype and check for the necessary modules. This allows prepares us to support other transport types. Note that test 031 is designed to run only with nvme, hence it overrides the environment variable to nvme_trtype=pci. Signed-off-by: Sagi Grimberg --- tests/nvme/002 | 3 ++- tests/nvme/003 | 3 ++- tests/nvme/004 | 3 ++- tests/nvme/005 | 6 +++--- tests/nvme/006 | 4 ++-- tests/nvme/007 | 2 +- tests/nvme/008 | 4 ++-- tests/nvme/009 | 2 +- tests/nvme/010 | 4 ++-- tests/nvme/011 | 4 ++-- tests/nvme/012 | 5 +++-- tests/nvme/013 | 4 ++-- tests/nvme/014 | 4 ++-- tests/nvme/015 | 3 ++- tests/nvme/016 | 2 +- tests/nvme/017 | 2 +- tests/nvme/018 | 4 ++-- tests/nvme/019 | 4 ++-- tests/nvme/020 | 2 +- tests/nvme/021 | 4 ++-- tests/nvme/022 | 4 ++-- tests/nvme/023 | 4 ++-- tests/nvme/024 | 4 ++-- tests/nvme/025 | 4 ++-- tests/nvme/026 | 4 ++-- tests/nvme/027 | 4 ++-- tests/nvme/028 | 4 ++-- tests/nvme/029 | 4 ++-- tests/nvme/030 | 5 ++--- tests/nvme/031 | 5 ++--- tests/nvme/032 | 4 ++++ tests/nvme/rc | 19 +++++++++++++++++++ 32 files changed, 80 insertions(+), 54 deletions(-) diff --git a/tests/nvme/002 b/tests/nvme/002 index 07b7fdae2d39..aaa5ec4d729a 100755 --- a/tests/nvme/002 +++ b/tests/nvme/002 @@ -10,7 +10,8 @@ DESCRIPTION="create many subsystems and test discovery" requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/003 b/tests/nvme/003 index ed0feca3cac7..fd696d9efe2c 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -11,7 +11,8 @@ DESCRIPTION="test if we're sending keep-alives to a discovery controller" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/004 b/tests/nvme/004 index 0debcd9c7049..b841a8d4cd87 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -12,7 +12,8 @@ DESCRIPTION="test nvme and nvmet UUID NS descriptors" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/005 b/tests/nvme/005 index 8c79d234bb1d..df0900b372be 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -11,9 +11,9 @@ DESCRIPTION="reset local loopback target" QUICK=1 requires() { - _have_modules loop nvme-core nvme-loop nvmet && \ - _have_module_param_value nvme_core multipath Y && \ - _have_configfs + _nvme_requires + _have_modules loop && \ + _have_module_param_value nvme_core multipath Y } test() { diff --git a/tests/nvme/006 b/tests/nvme/006 index 6c8e18560264..3f47613d52d2 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -10,8 +10,8 @@ DESCRIPTION="create an NVMeOF target with a block device-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/007 b/tests/nvme/007 index 58f4bf8808a1..0902745a4ab2 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -10,7 +10,7 @@ DESCRIPTION="create an NVMeOF target with a file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules nvme-loop nvmet && _have_configfs + _nvme_requires } test() { diff --git a/tests/nvme/008 b/tests/nvme/008 index 71ff4d962b00..f19de17fefac 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -10,8 +10,8 @@ DESCRIPTION="create an NVMeOF host with a block device-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/009 b/tests/nvme/009 index 25c7da2ab854..4afbe62864f6 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -10,7 +10,7 @@ DESCRIPTION="create an NVMeOF host with a file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules nvme-loop nvmet && _have_configfs + _nvme_requires } test() { diff --git a/tests/nvme/010 b/tests/nvme/010 index 2ed0f4871a30..53b97484615f 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -10,8 +10,8 @@ DESCRIPTION="run data verification fio job on NVMeOF block device-backed ns" TIMED=1 requires() { - _have_program nvme && _have_fio && \ - _have_modules loop nvme-loop nvmet && _have_configfs + _nvme_requires + _have_fio _have_modules loop } test() { diff --git a/tests/nvme/011 b/tests/nvme/011 index 974b33745b99..a54583d5c582 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -10,8 +10,8 @@ DESCRIPTION="run data verification fio job on NVMeOF file-backed ns" TIMED=1 requires() { - _have_program nvme && _have_fio && _have_configfs && \ - _have_modules nvme-loop nvmet + _nvme_requires + _have_fio } test() { diff --git a/tests/nvme/012 b/tests/nvme/012 index 27981e903c58..0049c3d8ceb6 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -10,8 +10,9 @@ DESCRIPTION="run mkfs and data verification fio job on NVMeOF block device-backe TIMED=1 requires() { - _have_program nvme && _have_program mkfs.xfs && _have_program fio && \ - _have_modules loop nvme-loop nvmet && _have_configfs + _nvme_requires + _have_program mkfs.xfs && _have_program fio && \ + _have_modules loop } test() { diff --git a/tests/nvme/013 b/tests/nvme/013 index af5f3730a2fc..622706ec4088 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -10,8 +10,8 @@ DESCRIPTION="run mkfs and data verification fio job on NVMeOF file-backed ns" TIMED=1 requires() { - _have_program nvme && _have_program mkfs.xfs && _have_fio && \ - _have_modules nvme-loop nvmet && _have_configfs + _nvme_requires + _have_program mkfs.xfs && _have_fio } test() { diff --git a/tests/nvme/014 b/tests/nvme/014 index c255d5f12205..9517230253ab 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -10,8 +10,8 @@ DESCRIPTION="flush a NVMeOF block device-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/015 b/tests/nvme/015 index a8497a2ba400..40b850974b43 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -10,7 +10,8 @@ DESCRIPTION="unit test for NVMe flush for file backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/016 b/tests/nvme/016 index f1e383cb441a..e1bad2f81461 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -9,7 +9,7 @@ DESCRIPTION="create/delete many NVMeOF block device-backed ns and test discovery" requires() { - _have_program nvme && _have_modules nvme-loop nvmet && _have_configfs + _nvme_requires } test() { diff --git a/tests/nvme/017 b/tests/nvme/017 index 6787b5c754ba..2e6d649f9b65 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -9,7 +9,7 @@ DESCRIPTION="create/delete many file-ns and test discovery" requires() { - _have_program nvme && _have_modules nvme-loop nvmet && _have_configfs + _nvme_requires } test() { diff --git a/tests/nvme/018 b/tests/nvme/018 index 67d89a6f0b24..e39613709c90 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -11,8 +11,8 @@ DESCRIPTION="unit test NVMe-oF out of range access on a file backend" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/019 b/tests/nvme/019 index a8b0204ec0eb..86a2a2945b35 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe DSM Discard command on NVMeOF block-device ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/020 b/tests/nvme/020 index b480ee1b92d0..ccadec6a5822 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -10,7 +10,7 @@ DESCRIPTION="test NVMe DSM Discard command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules nvme-loop nvmet && _have_configfs + _nvme_requires } test() { diff --git a/tests/nvme/021 b/tests/nvme/021 index bbee54d16ff1..bbcb9d56a350 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe list command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/022 b/tests/nvme/022 index 9ba07c1cc50f..452e7b3d196c 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe reset command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/023 b/tests/nvme/023 index ed2a5ad7653f..2714571d16d9 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe smart-log command on NVMeOF block-device ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/024 b/tests/nvme/024 index 538580947c5c..1f87bd19ec69 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe smart-log command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/025 b/tests/nvme/025 index 0039fefa5007..1b9e33351f61 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe effects-log command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/026 b/tests/nvme/026 index 7e89d840529c..21a265a630ba 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe ns-descs command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/027 b/tests/nvme/027 index 4d293beb8b47..d7d33796e122 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe ns-rescan command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/028 b/tests/nvme/028 index 1280107ed5df..1643857437e8 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -10,8 +10,8 @@ DESCRIPTION="test NVMe list-subsys command on NVMeOF file-backed ns" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/029 b/tests/nvme/029 index 65eb40031888..9f437285d085 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -11,8 +11,8 @@ DESCRIPTION="test userspace IO via nvme-cli read/write interface" QUICK=1 requires() { - _have_program nvme && _have_modules loop nvme-loop nvmet && \ - _have_configfs + _nvme_requires + _have_modules loop } test_user_io() diff --git a/tests/nvme/030 b/tests/nvme/030 index 94020f47411e..7156cad7b657 100755 --- a/tests/nvme/030 +++ b/tests/nvme/030 @@ -10,9 +10,8 @@ DESCRIPTION="ensure the discovery generation counter is updated appropriately" QUICK=1 requires() { - _have_program nvme && - _have_modules loop nvme-loop nvmet && - _have_configfs + _nvme_requires + _have_modules loop } diff --git a/tests/nvme/031 b/tests/nvme/031 index 892f20bad9a7..7e7ee7327e62 100755 --- a/tests/nvme/031 +++ b/tests/nvme/031 @@ -18,9 +18,8 @@ DESCRIPTION="test deletion of NVMeOF controllers immediately after setup" QUICK=1 requires() { - _have_program nvme && - _have_modules loop nvme-loop nvmet && - _have_configfs + _nvme_requires + _have_modules loop } test() { diff --git a/tests/nvme/032 b/tests/nvme/032 index 0d0d53b325e6..017d4a339971 100755 --- a/tests/nvme/032 +++ b/tests/nvme/032 @@ -11,11 +11,15 @@ . tests/nvme/rc +#restrict test to nvme-pci only +nvme_trtype=pci + DESCRIPTION="test nvme pci adapter rescan/reset/remove during I/O" QUICK=1 CAN_BE_ZONED=1 requires() { + _nvme_requires _have_fio } diff --git a/tests/nvme/rc b/tests/nvme/rc index 6ffa971b4308..320aa4b2b475 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -6,6 +6,25 @@ . common/rc +nvme_trtype=${nvme_trtype:-"loop"} + +_nvme_requires() { + _have_program nvme + case ${nvme_trtype} in + loop) + _have_modules nvmet nvme-core nvme-loop + _have_configfs + ;; + pci) + _have_modules nvme nvme-core + ;; + *) + SKIP_REASON="unsupported nvme_trtype=${nvme_trtype}" + return 1 + esac + return 0 +} + group_requires() { _have_root } From patchwork Thu Aug 6 19:15:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 11704137 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01EA913B6 for ; Thu, 6 Aug 2020 19:15:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 39BFB221E3 for ; Thu, 6 Aug 2020 19:15:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726934AbgHFTP0 (ORCPT ); Thu, 6 Aug 2020 15:15:26 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34850 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725272AbgHFTP0 (ORCPT ); Thu, 6 Aug 2020 15:15:26 -0400 Received: by mail-pl1-f196.google.com with SMTP id r4so17639643pls.2 for ; Thu, 06 Aug 2020 12:15:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sK8T3YT5/vJQKNOfi96qwKKGpK4HInUhYgSH8H49ltk=; b=OZgtzoIs9DOfbTrWtGtw6CycQQUFCcSN9/fLSt4Slr94/K72AbOlb/f5Bj6bEXSX41 rdjLwu6tumZuifYFGdsSkiXVZSsjr1ruy/U2taJRv1iT/REz7y2Z1c0YhT1RGPJKtDVD 3RkZkedd9dNhr3MwJLvM6TpVGSEL9Db1NkoQ0Pq6+CUY0amFIdK2mNvHA9viavCrZrvS e66LN6axcqWHAZgVvuOTHuGZjZSM05SnFcMuEEvzQkn/90l9CQoMvTJWo7SW75TBfbCI o+LP4qUgMI34JbUPxdLIkei6uWXPCpAVEFDDXcEYExTh60ccLj9A6sg1W28hU8KrfW2t vW8g== X-Gm-Message-State: AOAM533X3KxpSn/+2+hNtfSScc+HPHzD5Xh8kMq089DzaA7jnGQ9VjRq UEdqx/WQVgZCOef92jKDAeL2KrFv X-Google-Smtp-Source: ABdhPJzjUs9efxi9ufM5NZElEkFJxxJReSS1DgEeo0xEl5t+iJIMHLQkhURZN9VVp86xSB7AuVMeXA== X-Received: by 2002:a17:90b:1295:: with SMTP id fw21mr8992473pjb.81.1596741324181; Thu, 06 Aug 2020 12:15:24 -0700 (PDT) Received: from localhost.localdomain ([2601:647:4802:9070:d88d:857c:b14c:519a]) by smtp.gmail.com with ESMTPSA id q16sm9784014pfg.153.2020.08.06.12.15.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 12:15:23 -0700 (PDT) From: Sagi Grimberg To: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Chaitanya Kulkarni , Johannes Thumshirn , Christoph Hellwig , Keith Busch Subject: [PATCH v2 2/7] nvme: consolidate some nvme-cli utility functions Date: Thu, 6 Aug 2020 12:15:13 -0700 Message-Id: <20200806191518.593880-3-sagi@grimberg.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200806191518.593880-1-sagi@grimberg.me> References: <20200806191518.593880-1-sagi@grimberg.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Sagi Grimberg --- tests/nvme/002 | 2 +- tests/nvme/003 | 4 ++-- tests/nvme/004 | 4 ++-- tests/nvme/005 | 4 ++-- tests/nvme/008 | 4 ++-- tests/nvme/009 | 4 ++-- tests/nvme/010 | 4 ++-- tests/nvme/011 | 4 ++-- tests/nvme/012 | 4 ++-- tests/nvme/013 | 4 ++-- tests/nvme/014 | 4 ++-- tests/nvme/015 | 4 ++-- tests/nvme/016 | 2 +- tests/nvme/017 | 2 +- tests/nvme/018 | 4 ++-- tests/nvme/019 | 4 ++-- tests/nvme/020 | 4 ++-- tests/nvme/021 | 4 ++-- tests/nvme/022 | 4 ++-- tests/nvme/023 | 4 ++-- tests/nvme/024 | 4 ++-- tests/nvme/025 | 4 ++-- tests/nvme/026 | 4 ++-- tests/nvme/027 | 4 ++-- tests/nvme/028 | 4 ++-- tests/nvme/029 | 4 ++-- tests/nvme/031 | 4 ++-- tests/nvme/rc | 31 +++++++++++++++++++++++++++++-- 28 files changed, 80 insertions(+), 53 deletions(-) diff --git a/tests/nvme/002 b/tests/nvme/002 index aaa5ec4d729a..999e222705bf 100755 --- a/tests/nvme/002 +++ b/tests/nvme/002 @@ -31,7 +31,7 @@ test() { _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-$i" done - nvme discover -t loop | _filter_discovery + _nvme_discover "loop" | _filter_discovery for ((i = iterations - 1; i >= 0; i--)); do _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-$i" diff --git a/tests/nvme/003 b/tests/nvme/003 index fd696d9efe2c..6ea6a23b7942 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -29,7 +29,7 @@ test() { _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" - nvme connect -t loop -n nqn.2014-08.org.nvmexpress.discovery + _nvme_connect_subsys "loop" "nqn.2014-08.org.nvmexpress.discovery" # This is ugly but checking for the absence of error messages is ... sleep 10 @@ -42,7 +42,7 @@ test() { echo "Fail" fi - nvme disconnect -n nqn.2014-08.org.nvmexpress.discovery + _nvme_disconnect_subsys "nqn.2014-08.org.nvmexpress.discovery" _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" _remove_nvmet_subsystem "blktests-subsystem-1" _remove_nvmet_port "${port}" diff --git a/tests/nvme/004 b/tests/nvme/004 index b841a8d4cd87..7ea539fda55e 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -33,14 +33,14 @@ test() { "91fdba0d-f87b-4c25-b80f-db7be1418b9e" _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" - nvme connect -t loop -n blktests-subsystem-1 + _nvme_connect_subsys "loop" "blktests-subsystem-1" local nvmedev nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - nvme disconnect -n "blktests-subsystem-1" + _nvme_disconnect_subsys "blktests-subsystem-1" _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" _remove_nvmet_subsystem "blktests-subsystem-1" _remove_nvmet_port "${port}" diff --git a/tests/nvme/005 b/tests/nvme/005 index df0900b372be..d4ce6d703c1b 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -33,7 +33,7 @@ test() { "91fdba0d-f87b-4c25-b80f-db7be1418b9e" _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" - nvme connect -t loop -n blktests-subsystem-1 + _nvme_connect_subsys "loop" "blktests-subsystem-1" local nvmedev nvmedev="$(_find_nvme_loop_dev)" @@ -42,7 +42,7 @@ test() { echo 1 > "/sys/class/nvme/${nvmedev}/reset_controller" - nvme disconnect -d "${nvmedev}" + _nvme_disconnect_ctrl "${nvmedev}" _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" _remove_nvmet_port "${port}" diff --git a/tests/nvme/008 b/tests/nvme/008 index f19de17fefac..5ab5c49b2039 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -34,7 +34,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -42,7 +42,7 @@ test() { udevadm settle - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/009 b/tests/nvme/009 index 4afbe62864f6..f6b999dea541 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -30,7 +30,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -38,7 +38,7 @@ test() { udevadm settle - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/010 b/tests/nvme/010 index 53b97484615f..6caa2d0f813d 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -34,7 +34,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -42,7 +42,7 @@ test() { _run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1" - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/011 b/tests/nvme/011 index a54583d5c582..7a5535982a74 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -32,7 +32,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -40,7 +40,7 @@ test() { _run_fio_verify_io --size=950m --filename="/dev/${nvmedev}n1" - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/012 b/tests/nvme/012 index 0049c3d8ceb6..5c3477a16af9 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -38,7 +38,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -54,7 +54,7 @@ test() { umount "${mount_dir}" > /dev/null 2>&1 - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/013 b/tests/nvme/013 index 622706ec4088..49784a0d46b5 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -35,7 +35,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -51,7 +51,7 @@ test() { umount "${mount_dir}" > /dev/null 2>&1 - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/014 b/tests/nvme/014 index 9517230253ab..a33ff439fb3d 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -34,7 +34,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -44,7 +44,7 @@ test() { nvme flush "/dev/${nvmedev}" -n 1 - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/015 b/tests/nvme/015 index 40b850974b43..cb9792e13442 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -31,7 +31,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -41,7 +41,7 @@ test() { nvme flush "/dev/${nvmedev}n1" -n 1 - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/016 b/tests/nvme/016 index e1bad2f81461..1ad744abb9b0 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -33,7 +33,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "$port" "${subsys_nqn}" - nvme discover -t loop | _filter_discovery + _nvme_discover "loop" | _filter_discovery _remove_nvmet_subsystem_from_port "${port}" "${subsys_nqn}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/017 b/tests/nvme/017 index 2e6d649f9b65..2507bcd606b7 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -36,7 +36,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme discover -t loop | _filter_discovery + _nvme_discover "loop" | _filter_discovery _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/018 b/tests/nvme/018 index e39613709c90..4863274cc525 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -32,7 +32,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -46,7 +46,7 @@ test() { nvme read "/dev/${nvmedev}n1" -s "$sectors" -c 0 -z "$bs" &>"$FULL" \ && echo "ERROR: nvme read for out of range LBA was not rejected" - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/019 b/tests/nvme/019 index 86a2a2945b35..19c5b4755387 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -36,7 +36,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -44,7 +44,7 @@ test() { nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}" - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/020 b/tests/nvme/020 index ccadec6a5822..0a817004225a 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -32,7 +32,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -40,7 +40,7 @@ test() { nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}" - nvme disconnect -n "${subsys_name}" + _nvme_disconnect_subsys "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/021 b/tests/nvme/021 index bbcb9d56a350..ac3cbd17cd03 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -31,7 +31,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -41,7 +41,7 @@ test() { echo "ERROR: device not listed" fi - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/022 b/tests/nvme/022 index 452e7b3d196c..4c91f98734fc 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -31,7 +31,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -41,7 +41,7 @@ test() { echo "ERROR: reset failed" fi - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/023 b/tests/nvme/023 index 2714571d16d9..dcbe821f2709 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -34,7 +34,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -44,7 +44,7 @@ test() { echo "ERROR: smart-log bdev-ns failed" fi - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/024 b/tests/nvme/024 index 1f87bd19ec69..0f4bddcb3142 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -31,7 +31,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -40,7 +40,7 @@ test() { if ! nvme smart-log "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then echo "ERROR: smart-log file-ns failed" fi - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/025 b/tests/nvme/025 index 1b9e33351f61..90896d327cff 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -31,7 +31,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -41,7 +41,7 @@ test() { echo "ERROR: effects-log failed" fi - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/026 b/tests/nvme/026 index 21a265a630ba..39cfe12a23c7 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -31,7 +31,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -41,7 +41,7 @@ test() { echo "ERROR: ns-desc failed" fi - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/027 b/tests/nvme/027 index d7d33796e122..5915c336a0cd 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -31,7 +31,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -40,7 +40,7 @@ test() { if ! nvme ns-rescan "/dev/${nvmedev}" >> "$FULL" 2>&1; then echo "ERROR: ns-rescan failed" fi - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/028 b/tests/nvme/028 index 1643857437e8..cf44102b3957 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -31,7 +31,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -40,7 +40,7 @@ test() { if ! nvme list-subsys 2>> "$FULL" | grep -q loop; then echo "ERROR: list-subsys" fi - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/029 b/tests/nvme/029 index 9f437285d085..192b5c52168c 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -67,7 +67,7 @@ test() { port="$(_create_nvmet_port "loop")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - nvme connect -t loop -n "${subsys_name}" + _nvme_connect_subsys "loop" "${subsys_name}" nvmedev="$(_find_nvme_loop_dev)" cat "/sys/block/${nvmedev}n1/uuid" @@ -81,7 +81,7 @@ test() { test_user_io "$dev" 511 1023 > "$FULL" 2>&1 || echo FAIL test_user_io "$dev" 511 1025 > "$FULL" 2>&1 || echo FAIL - nvme disconnect -n "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_subsystem "${subsys_name}" diff --git a/tests/nvme/031 b/tests/nvme/031 index 7e7ee7327e62..ab17633bc8fc 100755 --- a/tests/nvme/031 +++ b/tests/nvme/031 @@ -41,8 +41,8 @@ test() { for ((i = 0; i < iterations; i++)); do _create_nvmet_subsystem "${subsys}$i" "${loop_dev}" _add_nvmet_subsys_to_port "${port}" "${subsys}$i" - nvme connect -t loop -n "${subsys}$i" - nvme disconnect -n "${subsys}$i" >> "${FULL}" 2>&1 + _nvme_connect_subsys "loop" "${subsys}$i" + _nvme_disconnect_subsys "${subsys}$i" >> "${FULL}" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys}$i" _remove_nvmet_subsystem "${subsys}$i" done diff --git a/tests/nvme/rc b/tests/nvme/rc index 320aa4b2b475..6d57cf591300 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -64,7 +64,7 @@ _cleanup_nvmet() { transport="$(cat "/sys/class/nvme/${dev}/transport")" if [[ "$transport" == "loop" ]]; then echo "WARNING: Test did not clean up loop device: ${dev}" - nvme disconnect -d "${dev}" + _nvme_disconnect_ctrl "${dev}" fi done @@ -97,6 +97,33 @@ _setup_nvmet() { modprobe nvme-loop } +_nvme_disconnect_ctrl() { + local ctrl="$1" + + nvme disconnect -d ${ctrl} +} + +_nvme_disconnect_subsys() { + local subsysnqn="$1" + + nvme disconnect -n ${subsysnqn} +} + +_nvme_connect_subsys() { + local trtype="$1" + local subsysnqn="$2" + + cmd="nvme connect -t ${trtype} -n ${subsysnqn}" + eval $cmd +} + +_nvme_discover() { + local trtype="$1" + + cmd="nvme discover -t ${trtype}" + eval $cmd +} + _create_nvmet_port() { local trtype="$1" @@ -206,6 +233,6 @@ _filter_discovery() { } _discovery_genctr() { - nvme discover -t loop | + _nvme_discover "loop" | sed -n -e 's/^.*Generation counter \([0-9]\+\).*$/\1/p' } From patchwork Thu Aug 6 19:15:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 11704139 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 236F713B6 for ; Thu, 6 Aug 2020 19:15:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C2B32177B for ; Thu, 6 Aug 2020 19:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727037AbgHFTPa (ORCPT ); Thu, 6 Aug 2020 15:15:30 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:36149 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726577AbgHFTP1 (ORCPT ); Thu, 6 Aug 2020 15:15:27 -0400 Received: by mail-pj1-f66.google.com with SMTP id ha11so7186204pjb.1 for ; Thu, 06 Aug 2020 12:15:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2/vgxZaLBEo3X1GxcTNBOgwFD0GG283ZvcPViq0IECE=; b=I0tZNHAX3z7YC04lVFABk8j+mqsMJJv+Q3+Txlm/dZF8qBHbl+MOjEVEd0GM4yaP+i GbReIhdm8Rp5Y9yqEljz1aAMzYiHLJk6wyPnjVTbEy94xoD1e4hE2KXp0+OSGDMqIoiW kAusp8assmexcqUCwEgUhUv2fv2EYBZN5P5vuPaSvweSn+iJoxPsoVIAane0bqWLMRzb QgpuMCItorsJ42UvqWF2CBxhwiUDFIJtOZt1QyTWbNYnQLzMugW71WcOV7SNtz78cfaZ fxcyNMq6J2AA7RgCTp7EC79NhHub8BRN2hEtynelESzWXI+LoGV0Uh5Dmi1DsxlZTB4X NNdA== X-Gm-Message-State: AOAM530t71cGcv46jFQ2IRBXGDmR5FRNp/5/FYVFwLzh2nslp5u5Ah24 w331emedVow7mXZxUg2M/iQ= X-Google-Smtp-Source: ABdhPJypCYbNxj6/dLKuOalRK4GqChwVepSqUKAd968hxkU/LaWDa5yQXp0M45JwSQihXnf0E49+Jw== X-Received: by 2002:a17:90a:be17:: with SMTP id a23mr9860791pjs.84.1596741325785; Thu, 06 Aug 2020 12:15:25 -0700 (PDT) Received: from localhost.localdomain ([2601:647:4802:9070:d88d:857c:b14c:519a]) by smtp.gmail.com with ESMTPSA id q16sm9784014pfg.153.2020.08.06.12.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 12:15:24 -0700 (PDT) From: Sagi Grimberg To: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Chaitanya Kulkarni , Johannes Thumshirn , Christoph Hellwig , Keith Busch Subject: [PATCH v2 3/7] nvme: make tests transport type agnostic Date: Thu, 6 Aug 2020 12:15:14 -0700 Message-Id: <20200806191518.593880-4-sagi@grimberg.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200806191518.593880-1-sagi@grimberg.me> References: <20200806191518.593880-1-sagi@grimberg.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Pass in nvme_trtype to common routines that can support multiple transport types. Signed-off-by: Sagi Grimberg --- tests/nvme/002 | 4 ++-- tests/nvme/003 | 4 ++-- tests/nvme/004 | 6 +++--- tests/nvme/005 | 6 +++--- tests/nvme/006 | 2 +- tests/nvme/007 | 2 +- tests/nvme/008 | 6 +++--- tests/nvme/009 | 6 +++--- tests/nvme/010 | 6 +++--- tests/nvme/011 | 6 +++--- tests/nvme/012 | 6 +++--- tests/nvme/013 | 6 +++--- tests/nvme/014 | 6 +++--- tests/nvme/015 | 6 +++--- tests/nvme/016 | 2 +- tests/nvme/017 | 2 +- tests/nvme/018 | 6 +++--- tests/nvme/019 | 6 +++--- tests/nvme/020 | 6 +++--- tests/nvme/021 | 6 +++--- tests/nvme/022 | 6 +++--- tests/nvme/023 | 6 +++--- tests/nvme/024 | 6 +++--- tests/nvme/025 | 6 +++--- tests/nvme/026 | 6 +++--- tests/nvme/027 | 6 +++--- tests/nvme/028 | 8 ++++---- tests/nvme/029 | 6 +++--- tests/nvme/030 | 2 +- tests/nvme/031 | 4 ++-- tests/nvme/rc | 39 ++++++++++++++++++++++++++++++++------- 31 files changed, 110 insertions(+), 85 deletions(-) diff --git a/tests/nvme/002 b/tests/nvme/002 index 999e222705bf..8540623497c7 100755 --- a/tests/nvme/002 +++ b/tests/nvme/002 @@ -21,7 +21,7 @@ test() { local iterations=1000 local port - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" local loop_dev loop_dev="$(losetup -f)" @@ -31,7 +31,7 @@ test() { _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-$i" done - _nvme_discover "loop" | _filter_discovery + _nvme_discover "${nvme_trtype}" | _filter_discovery for ((i = iterations - 1; i >= 0; i--)); do _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-$i" diff --git a/tests/nvme/003 b/tests/nvme/003 index 6ea6a23b7942..68f823011d7d 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -21,7 +21,7 @@ test() { _setup_nvmet local port - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port "${nvme_trtype}")" local loop_dev loop_dev="$(losetup -f)" @@ -29,7 +29,7 @@ test() { _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" - _nvme_connect_subsys "loop" "nqn.2014-08.org.nvmexpress.discovery" + _nvme_connect_subsys "${nvme_trtype}" "nqn.2014-08.org.nvmexpress.discovery" # This is ugly but checking for the absence of error messages is ... sleep 10 diff --git a/tests/nvme/004 b/tests/nvme/004 index 7ea539fda55e..af434674beaa 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -22,7 +22,7 @@ test() { _setup_nvmet local port - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" truncate -s 1G "$TMPDIR/img" @@ -33,10 +33,10 @@ test() { "91fdba0d-f87b-4c25-b80f-db7be1418b9e" _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" - _nvme_connect_subsys "loop" "blktests-subsystem-1" + _nvme_connect_subsys ${nvme_trtype} "blktests-subsystem-1" local nvmedev - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/005 b/tests/nvme/005 index d4ce6d703c1b..ff0975ce7c28 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -22,7 +22,7 @@ test() { _setup_nvmet local port - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" truncate -s 1G "$TMPDIR/img" @@ -33,10 +33,10 @@ test() { "91fdba0d-f87b-4c25-b80f-db7be1418b9e" _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" - _nvme_connect_subsys "loop" "blktests-subsystem-1" + _nvme_connect_subsys ${nvme_trtype} "blktests-subsystem-1" local nvmedev - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" udevadm settle diff --git a/tests/nvme/006 b/tests/nvme/006 index 3f47613d52d2..3f161d08bc22 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -29,7 +29,7 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" diff --git a/tests/nvme/007 b/tests/nvme/007 index 0902745a4ab2..b0e61186e886 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -28,7 +28,7 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" diff --git a/tests/nvme/008 b/tests/nvme/008 index 5ab5c49b2039..7ffac945a58a 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -31,12 +31,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/009 b/tests/nvme/009 index f6b999dea541..9ac5cb479983 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -27,12 +27,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/010 b/tests/nvme/010 index 6caa2d0f813d..d90ca9d88053 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -31,12 +31,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/011 b/tests/nvme/011 index 7a5535982a74..d8badbc00846 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -29,12 +29,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/012 b/tests/nvme/012 index 5c3477a16af9..93b6cfaf4c77 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -35,12 +35,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/013 b/tests/nvme/013 index 49784a0d46b5..3bae2f5edb3d 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -32,12 +32,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/014 b/tests/nvme/014 index a33ff439fb3d..b61e7182af66 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -31,12 +31,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/015 b/tests/nvme/015 index cb9792e13442..05195e3bc598 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -28,12 +28,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/016 b/tests/nvme/016 index 1ad744abb9b0..a5ad973dc246 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -30,7 +30,7 @@ test() { _create_nvmet_ns "${subsys_nqn}" "${i}" "${loop_dev}" done - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "$port" "${subsys_nqn}" _nvme_discover "loop" | _filter_discovery diff --git a/tests/nvme/017 b/tests/nvme/017 index 2507bcd606b7..67d7ffc72e93 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -33,7 +33,7 @@ test() { _create_nvmet_ns "${subsys_name}" "${i}" "${file_path}" done - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" _nvme_discover "loop" | _filter_discovery diff --git a/tests/nvme/018 b/tests/nvme/018 index 4863274cc525..43340d3c4d25 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -29,12 +29,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/019 b/tests/nvme/019 index 19c5b4755387..98d82ae21b42 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -33,12 +33,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/020 b/tests/nvme/020 index 0a817004225a..2d4c0152bc55 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -29,12 +29,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/021 b/tests/nvme/021 index ac3cbd17cd03..03b2ab749052 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -28,12 +28,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/022 b/tests/nvme/022 index 4c91f98734fc..977b844ee117 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -28,12 +28,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/023 b/tests/nvme/023 index dcbe821f2709..6c3b44174884 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -31,12 +31,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/024 b/tests/nvme/024 index 0f4bddcb3142..9b5f6a44a916 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -28,12 +28,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/025 b/tests/nvme/025 index 90896d327cff..9f0e9f722a02 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -28,12 +28,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/026 b/tests/nvme/026 index 39cfe12a23c7..e60e73b2c26a 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -28,12 +28,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/027 b/tests/nvme/027 index 5915c336a0cd..805a3c63eba2 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -28,12 +28,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/028 b/tests/nvme/028 index cf44102b3957..c9bd3dde7f20 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -28,16 +28,16 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - if ! nvme list-subsys 2>> "$FULL" | grep -q loop; then + if ! nvme list-subsys 2>> "$FULL" | grep -q ${nvme_trtype}; then echo "ERROR: list-subsys" fi _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 diff --git a/tests/nvme/029 b/tests/nvme/029 index 192b5c52168c..7bf904b16edc 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -64,12 +64,12 @@ test() { _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _nvme_connect_subsys "loop" "${subsys_name}" + _nvme_connect_subsys ${nvme_trtype} "${subsys_name}" - nvmedev="$(_find_nvme_loop_dev)" + nvmedev="$(_find_nvme_dev)" cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" diff --git a/tests/nvme/030 b/tests/nvme/030 index 7156cad7b657..220b29f42962 100755 --- a/tests/nvme/030 +++ b/tests/nvme/030 @@ -37,7 +37,7 @@ test() { _setup_nvmet - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" _create_nvmet_subsystem "${subsys}1" "$(losetup -f)" _add_nvmet_subsys_to_port "${port}" "${subsys}1" diff --git a/tests/nvme/031 b/tests/nvme/031 index ab17633bc8fc..001f9d2b0b3a 100755 --- a/tests/nvme/031 +++ b/tests/nvme/031 @@ -36,12 +36,12 @@ test() { loop_dev="$(losetup -f --show "$TMPDIR/img")" - port="$(_create_nvmet_port "loop")" + port="$(_create_nvmet_port ${nvme_trtype})" for ((i = 0; i < iterations; i++)); do _create_nvmet_subsystem "${subsys}$i" "${loop_dev}" _add_nvmet_subsys_to_port "${port}" "${subsys}$i" - _nvme_connect_subsys "loop" "${subsys}$i" + _nvme_connect_subsys ${nvme_trtype} "${subsys}$i" _nvme_disconnect_subsys "${subsys}$i" >> "${FULL}" 2>&1 _remove_nvmet_subsystem_from_port "${port}" "${subsys}$i" _remove_nvmet_subsystem "${subsys}$i" diff --git a/tests/nvme/rc b/tests/nvme/rc index 6d57cf591300..191f0497416a 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -6,6 +6,9 @@ . common/rc +def_traddr="127.0.0.1" +def_adrfam="ipv4" +def_trsvcid="4420" nvme_trtype=${nvme_trtype:-"loop"} _nvme_requires() { @@ -62,8 +65,8 @@ _cleanup_nvmet() { for dev in /sys/class/nvme/nvme*; do dev="$(basename "$dev")" transport="$(cat "/sys/class/nvme/${dev}/transport")" - if [[ "$transport" == "loop" ]]; then - echo "WARNING: Test did not clean up loop device: ${dev}" + if [[ "$transport" == "${nvme_trtype}" ]]; then + echo "WARNING: Test did not clean up ${nvme_trtype} device: ${dev}" _nvme_disconnect_ctrl "${dev}" fi done @@ -87,14 +90,20 @@ _cleanup_nvmet() { shopt -u nullglob trap SIGINT - modprobe -r nvme-loop 2>/dev/null + modprobe -r nvme-${nvme_trtype} 2>/dev/null + if [[ "${nvme_trtype}" != "loop" ]]; then + modprobe -r nvmet-${nvme_trtype} 2>/dev/null + fi modprobe -r nvmet 2>/dev/null } _setup_nvmet() { _register_test_cleanup _cleanup_nvmet modprobe nvmet - modprobe nvme-loop + if [[ "${nvme_trtype}" != "loop" ]]; then + modprobe nvmet-${nvme_trtype} + fi + modprobe nvme-${nvme_trtype} } _nvme_disconnect_ctrl() { @@ -112,20 +121,33 @@ _nvme_disconnect_subsys() { _nvme_connect_subsys() { local trtype="$1" local subsysnqn="$2" + local traddr="${3:-$def_traddr}" + local trsvcid="${4:-$def_trsvcid}" cmd="nvme connect -t ${trtype} -n ${subsysnqn}" + if [[ "${trtype}" != "loop" ]]; then + cmd=$cmd" -a ${traddr} -s ${trsvcid}" + fi eval $cmd } _nvme_discover() { local trtype="$1" + local traddr="${2:-$def_traddr}" + local trsvcid="${3:-$def_trsvcid}" cmd="nvme discover -t ${trtype}" + if [[ "${trtype}" != "loop" ]]; then + cmd=$cmd" -a ${traddr} -s ${trsvcid}" + fi eval $cmd } _create_nvmet_port() { local trtype="$1" + local traddr="${2:-$def_traddr}" + local adrfam="${3:-$def_adrfam}" + local trsvcid="${4:-$def_trsvcid}" local port for ((port = 0; ; port++)); do @@ -136,6 +158,9 @@ _create_nvmet_port() { mkdir "${NVMET_CFS}/ports/${port}" echo "${trtype}" > "${NVMET_CFS}/ports/${port}/addr_trtype" + echo "${traddr}" > "${NVMET_CFS}/ports/${port}/addr_traddr" + echo "${adrfam}" > "${NVMET_CFS}/ports/${port}/addr_adrfam" + echo "${trsvcid}" > "${NVMET_CFS}/ports/${port}/addr_trsvcid" echo "${port}" } @@ -207,13 +232,13 @@ _remove_nvmet_subsystem_from_port() { rm "${NVMET_CFS}/ports/${port}/subsystems/${nvmet_subsystem}" } -_find_nvme_loop_dev() { +_find_nvme_dev() { local dev local transport for dev in /sys/class/nvme/nvme*; do dev="$(basename "$dev")" transport="$(cat "/sys/class/nvme/${dev}/transport")" - if [[ "$transport" == "loop" ]]; then + if [[ "$transport" == "${nvme_trtype}" ]]; then echo "$dev" for ((i = 0; i < 10; i++)); do if [[ -e /sys/block/$dev/uuid && @@ -233,6 +258,6 @@ _filter_discovery() { } _discovery_genctr() { - _nvme_discover "loop" | + _nvme_discover "${nvme_trtype}" | sed -n -e 's/^.*Generation counter \([0-9]\+\).*$/\1/p' } From patchwork Thu Aug 6 19:15:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 11704141 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 36EE9913 for ; Thu, 6 Aug 2020 19:15:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C11222C9F for ; Thu, 6 Aug 2020 19:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726577AbgHFTPa (ORCPT ); Thu, 6 Aug 2020 15:15:30 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:36120 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725272AbgHFTP2 (ORCPT ); Thu, 6 Aug 2020 15:15:28 -0400 Received: by mail-pl1-f193.google.com with SMTP id y6so1097438plt.3 for ; Thu, 06 Aug 2020 12:15:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ej+QUm3coPFgr2Dcj9yEtLaivghbIlLTGBhcu85qsl0=; b=pfJVEI0ozIS0VP8g7r3FnvWkZmrrL7alJ9IM++b8570GIgJ8YoArj5vJ1Ohj4KRq7y elv/CPLC6X/VwPO5DHM4ydqoBOM5DYfsX4NQ2oWaO1Qrk3WYBvVfsWENFsVnsWJMJ802 DPKSQxU+CkX/6aGXnQwPbbMb4n9lTzJekIkp5ZkkGQJIYeiLPjEPS8KnuTbdMJ72DiA4 Cx0AfcNFDqGX6AM7Kg++QhBf2Pe+KGmhlRsy/ggLK3h1bzW6oOyBQgWEgtlBX8WmA208 fQPQ5vGm8V6gypqq1J8dy0kZTteDEDJBZSbPoE86SRrHlzaqaWqw7zHQccF8D2sh84GP twjw== X-Gm-Message-State: AOAM530Swc+wupYu6M5BkLY1UgOC2ytUlDw7JjxKVXxfFg2fBnUvNFIN AYnOuI9NfFlLZRqRK1juChw= X-Google-Smtp-Source: ABdhPJwdKoS5ikFKMLUhiwd3I9A14+UiYINPr50Jbgs0eZPKpyu/jRZ4pZiZS+y/mDNBwXAGLGs+YQ== X-Received: by 2002:a17:90a:3307:: with SMTP id m7mr9351246pjb.203.1596741327396; Thu, 06 Aug 2020 12:15:27 -0700 (PDT) Received: from localhost.localdomain ([2601:647:4802:9070:d88d:857c:b14c:519a]) by smtp.gmail.com with ESMTPSA id q16sm9784014pfg.153.2020.08.06.12.15.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 12:15:26 -0700 (PDT) From: Sagi Grimberg To: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Chaitanya Kulkarni , Johannes Thumshirn , Christoph Hellwig , Keith Busch Subject: [PATCH v2 4/7] tests/nvme: restrict tests to specific transports Date: Thu, 6 Aug 2020 12:15:15 -0700 Message-Id: <20200806191518.593880-5-sagi@grimberg.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200806191518.593880-1-sagi@grimberg.me> References: <20200806191518.593880-1-sagi@grimberg.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Protect against running tests with the wrong transport type. Most tests cannot have nvme_trtype=nvme and discovery tests expect the $trtype to be written and verified in the .out file. Adding a couple of helpers to restrict the transport types in tests. Signed-off-by: Sagi Grimberg --- tests/nvme/002 | 1 + tests/nvme/003 | 1 + tests/nvme/004 | 1 + tests/nvme/005 | 1 + tests/nvme/006 | 1 + tests/nvme/007 | 1 + tests/nvme/008 | 1 + tests/nvme/009 | 1 + tests/nvme/010 | 1 + tests/nvme/011 | 1 + tests/nvme/012 | 1 + tests/nvme/013 | 1 + tests/nvme/014 | 1 + tests/nvme/015 | 1 + tests/nvme/016 | 1 + tests/nvme/017 | 1 + tests/nvme/018 | 1 + tests/nvme/019 | 1 + tests/nvme/020 | 1 + tests/nvme/021 | 1 + tests/nvme/022 | 1 + tests/nvme/023 | 1 + tests/nvme/024 | 1 + tests/nvme/025 | 1 + tests/nvme/026 | 1 + tests/nvme/027 | 1 + tests/nvme/028 | 1 + tests/nvme/029 | 1 + tests/nvme/030 | 1 + tests/nvme/031 | 1 + tests/nvme/rc | 16 ++++++++++++++++ 31 files changed, 46 insertions(+) diff --git a/tests/nvme/002 b/tests/nvme/002 index 8540623497c7..8cfcb75e5142 100755 --- a/tests/nvme/002 +++ b/tests/nvme/002 @@ -12,6 +12,7 @@ DESCRIPTION="create many subsystems and test discovery" requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_is_loop } test() { diff --git a/tests/nvme/003 b/tests/nvme/003 index 68f823011d7d..09d4c50bef2f 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -13,6 +13,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/004 b/tests/nvme/004 index af434674beaa..9e40b08ca595 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -14,6 +14,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/005 b/tests/nvme/005 index ff0975ce7c28..68dc9311e9de 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -14,6 +14,7 @@ requires() { _nvme_requires _have_modules loop && \ _have_module_param_value nvme_core multipath Y + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/006 b/tests/nvme/006 index 3f161d08bc22..82809379b5d4 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/007 b/tests/nvme/007 index b0e61186e886..747e7402ee7d 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -11,6 +11,7 @@ QUICK=1 requires() { _nvme_requires + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/008 b/tests/nvme/008 index 7ffac945a58a..9f17fcfe801a 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/009 b/tests/nvme/009 index 9ac5cb479983..017b06e13637 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -11,6 +11,7 @@ QUICK=1 requires() { _nvme_requires + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/010 b/tests/nvme/010 index d90ca9d88053..426276c87ed1 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -12,6 +12,7 @@ TIMED=1 requires() { _nvme_requires _have_fio _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/011 b/tests/nvme/011 index d8badbc00846..d799af0ba6f4 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -12,6 +12,7 @@ TIMED=1 requires() { _nvme_requires _have_fio + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/012 b/tests/nvme/012 index 93b6cfaf4c77..b9848eb0b0ee 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -13,6 +13,7 @@ requires() { _nvme_requires _have_program mkfs.xfs && _have_program fio && \ _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/013 b/tests/nvme/013 index 3bae2f5edb3d..df462f165a8d 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -12,6 +12,7 @@ TIMED=1 requires() { _nvme_requires _have_program mkfs.xfs && _have_fio + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/014 b/tests/nvme/014 index b61e7182af66..9a9292a9d309 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/015 b/tests/nvme/015 index 05195e3bc598..600e625d341d 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/016 b/tests/nvme/016 index a5ad973dc246..8ba0a895fbff 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -10,6 +10,7 @@ DESCRIPTION="create/delete many NVMeOF block device-backed ns and test discovery requires() { _nvme_requires + _require_nvme_trtype_is_loop } test() { diff --git a/tests/nvme/017 b/tests/nvme/017 index 67d7ffc72e93..36b14f677449 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -10,6 +10,7 @@ DESCRIPTION="create/delete many file-ns and test discovery" requires() { _nvme_requires + _require_nvme_trtype_is_loop } test() { diff --git a/tests/nvme/018 b/tests/nvme/018 index 43340d3c4d25..9059b2557efa 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -13,6 +13,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/019 b/tests/nvme/019 index 98d82ae21b42..ca7954953fd8 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/020 b/tests/nvme/020 index 2d4c0152bc55..39d08439f113 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -11,6 +11,7 @@ QUICK=1 requires() { _nvme_requires + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/021 b/tests/nvme/021 index 03b2ab749052..918be51d2087 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/022 b/tests/nvme/022 index 977b844ee117..a03e83500b47 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/023 b/tests/nvme/023 index 6c3b44174884..c1ef8e08a31d 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/024 b/tests/nvme/024 index 9b5f6a44a916..bf7416f908e9 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/025 b/tests/nvme/025 index 9f0e9f722a02..8f8e472ab3ce 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/026 b/tests/nvme/026 index e60e73b2c26a..f1f8878793ce 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/027 b/tests/nvme/027 index 805a3c63eba2..53766775e096 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/028 b/tests/nvme/028 index c9bd3dde7f20..6fbf0d6d7938 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/029 b/tests/nvme/029 index 7bf904b16edc..7a4fd8d6d4c5 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -13,6 +13,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test_user_io() diff --git a/tests/nvme/030 b/tests/nvme/030 index 220b29f42962..44f3b56dec4e 100755 --- a/tests/nvme/030 +++ b/tests/nvme/030 @@ -12,6 +12,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } diff --git a/tests/nvme/031 b/tests/nvme/031 index 001f9d2b0b3a..a5714982b5d9 100755 --- a/tests/nvme/031 +++ b/tests/nvme/031 @@ -20,6 +20,7 @@ QUICK=1 requires() { _nvme_requires _have_modules loop + _require_nvme_trtype_not_pci } test() { diff --git a/tests/nvme/rc b/tests/nvme/rc index 191f0497416a..a2cb0c0add93 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -46,6 +46,22 @@ _require_test_dev_is_nvme() { return 0 } +_require_nvme_trtype_is_loop() { + if [[ "${nvme_trtype}" != "loop" ]]; then + SKIP_REASON="nvme_trtype=${nvme_trtype} is not supported in this test" + return 1 + fi + return 0 +} + +_require_nvme_trtype_not_pci() { + if [[ "${nvme_trtype}" == "pci" ]]; then + SKIP_REASON="nvme_trtype=${nvme_trtype} is not supported in this test" + return 1 + fi + return 0 +} + _cleanup_nvmet() { local dev local port From patchwork Thu Aug 6 19:15:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 11704143 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A580616B1 for ; Thu, 6 Aug 2020 19:15:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E3082221E5 for ; Thu, 6 Aug 2020 19:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727057AbgHFTPa (ORCPT ); Thu, 6 Aug 2020 15:15:30 -0400 Received: from mail-pj1-f45.google.com ([209.85.216.45]:56294 "EHLO mail-pj1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726942AbgHFTP3 (ORCPT ); Thu, 6 Aug 2020 15:15:29 -0400 Received: by mail-pj1-f45.google.com with SMTP id 2so7345462pjx.5 for ; Thu, 06 Aug 2020 12:15:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E6rPl/XQAx312kYBDl1D3OvoqQvb50hFc5fzpRw9mLU=; b=q7B4WtcvktJNIa/jg2UDGIhj927G+KxzpXIYCFgPkiIGpDYbWTmKJ/H05Sw9HuSFMB 4BKENulcX94r99lkAa+q32MKKbPofBd7NXwgtavFAB9GPlwGHoErX3+KO5gMIjg5MHx5 uWFHor8mAOTy/KkRoZ33hcSyGfo0+0Y5ldBc78ml4ztaZrOTvG+o4LHes4Oql4APPnyG 5CvE2emeRUkYECEaUAPUdOOMgDOmZjFhF6JduN2mBv4hkpsU3cDkme3/zkjFUtZE8AtG DAD7AE2Q+8rMTLJ37vLnR0fngnUZG5EKx1kItHMDczrrjD4q2qMtlglTzWSy5j39HgHE U1zg== X-Gm-Message-State: AOAM532RBwhk35grI2uIjWtTawpXYT76nL/zxbbudh6e830WnJ/Tyw3W J4ijS7cf0AW9X6rfNV+7dsc= X-Google-Smtp-Source: ABdhPJxx1Gzq5Y58oYCHXns8Ubqh9zuEiQhgOOdlCkCivBLSnydc7oGr6mq1NZ0HRu6qeIiNAx7Pvw== X-Received: by 2002:a17:90b:4d0d:: with SMTP id mw13mr10252988pjb.159.1596741328976; Thu, 06 Aug 2020 12:15:28 -0700 (PDT) Received: from localhost.localdomain ([2601:647:4802:9070:d88d:857c:b14c:519a]) by smtp.gmail.com with ESMTPSA id q16sm9784014pfg.153.2020.08.06.12.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 12:15:28 -0700 (PDT) From: Sagi Grimberg To: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Chaitanya Kulkarni , Johannes Thumshirn , Christoph Hellwig , Keith Busch Subject: [PATCH v2 5/7] nvme: support nvme-tcp when runinng tests Date: Thu, 6 Aug 2020 12:15:16 -0700 Message-Id: <20200806191518.593880-6-sagi@grimberg.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200806191518.593880-1-sagi@grimberg.me> References: <20200806191518.593880-1-sagi@grimberg.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org run with: nvme_trtype=tcp ./check test/nvme Signed-off-by: Sagi Grimberg --- tests/nvme/rc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index a2cb0c0add93..69ab7d2f3964 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -21,6 +21,10 @@ _nvme_requires() { pci) _have_modules nvme nvme-core ;; + tcp) + _have_modules nvmet nvme-core nvme-tcp nvmet-tcp + _have_configfs + ;; *) SKIP_REASON="unsupported nvme_trtype=${nvme_trtype}" return 1 From patchwork Thu Aug 6 19:15:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 11704145 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4A48913B6 for ; Thu, 6 Aug 2020 19:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84BBA221E5 for ; Thu, 6 Aug 2020 19:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726942AbgHFTPb (ORCPT ); Thu, 6 Aug 2020 15:15:31 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41872 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725272AbgHFTPb (ORCPT ); Thu, 6 Aug 2020 15:15:31 -0400 Received: by mail-pl1-f194.google.com with SMTP id f10so3336803plj.8 for ; Thu, 06 Aug 2020 12:15:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mQg0QW5Ii5wVrkyjrYOAVjHAU5a8a/Cp+IYFCQV4S8g=; b=NOw2kvtY9xcXu7y4PJ5MEVq7iebFbYbpQuEJY2IOCgJ+TV27Nn9NWYBiXfeZ3kdzG3 DDv23+Y15lgBQ729B3gxR9b8TiihuOa89ouCRc/wEBsrzEiZGRTpPJVa4TlqftuVNMTw dG23Du0VP6vjC/GmkNDq08oQHjdQbviMCy66OESKv8V6DmvbCNxzg7H0ov57buTtBp/a dJ67NSxpEkG0zRUB2ozQ8x0ObuaH06gpDkecRmZ2ALmfCrlGVDbbaCJIaQ4zmiz2AOzd 1JOKTCHCKMpkRn7pNRpzmpDis9n/ADSLACk8edulgTGYszTP/0ZnHaK3lB69fleVtXhi H0FA== X-Gm-Message-State: AOAM530biaLSOO2UYLJf9XTyxX2RLvKjWSayV2w1Rtl8vQxtLLOuqxmj Ji+YRUOVBYoeYVisEy6an1Q= X-Google-Smtp-Source: ABdhPJxpKsWTAykfSJ0wzqMbrpgSPDXpwHBHIA/FIMsyOECQU+LDMn/kUKmdUMP/fDjvNhnD6Ap8RQ== X-Received: by 2002:a17:90a:fca:: with SMTP id 68mr9362904pjz.12.1596741330403; Thu, 06 Aug 2020 12:15:30 -0700 (PDT) Received: from localhost.localdomain ([2601:647:4802:9070:d88d:857c:b14c:519a]) by smtp.gmail.com with ESMTPSA id q16sm9784014pfg.153.2020.08.06.12.15.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 12:15:29 -0700 (PDT) From: Sagi Grimberg To: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Chaitanya Kulkarni , Johannes Thumshirn , Christoph Hellwig , Keith Busch Subject: [PATCH v2 6/7] common/multipath-over-rdma: don't retry module unload Date: Thu, 6 Aug 2020 12:15:17 -0700 Message-Id: <20200806191518.593880-7-sagi@grimberg.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200806191518.593880-1-sagi@grimberg.me> References: <20200806191518.593880-1-sagi@grimberg.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org There is no need to retry module unload for rdma_rxe and siw. This also creates a dependency on tests/nvmeof/rc which prevents it from using in other test subsystems. Signed-off-by: Sagi Grimberg --- common/multipath-over-rdma | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma index 676d2837fb06..e54b2a96153c 100644 --- a/common/multipath-over-rdma +++ b/common/multipath-over-rdma @@ -457,7 +457,7 @@ stop_soft_rdma() { fi done ) - if ! unload_module rdma_rxe 10; then + if ! modprobe -r rdma_rxe; then echo "Unloading rdma_rxe failed" return 1 fi @@ -469,7 +469,7 @@ stop_soft_rdma() { echo "Failed to unbind the siw driver from ${i%_siw}" done ) - if ! unload_module siw 10; then + if ! modprobe -r siw; then echo "Unloading siw failed" return 1 fi From patchwork Thu Aug 6 19:15:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 11704147 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B3BDA13B6 for ; Thu, 6 Aug 2020 19:15:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F060C221E3 for ; Thu, 6 Aug 2020 19:15:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727874AbgHFTPd (ORCPT ); Thu, 6 Aug 2020 15:15:33 -0400 Received: from mail-pf1-f171.google.com ([209.85.210.171]:34173 "EHLO mail-pf1-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725272AbgHFTPc (ORCPT ); Thu, 6 Aug 2020 15:15:32 -0400 Received: by mail-pf1-f171.google.com with SMTP id u185so25639782pfu.1 for ; Thu, 06 Aug 2020 12:15:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qtS7GN/DmlJ0+Y1Zkb7lIX2+dO3mjZPVKKexH9jrXr0=; b=lhbKOn4NL5lSZ4c6BEg9hZRW0+WUb4O+xmKmgYpCO3IPNf+LWNo3ZI291+TN206Ua2 7ChcJ2tCHD01im84aN+2f7u5s7Ql+CSI5r3VSTkiUPi+IxJdAaJ/s2YHtoTWZ3i5+UyE JcgZ7h7DupPgt3sVDl2Y2Dgb94skPUGr0VXWZ1G/vXiD23lU2Uii9XUYk8tV+7op8EC1 zIXLpBoNstCrwpOoHvI2eDza/YdTCFKgCEOte7JfKGhrSB+37AWvbHx8aoFUoDOmlkHE bSdB5JxPsadGkKSY6gkj+vohl3ko7OkHpFs0kiNSFczr2od2iLies4Tq4SY8Jsg4jlRF Xhug== X-Gm-Message-State: AOAM531SJY1jR17D3uyY/Q907TtwhdYvBTFZ6e7G7p2gaR9UDr9H+t+D 5T/d92Q/Qv9qhoXusRpGpuk= X-Google-Smtp-Source: ABdhPJwUfzHJygCkt/ZSQ/NWtPPZ6XqymFrerPVgKv9FB03oB+ePVKrT3K5BtKY/Z6wfaoIjcAZ++g== X-Received: by 2002:a62:fb0e:: with SMTP id x14mr10096870pfm.34.1596741331662; Thu, 06 Aug 2020 12:15:31 -0700 (PDT) Received: from localhost.localdomain ([2601:647:4802:9070:d88d:857c:b14c:519a]) by smtp.gmail.com with ESMTPSA id q16sm9784014pfg.153.2020.08.06.12.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2020 12:15:31 -0700 (PDT) From: Sagi Grimberg To: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org, Omar Sandoval Cc: Chaitanya Kulkarni , Johannes Thumshirn , Christoph Hellwig , Keith Busch Subject: [PATCH v2 7/7] nvme: support rdma transport type Date: Thu, 6 Aug 2020 12:15:18 -0700 Message-Id: <20200806191518.593880-8-sagi@grimberg.me> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200806191518.593880-1-sagi@grimberg.me> References: <20200806191518.593880-1-sagi@grimberg.me> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Sagi Grimberg --- tests/nvme/rc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index 69ab7d2f3964..31d02fefa70e 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -5,6 +5,7 @@ # Test specific to NVMe devices . common/rc +. common/multipath-over-rdma def_traddr="127.0.0.1" def_adrfam="ipv4" @@ -25,6 +26,12 @@ _nvme_requires() { _have_modules nvmet nvme-core nvme-tcp nvmet-tcp _have_configfs ;; + rdma) + _have_modules nvmet nvme-core nvme-rdma nvmet-rdma + _have_configfs + _have_program rdma + _have_modules rdma_rxe siw + ;; *) SKIP_REASON="unsupported nvme_trtype=${nvme_trtype}" return 1 @@ -115,6 +122,9 @@ _cleanup_nvmet() { modprobe -r nvmet-${nvme_trtype} 2>/dev/null fi modprobe -r nvmet 2>/dev/null + if [[ "${nvme_trtype}" == "rdma" ]]; then + stop_soft_rdma + fi } _setup_nvmet() { @@ -124,6 +134,11 @@ _setup_nvmet() { modprobe nvmet-${nvme_trtype} fi modprobe nvme-${nvme_trtype} + if [[ "${nvme_trtype}" == "rdma" ]]; then + start_soft_rdma + rdma_intfs=$(rdma_network_interfaces) + def_traddr=$(get_ipv4_addr ${rdma_intfs[0]}) + fi } _nvme_disconnect_ctrl() {