From patchwork Fri Aug 11 09:36:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350323 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86F50C001B0 for ; Fri, 11 Aug 2023 09:36:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235018AbjHKJgZ (ORCPT ); Fri, 11 Aug 2023 05:36:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235024AbjHKJgY (ORCPT ); Fri, 11 Aug 2023 05:36:24 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BD5B2709; Fri, 11 Aug 2023 02:36:22 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 014891F88C; Fri, 11 Aug 2023 09:36:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746581; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9RZ2Yzq36jl6W2j4gefEmERvFCX8trh+F8G0TYairgM=; b=LNefJHLTw6qvD0/sVgJrnnhuY5PLgra9PQgYn2GWkc83OBfRU8v468a0mmMTLK1yktmlWy bB5s303ZAIoYJPpR8Ools4jyte7fvhrHMxIBzvwQGXLbDyeoQS6aDSZXUVrF8xEHRG1gP3 YwBeEC4NlBGijjHIj/coNT16FmO82MU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746581; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9RZ2Yzq36jl6W2j4gefEmERvFCX8trh+F8G0TYairgM=; b=YHw2WhnxHLDJZXMyAgPMW87o6lkmNo+HXSH3yzdzlg7VhVyIdgDCf3SaeBzGqoOMVWxbJj VtJ8w7t8IOLRV1DA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C9DDB138E2; Fri, 11 Aug 2023 09:36:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VzuMIhQB1mSaHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:20 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 01/13] nvme/{003,004,005,013,046,049}: Group all variables declarations Date: Fri, 11 Aug 2023 11:36:02 +0200 Message-ID: <20230811093614.28005-2-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Group all variable declarations together at the beginning of the function. Many of the nvme tests do this but not all. Thus make these tests use the same style. This allows to spot the odd balls in the refactoring of the tests. Signed-off-by: Daniel Wagner --- tests/nvme/003 | 3 ++- tests/nvme/004 | 3 ++- tests/nvme/005 | 5 +++-- tests/nvme/013 | 1 - tests/nvme/046 | 1 + tests/nvme/049 | 1 + 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/nvme/003 b/tests/nvme/003 index 6604012d2068..aa26abf8d8b3 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -22,10 +22,11 @@ test() { _setup_nvmet + local loop_dev local port + port="$(_create_nvmet_port "${nvme_trtype}")" - local loop_dev loop_dev="$(losetup -f)" _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" diff --git a/tests/nvme/004 b/tests/nvme/004 index cab98ff44326..1e5c2b8b3e87 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -23,11 +23,12 @@ test() { _setup_nvmet local port + local loop_dev + port="$(_create_nvmet_port "${nvme_trtype}")" truncate -s "${nvme_img_size}" "$TMPDIR/img" - local loop_dev loop_dev="$(losetup -f --show "$TMPDIR/img")" _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" \ diff --git a/tests/nvme/005 b/tests/nvme/005 index 8e15a13f3794..836854086822 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -22,11 +22,13 @@ test() { _setup_nvmet local port + local loop_dev + local nvmedev + port="$(_create_nvmet_port "${nvme_trtype}")" truncate -s "${nvme_img_size}" "$TMPDIR/img" - local loop_dev loop_dev="$(losetup -f --show "$TMPDIR/img")" _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" \ @@ -35,7 +37,6 @@ test() { _nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1 - local nvmedev nvmedev=$(_find_nvme_dev "blktests-subsystem-1") udevadm settle diff --git a/tests/nvme/013 b/tests/nvme/013 index 14e646a19c47..2be8681616d1 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -26,7 +26,6 @@ test() { local port local nvmedev local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" diff --git a/tests/nvme/046 b/tests/nvme/046 index b37b9e98a559..942f25206c17 100755 --- a/tests/nvme/046 +++ b/tests/nvme/046 @@ -16,6 +16,7 @@ requires() { test_device() { echo "Running ${TEST_NAME}" + local ngdev=${TEST_DEV/nvme/ng} local perm nsid diff --git a/tests/nvme/049 b/tests/nvme/049 index f72862c6426d..599ab58d7a29 100755 --- a/tests/nvme/049 +++ b/tests/nvme/049 @@ -17,6 +17,7 @@ requires() { test_device() { echo "Running ${TEST_NAME}" + local ngdev=${TEST_DEV/nvme/ng} local common_args=( --size=1M From patchwork Fri Aug 11 09:36:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350324 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3EF5C001B0 for ; Fri, 11 Aug 2023 09:36:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235127AbjHKJge (ORCPT ); Fri, 11 Aug 2023 05:36:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235121AbjHKJgb (ORCPT ); Fri, 11 Aug 2023 05:36:31 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D06F30D6; Fri, 11 Aug 2023 02:36:28 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C40CF1F74A; Fri, 11 Aug 2023 09:36:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746586; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ySX0bPj+OlMTvPO100mpK3C4LxGQ/kzWWhKoP04YVHk=; b=VbMpFrod3ldH1MS01GB0y8S5/KfzgGqw0knj4Yf0a7mNb9GuUcGmJ0i2f6j4u+kRXlzqyx B08yvUOmf4paw4zh6VSGibx7xAbgkrggtmE6TK/1ziwyINk82gQKLffRHQbm9cV3FF27Zs BCAhl5ihDAljWjB4dlb8gre/Cni25NA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746586; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ySX0bPj+OlMTvPO100mpK3C4LxGQ/kzWWhKoP04YVHk=; b=fQWp79yuL39li4hY47smhIhNxqZK1RadgJCWBiMnPmdwqBmoBZem9PtSWlEuZYohlPl8u7 Lh+JLkyPUQ1r5HAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A805F138E2; Fri, 11 Aug 2023 09:36:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hxgGKBoB1mSlHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:26 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 02/13] nvme: Reorganize test preamble code section Date: Fri, 11 Aug 2023 11:36:03 +0200 Message-ID: <20230811093614.28005-3-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This unifies all the tests preamble code section. Reorganize all tests to start with printing the test name, then the setting nvmet and finally followed by the variable declarations. Signed-off-by: Daniel Wagner --- tests/nvme/006 | 4 ++-- tests/nvme/007 | 4 ++-- tests/nvme/016 | 4 ++-- tests/nvme/017 | 4 ++-- tests/nvme/030 | 8 ++++---- tests/nvme/031 | 8 ++++---- tests/nvme/033 | 7 ++++--- tests/nvme/034 | 7 ++++--- tests/nvme/035 | 7 ++++--- tests/nvme/036 | 7 ++++--- tests/nvme/037 | 8 ++++---- tests/nvme/038 | 6 +++--- tests/nvme/039 | 4 ++-- tests/nvme/040 | 7 ++++--- tests/nvme/041 | 8 ++++---- tests/nvme/042 | 8 ++++---- tests/nvme/043 | 8 ++++---- tests/nvme/044 | 8 ++++---- tests/nvme/045 | 8 ++++---- tests/nvme/048 | 8 ++++---- 20 files changed, 69 insertions(+), 64 deletions(-) diff --git a/tests/nvme/006 b/tests/nvme/006 index ea0db93791a7..b44c56b6a25d 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -18,12 +18,12 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local loop_dev local subsys_name="blktests-subsystem-1" - _setup_nvmet - truncate -s "${nvme_img_size}" "$TMPDIR/img" loop_dev="$(losetup -f --show "$TMPDIR/img")" diff --git a/tests/nvme/007 b/tests/nvme/007 index 243a79f5a254..112432df7a9d 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -17,12 +17,12 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local file_path local subsys_name="blktests-subsystem-1" - _setup_nvmet - file_path="${TMPDIR}/img" truncate -s "${nvme_img_size}" "${file_path}" diff --git a/tests/nvme/016 b/tests/nvme/016 index f617cf103900..cac0c0509aca 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -16,13 +16,13 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local iterations="${nvme_num_iter}" local loop_dev local subsys_nqn="blktests-subsystem-1" - _setup_nvmet - loop_dev="$(losetup -f)" local genctr=1 diff --git a/tests/nvme/017 b/tests/nvme/017 index 3dbb7c174b56..429a25e8e011 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -16,13 +16,13 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local file_path local iterations="${nvme_num_iter}" local subsys_name="blktests-subsystem-1" - _setup_nvmet - file_path="${TMPDIR}/img" truncate -s "${nvme_img_size}" "${file_path}" diff --git a/tests/nvme/030 b/tests/nvme/030 index cfcdcbe6be23..a0b999cace94 100755 --- a/tests/nvme/030 +++ b/tests/nvme/030 @@ -16,14 +16,14 @@ requires() { } test() { - local port - local genctr - local subsys="blktests-subsystem-" - echo "Running ${TEST_NAME}" _setup_nvmet + local port + local genctr + local subsys="blktests-subsystem-" + port="$(_create_nvmet_port "${nvme_trtype}")" _create_nvmet_subsystem "${subsys}1" "$(losetup -f)" diff --git a/tests/nvme/031 b/tests/nvme/031 index e70898819a86..27b08e96dd0b 100755 --- a/tests/nvme/031 +++ b/tests/nvme/031 @@ -24,15 +24,15 @@ requires() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-" local iterations=10 local loop_dev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - truncate -s "${nvme_img_size}" "$TMPDIR/img" loop_dev="$(losetup -f --show "$TMPDIR/img")" diff --git a/tests/nvme/033 b/tests/nvme/033 index 90aee817de5d..5a4fac03bea0 100755 --- a/tests/nvme/033 +++ b/tests/nvme/033 @@ -45,13 +45,14 @@ compare_dev_info() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") diff --git a/tests/nvme/034 b/tests/nvme/034 index e0ede717c373..334b2525d1b6 100755 --- a/tests/nvme/034 +++ b/tests/nvme/034 @@ -15,14 +15,15 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") diff --git a/tests/nvme/035 b/tests/nvme/035 index 0896f7bb578d..68a9b608920e 100755 --- a/tests/nvme/035 +++ b/tests/nvme/035 @@ -21,14 +21,15 @@ device_requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") diff --git a/tests/nvme/036 b/tests/nvme/036 index 8218c6538dfd..c3fc5d4a948d 100755 --- a/tests/nvme/036 +++ b/tests/nvme/036 @@ -14,13 +14,14 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}") diff --git a/tests/nvme/037 b/tests/nvme/037 index fc6c21343652..5a78444b7e78 100755 --- a/tests/nvme/037 +++ b/tests/nvme/037 @@ -13,15 +13,15 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-" local iterations=10 local ctrldev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - for ((i = 0; i < iterations; i++)); do port=$(_nvmet_passthru_target_setup "${subsys}${i}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" \ diff --git a/tests/nvme/038 b/tests/nvme/038 index 24f02d4ad4d1..5af28da03c36 100755 --- a/tests/nvme/038 +++ b/tests/nvme/038 @@ -19,13 +19,13 @@ requires() { } test() { - local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" - local port - echo "Running ${TEST_NAME}" _setup_nvmet + local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" + local port + mkdir -p "${subsys_path}" rmdir "${subsys_path}" diff --git a/tests/nvme/039 b/tests/nvme/039 index f327b54a8d00..73b53d0b949c 100755 --- a/tests/nvme/039 +++ b/tests/nvme/039 @@ -131,12 +131,12 @@ inject_invalid_admin_cmd() } test_device() { + echo "Running ${TEST_NAME}" + local nvme_verbose_errors local ns_dev local ctrl_dev - echo "Running ${TEST_NAME}" - if _check_kernel_option NVME_VERBOSE_ERRORS; then nvme_verbose_errors=true else diff --git a/tests/nvme/040 b/tests/nvme/040 index 688a0939a376..3b76753132f3 100755 --- a/tests/nvme/040 +++ b/tests/nvme/040 @@ -17,6 +17,10 @@ requires() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local file_path="${TMPDIR}/img" local port @@ -24,9 +28,6 @@ test() { local nvmedev local fio_pid - echo "Running ${TEST_NAME}" - - _setup_nvmet truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" diff --git a/tests/nvme/041 b/tests/nvme/041 index 5b04b99b128e..d8937915d622 100755 --- a/tests/nvme/041 +++ b/tests/nvme/041 @@ -20,6 +20,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -28,8 +32,6 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" @@ -38,8 +40,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ diff --git a/tests/nvme/042 b/tests/nvme/042 index 8df5ed37aacc..af291cb33a04 100755 --- a/tests/nvme/042 +++ b/tests/nvme/042 @@ -20,6 +20,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -30,13 +34,9 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" diff --git a/tests/nvme/043 b/tests/nvme/043 index 8f4b783a02ff..4a37f91e50c3 100755 --- a/tests/nvme/043 +++ b/tests/nvme/043 @@ -21,6 +21,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -31,8 +35,6 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" @@ -41,8 +43,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" diff --git a/tests/nvme/044 b/tests/nvme/044 index fca0897af27b..27cb343f5ea7 100755 --- a/tests/nvme/044 +++ b/tests/nvme/044 @@ -21,6 +21,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -30,8 +34,6 @@ test() { local ctrlkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" @@ -47,8 +49,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" diff --git a/tests/nvme/045 b/tests/nvme/045 index eca629a18691..005d62d4f886 100755 --- a/tests/nvme/045 +++ b/tests/nvme/045 @@ -22,6 +22,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid @@ -34,8 +38,6 @@ test() { local ctrldev local rand_io_size - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" @@ -51,8 +53,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" diff --git a/tests/nvme/048 b/tests/nvme/048 index a6ebb8927865..6efcd7d6ab03 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -81,6 +81,10 @@ set_qid_max() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys_name="blktests-subsystem-1" local cfs_path="${NVMET_CFS}/subsystems/${subsys_name}" local file_path="${TMPDIR}/img" @@ -89,10 +93,6 @@ test() { local hostid local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - hostid="${def_hostid}" hostnqn="${def_hostnqn}" From patchwork Fri Aug 11 09:36:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350325 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACCDBC04A94 for ; Fri, 11 Aug 2023 09:36:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235232AbjHKJgl (ORCPT ); Fri, 11 Aug 2023 05:36:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235103AbjHKJgd (ORCPT ); Fri, 11 Aug 2023 05:36:33 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D017130E3; Fri, 11 Aug 2023 02:36:28 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 87CED1F889; Fri, 11 Aug 2023 09:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746587; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RiLrAjI/PW50HvWlrm+PJmGFw1sGaHe93CcjuVC440I=; b=oNqi5h5/zwJ1tvBsN0wv/SlP/ckB3ZsZQeRvjdmqQmV1LuGJy5Vt10BQT8dVNhusqUYI2K ZrhGewvKeqltHEfEBZarAhXgpYLCELx/YYHM3BzeDZaGFCIBY1K2fFLC7SHosNc7B4GQ7Q L+6JHtwq9/MUE6cw56JQM0C+0+nD2zU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746587; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RiLrAjI/PW50HvWlrm+PJmGFw1sGaHe93CcjuVC440I=; b=To25ejZnOeNxcNud8cyUIGi/7vGMfwzsD6lcY5HU33O0SqROpVN7qUjg9uqOcGY4OAmleD v5KXjZEQqhODwNDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 76265138E2; Fri, 11 Aug 2023 09:36:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 91rlGxsB1mSrHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:27 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 03/13] nvme/043: Use hostnqn to generate DHCAP key Date: Fri, 11 Aug 2023 11:36:04 +0200 Message-ID: <20230811093614.28005-4-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The key is supposed to be derived from the hostnqn not fom the subsys name. Signed-off-by: Daniel Wagner --- tests/nvme/043 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/nvme/043 b/tests/nvme/043 index 4a37f91e50c3..b5cb8378681e 100755 --- a/tests/nvme/043 +++ b/tests/nvme/043 @@ -37,7 +37,7 @@ test() { hostid="${def_hostid}" hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${hostnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "nvme gen-dhchap-key failed" return 1 From patchwork Fri Aug 11 09:36:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350326 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A020C05052 for ; Fri, 11 Aug 2023 09:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235143AbjHKJgn (ORCPT ); Fri, 11 Aug 2023 05:36:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235148AbjHKJge (ORCPT ); Fri, 11 Aug 2023 05:36:34 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37AF230F3; Fri, 11 Aug 2023 02:36:30 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id A9D1421881; Fri, 11 Aug 2023 09:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746589; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GDAhw9eRdNKsV1ijHWKTKzdqUh/Rv/zY5LtVB/qhHdc=; b=aWuuUbfXfvLgBZA3cxl3poFpSrqqxBeY0y9TGuZlztqf7dZewgIHLP9MnspoioPBUsTLMp 5kAUpCEvNnby5InGgR/QsPVH9q2JDYXFProAqosf3trO4TQ/nGS8yFg/JUsoku3yE7ZsRA 9ig9BwIFNtbonyBCkiJ+v7hgPWTEvX8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746589; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GDAhw9eRdNKsV1ijHWKTKzdqUh/Rv/zY5LtVB/qhHdc=; b=JXoeHmfrlRB7IcxO20oSfWN1M4WCD/5SghZv4vA2sS9PjnRDxbB6WSjuH7jbFo/x2mDXDW m24W1jcIb3NLc/DQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 99197138E2; Fri, 11 Aug 2023 09:36:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eCJ5JB0B1mSvHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:29 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 04/13] nvme/rc: Add common subsystem nqn define Date: Fri, 11 Aug 2023 11:36:05 +0200 Message-ID: <20230811093614.28005-5-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add common subsystem nqn as global definition so that we can reuse it. Signed-off-by: Daniel Wagner --- tests/nvme/rc | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index 4f3a994d75ce..c11848b59c49 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -16,6 +16,7 @@ def_local_wwnn="0x10001100aa000002" def_local_wwpn="0x20001100aa000002" def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349" def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" +def_subsysnqn="blktests-subsystem-1" nvme_trtype=${nvme_trtype:-"loop"} nvme_img_size=${nvme_img_size:-"1G"} nvme_num_iter=${nvme_num_iter:-"1000"} From patchwork Fri Aug 11 09:36:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350336 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C295C04A6A for ; Fri, 11 Aug 2023 09:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235240AbjHKJg4 (ORCPT ); Fri, 11 Aug 2023 05:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235221AbjHKJgl (ORCPT ); Fri, 11 Aug 2023 05:36:41 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D7B93585; Fri, 11 Aug 2023 02:36:32 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3AAFE2186E; Fri, 11 Aug 2023 09:36:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746591; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+m0JXEcbUIJ4UstFeWQyh7RyMudlXdO0pOJ80U7IjD0=; b=ghb/CekoM3M5jP7nYF5U1NN0tBQcIXghiKxpEu/tA7DsBXQUB7bQmQCsrRGYnm0eVq15R4 EKb4UftxpQWLjhezP9HyThlYDMjRuqdiLePZUv1hYUEA29Qz/D0IGviChKGF9krw6JC7j0 rvSWHKwDxFiCgD8CphfuAcSR3X2e33M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746591; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+m0JXEcbUIJ4UstFeWQyh7RyMudlXdO0pOJ80U7IjD0=; b=lR7aIv8oW1TigVjDPQrFKXI1LnrTlx2gwGNCKMSxbUWb5fBpFAPKogPEOg+ZnQl1DTkAMM PjYbdB27yMw3PqDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E345D138E2; Fri, 11 Aug 2023 09:36:30 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id yMBiNx4B1mS1HwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:30 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 05/13] nvme: Use def_subsysnqn variable instead local variable Date: Fri, 11 Aug 2023 11:36:06 +0200 Message-ID: <20230811093614.28005-6-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org As all tests are using the same subsystem nqn anyway, use the def_subsysnqn variable and drop the local subsys_name variable. Signed-off-by: Daniel Wagner --- tests/nvme/003 | 8 ++++---- tests/nvme/004 | 14 +++++++------- tests/nvme/005 | 12 ++++++------ tests/nvme/006 | 9 ++++----- tests/nvme/007 | 9 ++++----- tests/nvme/008 | 15 +++++++-------- tests/nvme/009 | 15 +++++++-------- tests/nvme/010 | 15 +++++++-------- tests/nvme/011 | 15 +++++++-------- tests/nvme/012 | 15 +++++++-------- tests/nvme/013 | 15 +++++++-------- tests/nvme/014 | 15 +++++++-------- tests/nvme/015 | 15 +++++++-------- tests/nvme/016 | 13 ++++++------- tests/nvme/017 | 13 ++++++------- tests/nvme/018 | 15 +++++++-------- tests/nvme/019 | 15 +++++++-------- tests/nvme/020 | 15 +++++++-------- tests/nvme/021 | 15 +++++++-------- tests/nvme/022 | 15 +++++++-------- tests/nvme/023 | 15 +++++++-------- tests/nvme/024 | 15 +++++++-------- tests/nvme/025 | 15 +++++++-------- tests/nvme/026 | 15 +++++++-------- tests/nvme/027 | 15 +++++++-------- tests/nvme/028 | 15 +++++++-------- tests/nvme/029 | 15 +++++++-------- tests/nvme/033 | 2 +- tests/nvme/034 | 2 +- tests/nvme/035 | 2 +- tests/nvme/036 | 2 +- tests/nvme/038 | 2 +- tests/nvme/040 | 13 ++++++------- tests/nvme/041 | 21 ++++++++++----------- tests/nvme/042 | 23 +++++++++++------------ tests/nvme/043 | 18 +++++++++--------- tests/nvme/044 | 31 +++++++++++++++---------------- tests/nvme/045 | 27 +++++++++++++-------------- tests/nvme/047 | 19 +++++++++---------- tests/nvme/048 | 23 +++++++++++------------ 40 files changed, 266 insertions(+), 297 deletions(-) diff --git a/tests/nvme/003 b/tests/nvme/003 index aa26abf8d8b3..71b82ce758a3 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -29,8 +29,8 @@ test() { loop_dev="$(losetup -f)" - _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" - _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _nvme_connect_subsys "${nvme_trtype}" nqn.2014-08.org.nvmexpress.discovery @@ -46,8 +46,8 @@ test() { fi _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_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" echo "Test complete" diff --git a/tests/nvme/004 b/tests/nvme/004 index 1e5c2b8b3e87..0314ed3c949e 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -31,20 +31,20 @@ test() { loop_dev="$(losetup -f --show "$TMPDIR/img")" - _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1 + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" local nvmedev - nvmedev=$(_find_nvme_dev "blktests-subsystem-1") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - _nvme_disconnect_subsys blktests-subsystem-1 - _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" - _remove_nvmet_subsystem "blktests-subsystem-1" + _nvme_disconnect_subsys ${def_subsysnqn} + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "$loop_dev" rm "$TMPDIR/img" diff --git a/tests/nvme/005 b/tests/nvme/005 index 836854086822..935b8634cb96 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -31,23 +31,23 @@ test() { loop_dev="$(losetup -f --show "$TMPDIR/img")" - _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1 + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "blktests-subsystem-1") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") udevadm settle echo 1 > "/sys/class/nvme/${nvmedev}/reset_controller" _nvme_disconnect_ctrl "${nvmedev}" - _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_port "${port}" - _remove_nvmet_subsystem "blktests-subsystem-1" + _remove_nvmet_subsystem "${def_subsysnqn}" losetup -d "$loop_dev" rm "$TMPDIR/img" diff --git a/tests/nvme/006 b/tests/nvme/006 index b44c56b6a25d..066acabb1175 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -22,19 +22,18 @@ test() { local port local loop_dev - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "$TMPDIR/img" loop_dev="$(losetup -f --show "$TMPDIR/img")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "$loop_dev" diff --git a/tests/nvme/007 b/tests/nvme/007 index 112432df7a9d..c6ba36cc4b4f 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -21,19 +21,18 @@ test() { local port local file_path - local subsys_name="blktests-subsystem-1" file_path="${TMPDIR}/img" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}" diff --git a/tests/nvme/008 b/tests/nvme/008 index 5abc4240ca46..c3fbcbc59686 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -24,29 +24,28 @@ test() { local nvmedev local loop_dev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/009 b/tests/nvme/009 index 491d3c809ab0..88c27889fbe1 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -22,27 +22,26 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}" diff --git a/tests/nvme/010 b/tests/nvme/010 index d2eb95311510..38c062ec73f4 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -24,30 +24,29 @@ test() { local nvmedev local loop_dev local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" _run_fio_verify_io --size="${nvme_img_size}" \ --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/011 b/tests/nvme/011 index da8cbac11124..0dab74e7e5b5 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -24,28 +24,27 @@ test() { local nvmedev local file_path local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" _run_fio_verify_io --size="${nvme_img_size}" \ --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}" diff --git a/tests/nvme/012 b/tests/nvme/012 index efe227538c57..8ed57d3a5ab0 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -28,29 +28,28 @@ test() { local nvmedev local loop_dev local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" _xfs_run_fio_verify_io "/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/013 b/tests/nvme/013 index 2be8681616d1..e3eb4e914750 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -26,27 +26,26 @@ test() { local port local nvmedev local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" _xfs_run_fio_verify_io "/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}" diff --git a/tests/nvme/014 b/tests/nvme/014 index 55d920f2660b..cbafd802af16 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -27,20 +27,19 @@ test() { local bs local count local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -53,10 +52,10 @@ test() { nvme flush "/dev/${nvmedev}" -n 1 - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/015 b/tests/nvme/015 index 071141380e43..b32d16a91de8 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -26,18 +26,17 @@ test() { local bs local count local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -50,10 +49,10 @@ test() { nvme flush "/dev/${nvmedev}n1" -n 1 - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}" diff --git a/tests/nvme/016 b/tests/nvme/016 index cac0c0509aca..908abbdaaa75 100755 --- a/tests/nvme/016 +++ b/tests/nvme/016 @@ -21,30 +21,29 @@ test() { local port local iterations="${nvme_num_iter}" local loop_dev - local subsys_nqn="blktests-subsystem-1" loop_dev="$(losetup -f)" local genctr=1 - _create_nvmet_subsystem "${subsys_nqn}" "${loop_dev}" + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" for ((i = 2; i <= iterations; i++)); do - _create_nvmet_ns "${subsys_nqn}" "${i}" "${loop_dev}" + _create_nvmet_ns "${def_subsysnqn}" "${i}" "${loop_dev}" done port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "$port" "${subsys_nqn}" + _add_nvmet_subsys_to_port "$port" "${def_subsysnqn}" genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port") - _remove_nvmet_subsystem_from_port "${port}" "${subsys_nqn}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_port "${port}" for ((i = iterations; i > 1; i--)); do - _remove_nvmet_ns "${subsys_nqn}" "$i" + _remove_nvmet_ns "${def_subsysnqn}" "$i" done - _remove_nvmet_subsystem "${subsys_nqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" echo "Test complete" } diff --git a/tests/nvme/017 b/tests/nvme/017 index 429a25e8e011..6f7ef5882d3e 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -21,7 +21,6 @@ test() { local port local file_path local iterations="${nvme_num_iter}" - local subsys_name="blktests-subsystem-1" file_path="${TMPDIR}/img" @@ -29,26 +28,26 @@ test() { local genctr=1 - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" for ((i = 2; i <= iterations; i++)); do - _create_nvmet_ns "${subsys_name}" "${i}" "${file_path}" + _create_nvmet_ns "${def_subsysnqn}" "${i}" "${file_path}" done port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port") - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_port "${port}" for ((i = iterations; i > 1; i--)); do - _remove_nvmet_ns "${subsys_name}" "$i" + _remove_nvmet_ns "${def_subsysnqn}" "$i" done - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem "${def_subsysnqn}" rm "${file_path}" diff --git a/tests/nvme/018 b/tests/nvme/018 index 78e9b2bb94d8..155f094ea6b3 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -24,18 +24,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -47,10 +46,10 @@ 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_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}" diff --git a/tests/nvme/019 b/tests/nvme/019 index 9fff8ccaac9c..4ac351cbb782 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -24,7 +24,6 @@ test() { local nvmedev local loop_dev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" @@ -32,23 +31,23 @@ test() { loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/020 b/tests/nvme/020 index 1966d5925213..744d4b7d6805 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -22,29 +22,28 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}" diff --git a/tests/nvme/021 b/tests/nvme/021 index 1fefc0fbca00..1fd9bcbb3d23 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -23,18 +23,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -42,10 +41,10 @@ test() { echo "ERROR: device not listed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}" diff --git a/tests/nvme/022 b/tests/nvme/022 index 1ff915786f86..053991625250 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -23,18 +23,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -42,10 +41,10 @@ test() { echo "ERROR: reset failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}" diff --git a/tests/nvme/023 b/tests/nvme/023 index 90316230a3d7..c10e5a0138a8 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -24,20 +24,19 @@ test() { local nvmedev local loop_dev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -45,10 +44,10 @@ test() { echo "ERROR: smart-log bdev-ns failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/024 b/tests/nvme/024 index 384a8266e741..d1d7f0bfb994 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -23,28 +23,27 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" if ! nvme smart-log "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then echo "ERROR: smart-log file-ns failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}" diff --git a/tests/nvme/025 b/tests/nvme/025 index 815223d1c28d..ea944830612b 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -23,18 +23,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -42,10 +41,10 @@ test() { echo "ERROR: effects-log failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}" diff --git a/tests/nvme/026 b/tests/nvme/026 index d2203f19f026..f1193c20477c 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -23,18 +23,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -42,10 +41,10 @@ test() { echo "ERROR: ns-desc failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}" diff --git a/tests/nvme/027 b/tests/nvme/027 index 97fe70e78344..c097c51ea4f3 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -23,28 +23,27 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" if ! nvme ns-rescan "/dev/${nvmedev}" >> "$FULL" 2>&1; then echo "ERROR: ns-rescan failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}" diff --git a/tests/nvme/028 b/tests/nvme/028 index c539620bee28..6e37be4893b1 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -23,28 +23,27 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" if ! nvme list-subsys 2>> "$FULL" | grep -q "${nvme_trtype}"; then echo "ERROR: list-subsys" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}" diff --git a/tests/nvme/029 b/tests/nvme/029 index c6d38b42af70..4d0ca997404b 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -57,20 +57,19 @@ test() { local nvmedev local loop_dev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" @@ -82,10 +81,10 @@ 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_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/033 b/tests/nvme/033 index 5a4fac03bea0..46a520ae01fa 100755 --- a/tests/nvme/033 +++ b/tests/nvme/033 @@ -49,7 +49,7 @@ test_device() { _setup_nvmet - local subsys="blktests-subsystem-1" + local subsys="${def_subsysnqn}" local nsdev local port diff --git a/tests/nvme/034 b/tests/nvme/034 index 334b2525d1b6..3c65d92cbaea 100755 --- a/tests/nvme/034 +++ b/tests/nvme/034 @@ -19,7 +19,7 @@ test_device() { _setup_nvmet - local subsys="blktests-subsystem-1" + local subsys="${def_subsysnqn}" local ctrldev local nsdev local port diff --git a/tests/nvme/035 b/tests/nvme/035 index 68a9b608920e..c705d9cf25a4 100755 --- a/tests/nvme/035 +++ b/tests/nvme/035 @@ -25,7 +25,7 @@ test_device() { _setup_nvmet - local subsys="blktests-subsystem-1" + local subsys="${def_subsysnqn}" local ctrldev local nsdev local port diff --git a/tests/nvme/036 b/tests/nvme/036 index c3fc5d4a948d..2e933cc41928 100755 --- a/tests/nvme/036 +++ b/tests/nvme/036 @@ -18,7 +18,7 @@ test_device() { _setup_nvmet - local subsys="blktests-subsystem-1" + local subsys="${def_subsysnqn}" local ctrldev local port diff --git a/tests/nvme/038 b/tests/nvme/038 index 5af28da03c36..007b5f425312 100755 --- a/tests/nvme/038 +++ b/tests/nvme/038 @@ -23,7 +23,7 @@ test() { _setup_nvmet - local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" + local subsys_path="${NVMET_CFS}/subsystems/${def_subsysnqn}" local port mkdir -p "${subsys_path}" diff --git a/tests/nvme/040 b/tests/nvme/040 index 3b76753132f3..8d7f68f9a2d7 100755 --- a/tests/nvme/040 +++ b/tests/nvme/040 @@ -21,7 +21,6 @@ test() { _setup_nvmet - local subsys="blktests-subsystem-1" local file_path="${TMPDIR}/img" local port local loop_dev @@ -32,11 +31,11 @@ test() { loop_dev="$(losetup -f --show "${file_path}")" port="$(_create_nvmet_port "${nvme_trtype}")" - _create_nvmet_subsystem "${subsys}" "${loop_dev}" - _add_nvmet_subsys_to_port "${port}" "${subsys}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys}" + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" udevadm settle - nvmedev=$(_find_nvme_dev "${subsys}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") # start fio job echo "starting background fio" @@ -55,8 +54,8 @@ test() { { kill "${fio_pid}"; wait; } &> /dev/null - _remove_nvmet_subsystem_from_port "${port}" "${subsys}" - _remove_nvmet_subsystem "${subsys}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/041 b/tests/nvme/041 index d8937915d622..fbceaa1cb2d5 100755 --- a/tests/nvme/041 +++ b/tests/nvme/041 @@ -25,7 +25,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img" @@ -34,7 +33,7 @@ test() { hostid="${def_hostid}" hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "nvme gen-dhchap-key failed" return 1 @@ -42,33 +41,33 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" "${hostkey}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" # Test unauthenticated connection (should fail) echo "Test unauthenticated connection (should fail)" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" # Test authenticated connection echo "Test authenticated connection" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/042 b/tests/nvme/042 index af291cb33a04..28d712e835df 100755 --- a/tests/nvme/042 +++ b/tests/nvme/042 @@ -25,7 +25,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img" @@ -39,50 +38,50 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" for hmac in 0 1 2 3; do echo "Testing hmac ${hmac}" - hostkey="$(nvme gen-dhchap-key --hmac=${hmac} -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key --hmac=${hmac} -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "couldn't generate host key for hmac ${hmac}" return 1 fi _set_nvmet_hostkey "${hostnqn}" "${hostkey}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" done for key_len in 32 48 64; do echo "Testing key length ${key_len}" - hostkey="$(nvme gen-dhchap-key --key-length=${key_len} -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key --key-length=${key_len} -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "couldn't generate host key for length ${key_len}" return 1 fi _set_nvmet_hostkey "${hostnqn}" "${hostkey}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" done - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/043 b/tests/nvme/043 index b5cb8378681e..184b1254a383 100755 --- a/tests/nvme/043 +++ b/tests/nvme/043 @@ -45,10 +45,10 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" "${hostkey}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" for hash in "hmac(sha256)" "hmac(sha384)" "hmac(sha512)" ; do @@ -56,14 +56,14 @@ test() { _set_nvmet_hash "${hostnqn}" "${hash}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" done for dhgroup in "ffdhe2048" "ffdhe3072" "ffdhe4096" "ffdhe6144" "ffdhe8192" ; do @@ -72,18 +72,18 @@ test() { _set_nvmet_dhgroup "${hostnqn}" "${dhgroup}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" done - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/044 b/tests/nvme/044 index 27cb343f5ea7..608a086a0864 100755 --- a/tests/nvme/044 +++ b/tests/nvme/044 @@ -26,7 +26,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img" @@ -37,13 +36,13 @@ test() { hostid="${def_hostid}" hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "failed to generate host key" return 1 fi - ctrlkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$ctrlkey" ] ; then echo "failed to generate ctrl key" return 1 @@ -51,29 +50,29 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" \ + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" \ "${hostkey}" "${ctrlkey}" _set_nvmet_dhgroup "${hostnqn}" "ffdhe2048" # Step 1: Connect with host authentication only echo "Test host authentication" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" # Step 2: Connect with host authentication # and invalid ctrl authentication echo "Test invalid ctrl authentication (should fail)" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" \ @@ -81,12 +80,12 @@ test() { udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" # Step 3: Connect with host authentication # and valid ctrl authentication echo "Test valid ctrl authentication" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" \ @@ -94,13 +93,13 @@ test() { udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" # Step 4: Connect with host authentication # and invalid ctrl key echo "Test invalid ctrl key (should fail)" invkey="DHHC-1:00:Jc/My1o0qtLCWRp+sHhAVafdfaS7YQOMYhk9zSmlatobqB8C:" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" \ @@ -108,10 +107,10 @@ test() { udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/045 b/tests/nvme/045 index 005d62d4f886..b8d886aaf9e8 100755 --- a/tests/nvme/045 +++ b/tests/nvme/045 @@ -27,7 +27,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img" @@ -41,13 +40,13 @@ test() { hostid="${def_hostid}" hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "failed to generate host key" return 1 fi - ctrlkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$ctrlkey" ] ; then echo "failed to generate ctrl key" return 1 @@ -55,14 +54,14 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" "${hostkey}" "${ctrlkey}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" "${ctrlkey}" _set_nvmet_dhgroup "${hostnqn}" "ffdhe2048" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" \ @@ -72,7 +71,7 @@ test() { echo "Re-authenticate with original host key" - ctrldev=$(_find_nvme_dev "${subsys_name}") + ctrldev=$(_find_nvme_dev "${def_subsysnqn}") if [ -z "$ctrldev" ] ; then echo "nvme controller not found" fi @@ -81,7 +80,7 @@ test() { echo "Renew host key on the controller" - new_hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + new_hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" _set_nvmet_hostkey "${hostnqn}" "${new_hostkey}" @@ -91,7 +90,7 @@ test() { echo "Renew ctrl key on the controller" - new_ctrlkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + new_ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" _set_nvmet_ctrlkey "${hostnqn}" "${new_ctrlkey}" @@ -116,15 +115,15 @@ test() { echo "${new_hostkey}" > "${hostkey_file}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") rand_io_size="$(_nvme_calc_rand_io_size 4m)" _run_fio_rand_io --size="${rand_io_size}" --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" diff --git a/tests/nvme/047 b/tests/nvme/047 index 6a7599bc2e91..b435dd3cecba 100755 --- a/tests/nvme/047 +++ b/tests/nvme/047 @@ -27,37 +27,36 @@ test() { local loop_dev local rand_io_size local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --nr-write-queues 1 || echo FAIL - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") rand_io_size="$(_nvme_calc_rand_io_size 4M)" _run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}" - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --nr-write-queues 1 \ --nr-poll-queues 1 || echo FAIL _run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}" - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}" diff --git a/tests/nvme/048 b/tests/nvme/048 index 6efcd7d6ab03..20d234e72621 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -85,8 +85,7 @@ test() { _setup_nvmet - local subsys_name="blktests-subsystem-1" - local cfs_path="${NVMET_CFS}/subsystems/${subsys_name}" + local cfs_path="${NVMET_CFS}/subsystems/${def_subsysnqn}" local file_path="${TMPDIR}/img" local skipped=false local hostnqn @@ -98,34 +97,34 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" if [[ -f "${cfs_path}/attr_qid_max" ]] ; then - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --keep-alive-tmo 1 \ --reconnect-delay 2 - if ! nvmf_wait_for_state "${subsys_name}" "live" ; then + if ! nvmf_wait_for_state "${def_subsysnqn}" "live" ; then echo FAIL else - set_qid_max "${port}" "${subsys_name}" 1 || echo FAIL - set_qid_max "${port}" "${subsys_name}" 2 || echo FAIL + set_qid_max "${port}" "${def_subsysnqn}" 1 || echo FAIL + set_qid_max "${port}" "${def_subsysnqn}" 2 || echo FAIL fi - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" else SKIP_REASONS+=("missing attr_qid_max feature") skipped=true fi - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" _remove_nvmet_host "${hostnqn}" From patchwork Fri Aug 11 09:36:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350329 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2C91C41513 for ; Fri, 11 Aug 2023 09:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235322AbjHKJgz (ORCPT ); Fri, 11 Aug 2023 05:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235224AbjHKJgl (ORCPT ); Fri, 11 Aug 2023 05:36:41 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 935E02709; Fri, 11 Aug 2023 02:36:33 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 05B7D1F88C; Fri, 11 Aug 2023 09:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746592; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wbSYEnKkGXGqX18jnJi5i9S+f6p5r42QmN0Vp86bh/4=; b=RYBQEyNgCrhzij6lDPRssP1C6WIAgjSE6bmHtclOkprByr+9vEk6c8FN0EoiQGRUTASScw dcit+8cOD2vwMV/LiGqUiinohtNTe8NXc1V/x+WxuPwv09bd7hoKipL757oeLdJYXXZMWK tr36vaAeHnQHhO0aOzpVGV7oBxT8u84= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746592; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wbSYEnKkGXGqX18jnJi5i9S+f6p5r42QmN0Vp86bh/4=; b=AY+JD2RTmI1tK6HOI6gJ2AcnPXMjJRWZR71pUaKZgCpFYfH4hobCpNVsgAYy49tRCOPQQW Ax32e1nQBWLL2EBQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id DDEAA138E2; Fri, 11 Aug 2023 09:36:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id e/YtNR8B1mS+HwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:31 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 06/13] nvme/{041,042,043,044,045,048}: Remove local variable hostnqn and hostid Date: Fri, 11 Aug 2023 11:36:07 +0200 Message-ID: <20230811093614.28005-7-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Commit acc408477e85 ("nvme/{041,042,043,044,045,048}: Use default hostnqn and hostid") switched the test over to use the default hostnqn. It missed the change to remove the local variable and use the def_hostnqn/def_hostid directly. Signed-off-by: Daniel Wagner --- tests/nvme/041 | 16 ++++++---------- tests/nvme/042 | 21 ++++++++------------- tests/nvme/043 | 23 +++++++++-------------- tests/nvme/044 | 27 +++++++++++---------------- tests/nvme/045 | 23 +++++++++-------------- tests/nvme/048 | 12 ++++-------- 6 files changed, 47 insertions(+), 75 deletions(-) diff --git a/tests/nvme/041 b/tests/nvme/041 index fbceaa1cb2d5..4c553251f379 100755 --- a/tests/nvme/041 +++ b/tests/nvme/041 @@ -25,14 +25,10 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hostkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "nvme gen-dhchap-key failed" @@ -45,21 +41,21 @@ test() { "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" # Test unauthenticated connection (should fail) echo "Test unauthenticated connection (should fail)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" _nvme_disconnect_subsys "${def_subsysnqn}" # Test authenticated connection echo "Test authenticated connection" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle @@ -71,7 +67,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}" diff --git a/tests/nvme/042 b/tests/nvme/042 index 28d712e835df..866249ed598c 100755 --- a/tests/nvme/042 +++ b/tests/nvme/042 @@ -25,23 +25,18 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hmac local key_len local hostkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" for hmac in 0 1 2 3; do echo "Testing hmac ${hmac}" @@ -50,11 +45,11 @@ test() { echo "couldn't generate host key for hmac ${hmac}" return 1 fi - _set_nvmet_hostkey "${hostnqn}" "${hostkey}" + _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle @@ -68,11 +63,11 @@ test() { echo "couldn't generate host key for length ${key_len}" return 1 fi - _set_nvmet_hostkey "${hostnqn}" "${hostkey}" + _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle @@ -85,7 +80,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}" diff --git a/tests/nvme/043 b/tests/nvme/043 index 184b1254a383..5569a7a58ad5 100755 --- a/tests/nvme/043 +++ b/tests/nvme/043 @@ -26,18 +26,13 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hash local dhgroup local hostkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${hostnqn} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_hostnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "nvme gen-dhchap-key failed" return 1 @@ -48,17 +43,17 @@ test() { _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" for hash in "hmac(sha256)" "hmac(sha384)" "hmac(sha512)" ; do echo "Testing hash ${hash}" - _set_nvmet_hash "${hostnqn}" "${hash}" + _set_nvmet_hash "${def_hostnqn}" "${hash}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle @@ -70,11 +65,11 @@ test() { echo "Testing DH group ${dhgroup}" - _set_nvmet_dhgroup "${hostnqn}" "${dhgroup}" + _set_nvmet_dhgroup "${def_hostnqn}" "${dhgroup}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle @@ -87,7 +82,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}" diff --git a/tests/nvme/044 b/tests/nvme/044 index 608a086a0864..6c2cb602313c 100755 --- a/tests/nvme/044 +++ b/tests/nvme/044 @@ -26,16 +26,11 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hostkey local ctrlkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "failed to generate host key" @@ -53,16 +48,16 @@ test() { _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" \ + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ "${hostkey}" "${ctrlkey}" - _set_nvmet_dhgroup "${hostnqn}" "ffdhe2048" + _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" # Step 1: Connect with host authentication only echo "Test host authentication" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle @@ -73,8 +68,8 @@ test() { # and invalid ctrl authentication echo "Test invalid ctrl authentication (should fail)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${hostkey}" @@ -86,8 +81,8 @@ test() { # and valid ctrl authentication echo "Test valid ctrl authentication" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${ctrlkey}" @@ -100,8 +95,8 @@ test() { echo "Test invalid ctrl key (should fail)" invkey="DHHC-1:00:Jc/My1o0qtLCWRp+sHhAVafdfaS7YQOMYhk9zSmlatobqB8C:" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${invkey}" @@ -114,7 +109,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}" diff --git a/tests/nvme/045 b/tests/nvme/045 index b8d886aaf9e8..a936e7fb661f 100755 --- a/tests/nvme/045 +++ b/tests/nvme/045 @@ -27,8 +27,6 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hostkey local new_hostkey @@ -37,9 +35,6 @@ test() { local ctrldev local rand_io_size - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "failed to generate host key" @@ -57,13 +52,13 @@ test() { _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" "${ctrlkey}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" "${ctrlkey}" - _set_nvmet_dhgroup "${hostnqn}" "ffdhe2048" + _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${ctrlkey}" @@ -82,7 +77,7 @@ test() { new_hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" - _set_nvmet_hostkey "${hostnqn}" "${new_hostkey}" + _set_nvmet_hostkey "${def_hostnqn}" "${new_hostkey}" echo "Re-authenticate with new host key" @@ -92,7 +87,7 @@ test() { new_ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" - _set_nvmet_ctrlkey "${hostnqn}" "${new_ctrlkey}" + _set_nvmet_ctrlkey "${def_hostnqn}" "${new_ctrlkey}" echo "Re-authenticate with new ctrl key" @@ -101,7 +96,7 @@ test() { echo "Change DH group to ffdhe8192" - _set_nvmet_dhgroup "${hostnqn}" "ffdhe8192" + _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe8192" echo "Re-authenticate with changed DH group" @@ -109,7 +104,7 @@ test() { echo "Change hash to hmac(sha512)" - _set_nvmet_hash "${hostnqn}" "hmac(sha512)" + _set_nvmet_hash "${def_hostnqn}" "hmac(sha512)" echo "Re-authenticate with changed hash" @@ -127,7 +122,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}" diff --git a/tests/nvme/048 b/tests/nvme/048 index 20d234e72621..f9a19b1e655e 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -88,25 +88,21 @@ test() { local cfs_path="${NVMET_CFS}/subsystems/${def_subsysnqn}" local file_path="${TMPDIR}/img" local skipped=false - local hostnqn - local hostid local port - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" if [[ -f "${cfs_path}/attr_qid_max" ]] ; then _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --keep-alive-tmo 1 \ --reconnect-delay 2 @@ -126,7 +122,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}" From patchwork Fri Aug 11 09:36:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350328 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8333EC001DB for ; Fri, 11 Aug 2023 09:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235237AbjHKJgz (ORCPT ); Fri, 11 Aug 2023 05:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235226AbjHKJgl (ORCPT ); Fri, 11 Aug 2023 05:36:41 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33E8B30D6; Fri, 11 Aug 2023 02:36:34 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id DE09421870; Fri, 11 Aug 2023 09:36:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746592; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mG6IRZ9q40lCvRAwlcOpEAtXBD4DfqCDrz6tzkiMxmU=; b=CGhHuE4YaF4bmtRkYoBrXX+70/+I6zm0J7t1YOLsDqFbvJRQwXNsn+fq3ELwDix1xNHgLU B2WJMOwVD5h10TpDipyHXSPXYpsK+jS8YWhVxLd7Ht5YhUvIWZxwfTXTDvhHxmFn4Z1gxd uM8s/lMTAT+alv/fi8Em/q+kveRN4dM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746592; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mG6IRZ9q40lCvRAwlcOpEAtXBD4DfqCDrz6tzkiMxmU=; b=7KCrtASSd2Js+drBRfgJqsl79hLSuiRGBZQ+PdSSsgu9plM2GX/Sy3JobLZUcMLlNM/u9e UXgUvXp0AXLqQVCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id CB759138E2; Fri, 11 Aug 2023 09:36:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id XWSYMCAB1mTEHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:32 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 07/13] nvme/rc: Add common file_path name define Date: Fri, 11 Aug 2023 11:36:08 +0200 Message-ID: <20230811093614.28005-8-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add common file_path name as global definition so that we can reuse it. Signed-off-by: Daniel Wagner --- tests/nvme/rc | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index c11848b59c49..9c802ddc872d 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -17,6 +17,7 @@ def_local_wwpn="0x20001100aa000002" def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349" def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" def_subsysnqn="blktests-subsystem-1" +def_file_path="${TMPDIR}/img" nvme_trtype=${nvme_trtype:-"loop"} nvme_img_size=${nvme_img_size:-"1G"} nvme_num_iter=${nvme_num_iter:-"1000"} From patchwork Fri Aug 11 09:36:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 043AEC04A6A for ; Fri, 11 Aug 2023 09:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232178AbjHKJhO (ORCPT ); Fri, 11 Aug 2023 05:37:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235244AbjHKJgn (ORCPT ); Fri, 11 Aug 2023 05:36:43 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A74430DB; Fri, 11 Aug 2023 02:36:35 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 47E8C21873; Fri, 11 Aug 2023 09:36:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746594; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KKE2B+AUQdCdxtybXQXEsZ0s9QJcXsW1/BXKK44OcjU=; b=qSNGNq77DKM7JWtq3rfmyqvV/C0IP/agjhEbkZ+o9nTbF5NKRFrXqwbVQAcY01/vymDxKX TymlnC9YUDBFYZ6VW/LPw1/zvzPFKCPYmCMHkYPN76JbIuHIP9Ql3qdm68xYBZF8LRyXiY +rIW1zXyFht32b+Hm3Mio2HfIdSj5eI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746594; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KKE2B+AUQdCdxtybXQXEsZ0s9QJcXsW1/BXKK44OcjU=; b=53K+i6LQq5hUzqdEVPz5eoPgZ301Luz3gOcLNW8oI2ccmWVc7MTHGoLf2OpqpWVU17I0DX XhUnBdABvCLLQgBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 174AF138E2; Fri, 11 Aug 2023 09:36:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id wojTAiIB1mTIHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:34 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 08/13] nvme: Use def_file_path variable instead local variable Date: Fri, 11 Aug 2023 11:36:09 +0200 Message-ID: <20230811093614.28005-9-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org As all tests are using the same file path name anyway, use the def_file_path variable. Signed-off-by: Daniel Wagner --- tests/nvme/004 | 6 +++--- tests/nvme/005 | 6 +++--- tests/nvme/006 | 6 +++--- tests/nvme/007 | 9 +++------ tests/nvme/008 | 7 +++---- tests/nvme/009 | 7 +++---- tests/nvme/010 | 7 +++---- tests/nvme/011 | 8 +++----- tests/nvme/012 | 7 +++---- tests/nvme/013 | 7 +++---- tests/nvme/014 | 7 +++---- tests/nvme/015 | 7 +++---- tests/nvme/017 | 11 ++++------- tests/nvme/018 | 7 +++---- tests/nvme/019 | 7 +++---- tests/nvme/020 | 7 +++---- tests/nvme/021 | 7 +++---- tests/nvme/022 | 7 +++---- tests/nvme/023 | 7 +++---- tests/nvme/024 | 7 +++---- tests/nvme/025 | 7 +++---- tests/nvme/026 | 7 +++---- tests/nvme/027 | 7 +++---- tests/nvme/028 | 7 +++---- tests/nvme/029 | 7 +++---- tests/nvme/031 | 6 +++--- tests/nvme/040 | 7 +++---- tests/nvme/041 | 7 +++---- tests/nvme/042 | 7 +++---- tests/nvme/043 | 7 +++---- tests/nvme/044 | 7 +++---- tests/nvme/045 | 7 +++---- tests/nvme/047 | 7 +++---- tests/nvme/048 | 7 +++---- 34 files changed, 103 insertions(+), 138 deletions(-) diff --git a/tests/nvme/004 b/tests/nvme/004 index 0314ed3c949e..78b11c7b84c5 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -27,9 +27,9 @@ test() { port="$(_create_nvmet_port "${nvme_trtype}")" - truncate -s "${nvme_img_size}" "$TMPDIR/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "$TMPDIR/img")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -47,7 +47,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "$loop_dev" - rm "$TMPDIR/img" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/005 b/tests/nvme/005 index 935b8634cb96..211b8affc32a 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -27,9 +27,9 @@ test() { port="$(_create_nvmet_port "${nvme_trtype}")" - truncate -s "${nvme_img_size}" "$TMPDIR/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "$TMPDIR/img")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -49,7 +49,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" losetup -d "$loop_dev" - rm "$TMPDIR/img" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/006 b/tests/nvme/006 index 066acabb1175..f31633825a70 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -23,9 +23,9 @@ test() { local port local loop_dev - truncate -s "${nvme_img_size}" "$TMPDIR/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "$TMPDIR/img")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -38,7 +38,7 @@ test() { losetup -d "$loop_dev" - rm "$TMPDIR/img" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/007 b/tests/nvme/007 index c6ba36cc4b4f..b6a4bc437103 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -20,13 +20,10 @@ test() { _setup_nvmet local port - local file_path - file_path="${TMPDIR}/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - truncate -s "${nvme_img_size}" "${file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -35,7 +32,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/008 b/tests/nvme/008 index c3fbcbc59686..a38926ef0051 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -23,11 +23,10 @@ test() { local port local nvmedev local loop_dev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -50,7 +49,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/009 b/tests/nvme/009 index 88c27889fbe1..2c8ea7ead9b8 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -21,11 +21,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -44,7 +43,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/010 b/tests/nvme/010 index 38c062ec73f4..81f7d2024ee6 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -23,11 +23,10 @@ test() { local port local nvmedev local loop_dev - local file_path="${TMPDIR}/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -51,7 +50,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/011 b/tests/nvme/011 index 0dab74e7e5b5..e6f78867e283 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -22,12 +22,10 @@ test() { local port local nvmedev - local file_path - local file_path="${TMPDIR}/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -47,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/012 b/tests/nvme/012 index 8ed57d3a5ab0..85549c25a1c6 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -27,11 +27,10 @@ test() { local port local nvmedev local loop_dev - local file_path="${TMPDIR}/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -54,7 +53,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/013 b/tests/nvme/013 index e3eb4e914750..355bc2e03557 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -25,11 +25,10 @@ test() { local port local nvmedev - local file_path="${TMPDIR}/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -48,7 +47,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/014 b/tests/nvme/014 index cbafd802af16..44ae91e2210f 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -26,11 +26,10 @@ test() { local size local bs local count - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -60,7 +59,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/015 b/tests/nvme/015 index b32d16a91de8..16e41ee65d42 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -25,11 +25,10 @@ test() { local size local bs local count - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -55,7 +54,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/017 b/tests/nvme/017 index 6f7ef5882d3e..7cbf274c13b0 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -19,20 +19,17 @@ test() { _setup_nvmet local port - local file_path local iterations="${nvme_num_iter}" - file_path="${TMPDIR}/img" - - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" local genctr=1 - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" for ((i = 2; i <= iterations; i++)); do - _create_nvmet_ns "${def_subsysnqn}" "${i}" "${file_path}" + _create_nvmet_ns "${def_subsysnqn}" "${i}" "${def_file_path}" done port="$(_create_nvmet_port "${nvme_trtype}")" @@ -49,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/018 b/tests/nvme/018 index 155f094ea6b3..d1d2082e62ac 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -23,11 +23,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -52,7 +51,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/019 b/tests/nvme/019 index 4ac351cbb782..2628dea55ac8 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -23,13 +23,12 @@ test() { local port local nvmedev local loop_dev - local file_path="$TMPDIR/img" local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -52,7 +51,7 @@ test() { losetup -d "${loop_dev}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/020 b/tests/nvme/020 index 744d4b7d6805..4a4f3c12da30 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -21,13 +21,12 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -46,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/021 b/tests/nvme/021 index 1fd9bcbb3d23..11f82d64f378 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -47,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/022 b/tests/nvme/022 index 053991625250..586f6cdd3448 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -47,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/023 b/tests/nvme/023 index c10e5a0138a8..b13426cf5615 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -23,11 +23,10 @@ test() { local port local nvmedev local loop_dev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -52,7 +51,7 @@ test() { losetup -d "${loop_dev}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/024 b/tests/nvme/024 index d1d7f0bfb994..b7c7b3f64321 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -46,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/025 b/tests/nvme/025 index ea944830612b..04ceace5840b 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -47,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/026 b/tests/nvme/026 index f1193c20477c..a9dc7bc15db5 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -47,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/027 b/tests/nvme/027 index c097c51ea4f3..fda8c61405a5 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -46,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/028 b/tests/nvme/028 index 6e37be4893b1..8e42ea37a634 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -46,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/029 b/tests/nvme/029 index 4d0ca997404b..7988faf5dd03 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -56,11 +56,10 @@ test() { local port local nvmedev local loop_dev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -89,7 +88,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/031 b/tests/nvme/031 index 27b08e96dd0b..d5c2561b941b 100755 --- a/tests/nvme/031 +++ b/tests/nvme/031 @@ -33,9 +33,9 @@ test() { local loop_dev local port - truncate -s "${nvme_img_size}" "$TMPDIR/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "$TMPDIR/img")" + loop_dev="$(losetup -f --show "${def_file_path}")" port="$(_create_nvmet_port "${nvme_trtype}")" @@ -50,7 +50,7 @@ test() { _remove_nvmet_port "${port}" losetup -d "$loop_dev" - rm "$TMPDIR/img" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/040 b/tests/nvme/040 index 8d7f68f9a2d7..452ecd690edf 100755 --- a/tests/nvme/040 +++ b/tests/nvme/040 @@ -21,14 +21,13 @@ test() { _setup_nvmet - local file_path="${TMPDIR}/img" local port local loop_dev local nvmedev local fio_pid - truncate -s "${nvme_img_size}" "${file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + truncate -s "${nvme_img_size}" "${def_file_path}" + loop_dev="$(losetup -f --show "${def_file_path}")" port="$(_create_nvmet_port "${nvme_trtype}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" @@ -60,7 +59,7 @@ test() { losetup -d "${loop_dev}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/041 b/tests/nvme/041 index 4c553251f379..0a0700533b7b 100755 --- a/tests/nvme/041 +++ b/tests/nvme/041 @@ -25,7 +25,6 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hostkey local ctrldev @@ -35,9 +34,9 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" @@ -69,7 +68,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/042 b/tests/nvme/042 index 866249ed598c..9180fce17b4e 100755 --- a/tests/nvme/042 +++ b/tests/nvme/042 @@ -25,15 +25,14 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hmac local key_len local hostkey local ctrldev - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" @@ -82,7 +81,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/043 b/tests/nvme/043 index 5569a7a58ad5..f08422949efb 100755 --- a/tests/nvme/043 +++ b/tests/nvme/043 @@ -26,7 +26,6 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hash local dhgroup local hostkey @@ -38,9 +37,9 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" @@ -84,7 +83,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/044 b/tests/nvme/044 index 6c2cb602313c..5eb163db2c99 100755 --- a/tests/nvme/044 +++ b/tests/nvme/044 @@ -26,7 +26,6 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hostkey local ctrlkey local ctrldev @@ -43,9 +42,9 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ @@ -111,7 +110,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/045 b/tests/nvme/045 index a936e7fb661f..8364d5ec3a2b 100755 --- a/tests/nvme/045 +++ b/tests/nvme/045 @@ -27,7 +27,6 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hostkey local new_hostkey local ctrlkey @@ -47,9 +46,9 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" "${ctrlkey}" @@ -124,7 +123,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/047 b/tests/nvme/047 index b435dd3cecba..66032f679ae2 100755 --- a/tests/nvme/047 +++ b/tests/nvme/047 @@ -26,11 +26,10 @@ test() { local nvmedev local loop_dev local rand_io_size - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" @@ -61,7 +60,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" } diff --git a/tests/nvme/048 b/tests/nvme/048 index f9a19b1e655e..6a05feae9b82 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -86,13 +86,12 @@ test() { _setup_nvmet local cfs_path="${NVMET_CFS}/subsystems/${def_subsysnqn}" - local file_path="${TMPDIR}/img" local skipped=false local port - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" @@ -124,7 +123,7 @@ test() { _remove_nvmet_port "${port}" _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" if [[ "${skipped}" = true ]] ; then return 1 From patchwork Fri Aug 11 09:36:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CDADC001DB for ; Fri, 11 Aug 2023 09:37:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235114AbjHKJhP (ORCPT ); Fri, 11 Aug 2023 05:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235256AbjHKJgp (ORCPT ); Fri, 11 Aug 2023 05:36:45 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5510B30E5; Fri, 11 Aug 2023 02:36:36 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 0D2BE1F889; Fri, 11 Aug 2023 09:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f+dGeQazKVtEZfgImF+w31ZCjMos3YCov32HlfqtR9k=; b=pLSZmI+6Q5VYmgAM+m4trz5YU9sEurvjg7UlgiPQKy/inpGt/7RJgzyjtIaKCU8LgyzvPc hcxs5fYiXkzASKQVmRKINWr9GWcMKw3Xok+pWIliFDRzvRBp8JDenLvAlL4wOqr+EaePo8 7wVZa8P2L4HyNqIsaGcXbQ1eqQJuLk8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=f+dGeQazKVtEZfgImF+w31ZCjMos3YCov32HlfqtR9k=; b=dMXf7C4jslXeDmEJoCX6B8dhTetoKGVmJ9V1oGHcEYBNWWahTeaEMwljBALE1v89qfOfm2 V0dNGueDIy25sxDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EF6C4138E2; Fri, 11 Aug 2023 09:36:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id PEl0OSIB1mTLHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:34 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 09/13] nvme/rc: Add common def_subsys_uuid define Date: Fri, 11 Aug 2023 11:36:10 +0200 Message-ID: <20230811093614.28005-10-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add common subsys uuid as global definition so that we can reuse it. Signed-off-by: Daniel Wagner --- tests/nvme/rc | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index 9c802ddc872d..7f5829a2e58d 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -17,6 +17,7 @@ def_local_wwpn="0x20001100aa000002" def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349" def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" def_subsysnqn="blktests-subsystem-1" +def_subsys_uuid="91fdba0d-f87b-4c25-b80f-db7be1418b9e" def_file_path="${TMPDIR}/img" nvme_trtype=${nvme_trtype:-"loop"} nvme_img_size=${nvme_img_size:-"1G"} From patchwork Fri Aug 11 09:36:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350333 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3476CC04E69 for ; Fri, 11 Aug 2023 09:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233362AbjHKJhQ (ORCPT ); Fri, 11 Aug 2023 05:37:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235280AbjHKJgp (ORCPT ); Fri, 11 Aug 2023 05:36:45 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC7633599; Fri, 11 Aug 2023 02:36:37 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id C2B5E21886; Fri, 11 Aug 2023 09:36:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/qhpDrnyJ7ZYfbrDMR7+SmW/nd2jhoSM4735T51Dzt4=; b=pcB43r5Z/CBlWZVJ0T9kGSF0OnAGzh6SntRQxREobsma6jNwsF+jGmAWsHey9n2IsMGww8 7Wh0oxlHeHDSFZdmO9orM9k59U+UASus/sorN8v+/+NSPdRv6vEZn4g4wH5LeN36G0+sVQ ypPEAEZ/oMDY8oHzHmFhCTbyMp8Vfo4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/qhpDrnyJ7ZYfbrDMR7+SmW/nd2jhoSM4735T51Dzt4=; b=uLoPn+bTdPeHemz7XtZ9ewKQmr5Fk2fp2xEBIYFXh9cMmO191ZkR21ZI3yXWiLeAEk+/jo o1HR08ciq3ABnnAg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A53C1138E2; Fri, 11 Aug 2023 09:36:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id tOd3JyMB1mTNHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:35 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 10/13] nvme: Use def_subsys_uuid variable Date: Fri, 11 Aug 2023 11:36:11 +0200 Message-ID: <20230811093614.28005-11-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org As all tests are using the same subsys uuid name anyway, use the def_subsys_uuid variable. Signed-off-by: Daniel Wagner --- tests/nvme/004 | 2 +- tests/nvme/005 | 2 +- tests/nvme/006 | 2 +- tests/nvme/007 | 2 +- tests/nvme/008 | 2 +- tests/nvme/009 | 2 +- tests/nvme/010 | 2 +- tests/nvme/011 | 2 +- tests/nvme/012 | 2 +- tests/nvme/013 | 2 +- tests/nvme/014 | 2 +- tests/nvme/015 | 2 +- tests/nvme/017 | 2 +- tests/nvme/018 | 2 +- tests/nvme/019 | 2 +- tests/nvme/020 | 2 +- tests/nvme/021 | 2 +- tests/nvme/022 | 2 +- tests/nvme/023 | 2 +- tests/nvme/024 | 2 +- tests/nvme/025 | 2 +- tests/nvme/026 | 2 +- tests/nvme/027 | 2 +- tests/nvme/028 | 2 +- tests/nvme/029 | 2 +- tests/nvme/041 | 2 +- tests/nvme/047 | 2 +- tests/nvme/048 | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/tests/nvme/004 b/tests/nvme/004 index 78b11c7b84c5..54d74b61f689 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -32,7 +32,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" diff --git a/tests/nvme/005 b/tests/nvme/005 index 211b8affc32a..8e3ddfe75e2f 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -32,7 +32,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" diff --git a/tests/nvme/006 b/tests/nvme/006 index f31633825a70..910204aaeb90 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -28,7 +28,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/007 b/tests/nvme/007 index b6a4bc437103..db00bdcc2d08 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -24,7 +24,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/008 b/tests/nvme/008 index a38926ef0051..752ab30a756b 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -29,7 +29,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/009 b/tests/nvme/009 index 2c8ea7ead9b8..7debd837cc76 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -25,7 +25,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/010 b/tests/nvme/010 index 81f7d2024ee6..cba711b29af8 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -29,7 +29,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/011 b/tests/nvme/011 index e6f78867e283..ba2718d81bd9 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/012 b/tests/nvme/012 index 85549c25a1c6..629b5194435e 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -33,7 +33,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/013 b/tests/nvme/013 index 355bc2e03557..ca51544b82d1 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -29,7 +29,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/014 b/tests/nvme/014 index 44ae91e2210f..6d27300cfb30 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -32,7 +32,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/015 b/tests/nvme/015 index 16e41ee65d42..1b3aa4aa36c2 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -29,7 +29,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/017 b/tests/nvme/017 index 7cbf274c13b0..aa0a3fefae90 100755 --- a/tests/nvme/017 +++ b/tests/nvme/017 @@ -26,7 +26,7 @@ test() { local genctr=1 _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" for ((i = 2; i <= iterations; i++)); do _create_nvmet_ns "${def_subsysnqn}" "${i}" "${def_file_path}" diff --git a/tests/nvme/018 b/tests/nvme/018 index d1d2082e62ac..b66056d43041 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -27,7 +27,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/019 b/tests/nvme/019 index 2628dea55ac8..b456b38d038e 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -31,7 +31,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/020 b/tests/nvme/020 index 4a4f3c12da30..ba88921d75af 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -27,7 +27,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/021 b/tests/nvme/021 index 11f82d64f378..02ef9727ee59 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/022 b/tests/nvme/022 index 586f6cdd3448..74c12c3e0ba9 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/023 b/tests/nvme/023 index b13426cf5615..413b6afa6d14 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -29,7 +29,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/024 b/tests/nvme/024 index b7c7b3f64321..1baf5487ae64 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/025 b/tests/nvme/025 index 04ceace5840b..9eecd4d4a604 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/026 b/tests/nvme/026 index a9dc7bc15db5..8a8bc58170e2 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/027 b/tests/nvme/027 index fda8c61405a5..723e721202be 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/028 b/tests/nvme/028 index 8e42ea37a634..d4e62e8cae1c 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/029 b/tests/nvme/029 index 7988faf5dd03..b113e387f1fa 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -62,7 +62,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/041 b/tests/nvme/041 index 0a0700533b7b..cb2766619b0e 100755 --- a/tests/nvme/041 +++ b/tests/nvme/041 @@ -37,7 +37,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "b92842df-a394-44b1-84a4-92ae7d112861" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" diff --git a/tests/nvme/047 b/tests/nvme/047 index 66032f679ae2..2b81f7ea9ffd 100755 --- a/tests/nvme/047 +++ b/tests/nvme/047 @@ -32,7 +32,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" diff --git a/tests/nvme/048 b/tests/nvme/048 index 6a05feae9b82..19234a5b3791 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -92,7 +92,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "b92842df-a394-44b1-84a4-92ae7d112861" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" From patchwork Fri Aug 11 09:36:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350330 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77B52C04A94 for ; Fri, 11 Aug 2023 09:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235098AbjHKJhP (ORCPT ); Fri, 11 Aug 2023 05:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235163AbjHKJgp (ORCPT ); Fri, 11 Aug 2023 05:36:45 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC968359D; Fri, 11 Aug 2023 02:36:37 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 90DE121881; Fri, 11 Aug 2023 09:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ONB0rT+VRdNbFZzplDFSYd3J2+VwEauFZ4m3EdIIa7w=; b=vXPAhoaecUfc3nRG2DWFLi6cthWO/0rZvkaAWjUqkyhtY6vhKDxO5hpoh0JGHkzkBA/Vdu rBoQmwc8waBX440zY76tVffz29ARY+U9+IrSM+AMI5kJ1zf26t70NWrwDcXeIklh8KX9UA +It47EeQrmAIwD+oswf8Y+wwCQ0pnI0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ONB0rT+VRdNbFZzplDFSYd3J2+VwEauFZ4m3EdIIa7w=; b=FX7SI2W90x7QzkTw3STpDrjYVPdrJpArtwtc/Jb7dQ8DqvvxRIchakm1+ZU00Tj6P0Dsxn +rUkEpfu/WYRFKBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7DE83138E2; Fri, 11 Aug 2023 09:36:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8ErKHSQB1mTPHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:36 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 11/13] nvme/rc: Add helper for adding/removing to allow list Date: Fri, 11 Aug 2023 11:36:12 +0200 Message-ID: <20230811093614.28005-12-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Add two helpers to add or remove the host from the allow list of the subsystem. Signed-off-by: Daniel Wagner --- tests/nvme/rc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/nvme/rc b/tests/nvme/rc index 7f5829a2e58d..61cc2e6d2c2c 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -612,17 +612,32 @@ _create_nvmet_subsystem() { _create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}" } +_add_nvmet_allow_hosts() { + local nvmet_subsystem="$1" + local nvmet_hostnqn="$2" + local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}" + + ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" +} + +_remove_nvmet_allow_hosts() { + local nvmet_subsystem="$1" + local nvmet_hostnqn="$2" + local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + + rm "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" +} + _create_nvmet_host() { local nvmet_subsystem="$1" local nvmet_hostnqn="$2" local nvmet_hostkey="$3" local nvmet_ctrlkey="$4" - local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}" mkdir "${host_path}" - echo 0 > "${cfs_path}/attr_allow_any_host" - ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" + _add_nvmet_allow_hosts "${nvmet_subsystem}" "${nvmet_hostnqn}" if [[ "${nvmet_hostkey}" ]] ; then echo "${nvmet_hostkey}" > "${host_path}/dhchap_key" fi From patchwork Fri Aug 11 09:36:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350334 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43F65C04A94 for ; Fri, 11 Aug 2023 09:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231211AbjHKJhR (ORCPT ); Fri, 11 Aug 2023 05:37:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235291AbjHKJgq (ORCPT ); Fri, 11 Aug 2023 05:36:46 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D701035A1; Fri, 11 Aug 2023 02:36:38 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 98D891F74A; Fri, 11 Aug 2023 09:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746597; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F/3g66sTTwH7DSyrxQhTnav2sVGdYCVdhQzPdl0m5hk=; b=HVi4O4z60oftk9DuBhet3VHfpCSs/54H6wyO7L8j/hsIYEoGYqG7Po35O1dCWiYsgEsZ5e Eprypy+VaHlXqj0uTPpy6WNLc/s7Df2evO+m3E4g2rBv8susGJIH+J+X4vwklRmtmAJbTZ LTKxgwzq6gOevvv19MA/cXrljHLfLaI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746597; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=F/3g66sTTwH7DSyrxQhTnav2sVGdYCVdhQzPdl0m5hk=; b=isAlobYTg9X2szHgc/Kil0p/21FI7CREz8KIbEnzTEDlovxzVWfgWOHtgC7JWactVB8poh 09CJB1PQt3wIA4Cw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6BA23138E2; Fri, 11 Aug 2023 09:36:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id a7omGSUB1mTVHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:37 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 12/13] nvme: Add explicitly host to allow_host list Date: Fri, 11 Aug 2023 11:36:13 +0200 Message-ID: <20230811093614.28005-13-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Only allow to connect to our setup target with the correct hostnqn. Thus we have to explicitly add the test hostnqn to the test subsysnqn allow_host list. In nvme/030 the genctr is updated as side effect by writing the attr_allow_any_host variable. Though writting to attr_allow_any_host is not allowed after switching to the allow_host list. We can achieve the same effect by adding and removing the host to the allow_host list. Signed-off-by: Daniel Wagner --- tests/nvme/004 | 2 ++ tests/nvme/005 | 4 +++- tests/nvme/008 | 2 ++ tests/nvme/009 | 2 ++ tests/nvme/010 | 2 ++ tests/nvme/011 | 2 ++ tests/nvme/012 | 2 ++ tests/nvme/013 | 2 ++ tests/nvme/014 | 2 ++ tests/nvme/015 | 2 ++ tests/nvme/018 | 2 ++ tests/nvme/019 | 2 ++ tests/nvme/020 | 2 ++ tests/nvme/021 | 2 ++ tests/nvme/022 | 2 ++ tests/nvme/023 | 2 ++ tests/nvme/024 | 2 ++ tests/nvme/025 | 2 ++ tests/nvme/026 | 2 ++ tests/nvme/027 | 2 ++ tests/nvme/028 | 2 ++ tests/nvme/029 | 2 ++ tests/nvme/030 | 11 ++++++----- tests/nvme/040 | 3 +++ tests/nvme/047 | 2 ++ tests/nvme/rc | 7 +++++-- 26 files changed, 61 insertions(+), 8 deletions(-) diff --git a/tests/nvme/004 b/tests/nvme/004 index 54d74b61f689..697c758d3059 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -34,6 +34,7 @@ test() { _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "${def_subsys_uuid}" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -46,6 +47,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "$loop_dev" rm "${def_file_path}" diff --git a/tests/nvme/005 b/tests/nvme/005 index 8e3ddfe75e2f..6646b826ecfa 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -34,6 +34,7 @@ test() { _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "${def_subsys_uuid}" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -46,8 +47,9 @@ test() { _nvme_disconnect_ctrl "${nvmedev}" _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_port "${port}" - _remove_nvmet_subsystem "${def_subsysnqn}" + _remove_nvmet_host "${def_hostnqn}" + losetup -d "$loop_dev" rm "${def_file_path}" diff --git a/tests/nvme/008 b/tests/nvme/008 index 752ab30a756b..3921fc6992b2 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -32,6 +32,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -46,6 +47,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/009 b/tests/nvme/009 index 7debd837cc76..aac3c1e0f642 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -28,6 +28,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -42,6 +43,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm "${def_file_path}" diff --git a/tests/nvme/010 b/tests/nvme/010 index cba711b29af8..19bb7f3fc7a7 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -32,6 +32,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -47,6 +48,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/011 b/tests/nvme/011 index ba2718d81bd9..0e54c2588bc8 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -29,6 +29,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -44,6 +45,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm "${def_file_path}" diff --git a/tests/nvme/012 b/tests/nvme/012 index 629b5194435e..c6b82c821bf2 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -36,6 +36,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -50,6 +51,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/013 b/tests/nvme/013 index ca51544b82d1..441db7477d75 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -32,6 +32,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -46,6 +47,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm "${def_file_path}" diff --git a/tests/nvme/014 b/tests/nvme/014 index 6d27300cfb30..3656f9399687 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -35,6 +35,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -56,6 +57,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/015 b/tests/nvme/015 index 1b3aa4aa36c2..bc04e39c628c 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -32,6 +32,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -53,6 +54,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm "${def_file_path}" diff --git a/tests/nvme/018 b/tests/nvme/018 index b66056d43041..68729c3cb070 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -30,6 +30,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -50,6 +51,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm "${def_file_path}" diff --git a/tests/nvme/019 b/tests/nvme/019 index b456b38d038e..33a25d52e9fd 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -34,6 +34,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -48,6 +49,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/020 b/tests/nvme/020 index ba88921d75af..f436cdc8b262 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -30,6 +30,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -44,6 +45,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm -f "${def_file_path}" diff --git a/tests/nvme/021 b/tests/nvme/021 index 02ef9727ee59..5043fe4916be 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -29,6 +29,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -45,6 +46,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm -f "${def_file_path}" diff --git a/tests/nvme/022 b/tests/nvme/022 index 74c12c3e0ba9..8b6f610c4894 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -29,6 +29,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -45,6 +46,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm -f "${def_file_path}" diff --git a/tests/nvme/023 b/tests/nvme/023 index 413b6afa6d14..90af0338e81f 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -32,6 +32,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -48,6 +49,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/024 b/tests/nvme/024 index 1baf5487ae64..7a89ddd79fd9 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -29,6 +29,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -44,6 +45,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm -f "${def_file_path}" diff --git a/tests/nvme/025 b/tests/nvme/025 index 9eecd4d4a604..90f214eff6c8 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -29,6 +29,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -45,6 +46,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm -f "${def_file_path}" diff --git a/tests/nvme/026 b/tests/nvme/026 index 8a8bc58170e2..ec352acaa489 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -29,6 +29,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -45,6 +46,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm -f "${def_file_path}" diff --git a/tests/nvme/027 b/tests/nvme/027 index 723e721202be..339f7605a9f5 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -29,6 +29,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -44,6 +45,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm -f "${def_file_path}" diff --git a/tests/nvme/028 b/tests/nvme/028 index d4e62e8cae1c..7f387eb337f6 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -29,6 +29,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -44,6 +45,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" rm -f "${def_file_path}" diff --git a/tests/nvme/029 b/tests/nvme/029 index b113e387f1fa..461e6c6c4454 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -65,6 +65,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -85,6 +86,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/030 b/tests/nvme/030 index a0b999cace94..9251e1744f61 100755 --- a/tests/nvme/030 +++ b/tests/nvme/030 @@ -28,6 +28,7 @@ test() { _create_nvmet_subsystem "${subsys}1" "$(losetup -f)" _add_nvmet_subsys_to_port "${port}" "${subsys}1" + _create_nvmet_host "${subsys}1" "${def_hostnqn}" genctr=$(_discovery_genctr) @@ -36,13 +37,13 @@ test() { genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port") - echo 0 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host" + _add_nvmet_allow_hosts "${subsys}2" "${def_hostnqn}" - genctr=$(_check_genctr "${genctr}" "clearing attr_allow_any_host") + genctr=$(_check_genctr "${genctr}" "adding host to allow_hosts") - echo 1 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host" + _remove_nvmet_allow_hosts "${subsys}2" "${def_hostnqn}" - genctr=$(_check_genctr "${genctr}" "setting attr_allow_any_host") + genctr=$(_check_genctr "${genctr}" "removing host from allow_hosts") _remove_nvmet_subsystem_from_port "${port}" "${subsys}2" _remove_nvmet_subsystem "${subsys}2" @@ -51,8 +52,8 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${subsys}1" _remove_nvmet_subsystem "${subsys}1" - _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" echo "Test complete" } diff --git a/tests/nvme/040 b/tests/nvme/040 index 452ecd690edf..1a9be5c9342c 100755 --- a/tests/nvme/040 +++ b/tests/nvme/040 @@ -32,6 +32,8 @@ test() { port="$(_create_nvmet_port "${nvme_trtype}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" udevadm settle nvmedev=$(_find_nvme_dev "${def_subsysnqn}") @@ -56,6 +58,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/047 b/tests/nvme/047 index 2b81f7ea9ffd..1da24b5638a6 100755 --- a/tests/nvme/047 +++ b/tests/nvme/047 @@ -35,6 +35,7 @@ test() { "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --nr-write-queues 1 || echo FAIL @@ -57,6 +58,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" losetup -d "${loop_dev}" diff --git a/tests/nvme/rc b/tests/nvme/rc index 61cc2e6d2c2c..e6ec32285f7a 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -608,7 +608,7 @@ _create_nvmet_subsystem() { local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" mkdir -p "${cfs_path}" - echo 1 > "${cfs_path}/attr_allow_any_host" + echo 0 > "${cfs_path}/attr_allow_any_host" _create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}" } @@ -678,7 +678,7 @@ _create_nvmet_passthru() { local passthru_path="${subsys_path}/passthru" mkdir -p "${subsys_path}" - echo 1 > "${subsys_path}/attr_allow_any_host" + echo 0 > "${subsys_path}/attr_allow_any_host" _test_dev_nvme_ctrl > "${passthru_path}/device_path" echo 1 > "${passthru_path}/enable" @@ -693,6 +693,7 @@ _remove_nvmet_passhtru() { local passthru_path="${subsys_path}/passthru" echo 0 > "${passthru_path}/enable" + rm -f "${subsys_path}"/allowed_hosts/* rmdir "${subsys_path}" } @@ -784,6 +785,7 @@ _nvmet_passthru_target_setup() { _create_nvmet_passthru "${subsys_name}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _create_nvmet_host "${subsys_name}" "${def_hostnqn}" echo "$port" } @@ -810,6 +812,7 @@ _nvmet_passthru_target_cleanup() { _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" _remove_nvmet_port "${port}" _remove_nvmet_passhtru "${subsys_name}" + _remove_nvmet_host "${def_hostnqn}" } _discovery_genctr() { From patchwork Fri Aug 11 09:36:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13350335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61F0BC001DB for ; Fri, 11 Aug 2023 09:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235164AbjHKJhS (ORCPT ); Fri, 11 Aug 2023 05:37:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235184AbjHKJgw (ORCPT ); Fri, 11 Aug 2023 05:36:52 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2E7E35AB; Fri, 11 Aug 2023 02:36:39 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A89A71F88C; Fri, 11 Aug 2023 09:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1691746598; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=97qJ2t1dei5AsFqKxY4znnkZhfKaShP0eW+TbvQA8F8=; b=fqaLR6jYgKIFedJtDywbZ6IxzRAotFurtmTkzZfVnX+8EpeOEa0OcLQUPMp5a2qzddgABv OvOR3Ct53eOSoRpaifvAdXz0aiOmgoPE9htfmDfobJSbM+hGDRYFIBTWFm+1+61uFur/NE Xhyou/jRqp2zJDne/lIuXJrv8ssEQ94= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1691746598; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=97qJ2t1dei5AsFqKxY4znnkZhfKaShP0eW+TbvQA8F8=; b=VpeIW0FKyz4XimfctIlj1zBgoNxiMtcTI9kAvdKOOwLi+FmzaVSs5n+2MS4bGEy/wx4tSV JZ3mTQv6ZQ/9+SDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 57DCA138E2; Fri, 11 Aug 2023 09:36:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5nt/FCYB1mTXHwAAMHmgww (envelope-from ); Fri, 11 Aug 2023 09:36:38 +0000 From: Daniel Wagner To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Chaitanya Kulkarni , Shin'ichiro Kawasaki , Max Gurtovoy , Hannes Reinecke , Sagi Grimberg , James Smart , Bart Van Assche , Daniel Wagner Subject: [PATCH blktests v3 13/13] nvme: Introduce nvmet_target_{setup/cleanup} common code Date: Fri, 11 Aug 2023 11:36:14 +0200 Message-ID: <20230811093614.28005-14-dwagner@suse.de> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230811093614.28005-1-dwagner@suse.de> References: <20230811093614.28005-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Almost all fabric tests have the identically code for setting up and cleaning up the target side. Introduce two new helpers. Signed-off-by: Daniel Wagner --- tests/nvme/003 | 13 +++------- tests/nvme/004 | 20 +++------------ tests/nvme/005 | 19 ++------------- tests/nvme/006 | 18 ++------------ tests/nvme/007 | 13 ++-------- tests/nvme/008 | 20 ++------------- tests/nvme/009 | 15 ++---------- tests/nvme/010 | 20 ++------------- tests/nvme/011 | 15 ++---------- tests/nvme/012 | 20 ++------------- tests/nvme/013 | 15 ++---------- tests/nvme/014 | 20 ++------------- tests/nvme/015 | 15 ++---------- tests/nvme/018 | 15 ++---------- tests/nvme/019 | 20 ++------------- tests/nvme/020 | 15 ++---------- tests/nvme/021 | 15 ++---------- tests/nvme/022 | 15 ++---------- tests/nvme/023 | 20 ++------------- tests/nvme/024 | 15 ++---------- tests/nvme/025 | 15 ++---------- tests/nvme/026 | 15 ++---------- tests/nvme/027 | 16 +++--------- tests/nvme/028 | 16 +++--------- tests/nvme/029 | 20 ++------------- tests/nvme/040 | 18 ++------------ tests/nvme/041 | 17 ++----------- tests/nvme/042 | 16 ++---------- tests/nvme/043 | 16 ++---------- tests/nvme/044 | 18 +++----------- tests/nvme/045 | 17 +++---------- tests/nvme/047 | 20 ++------------- tests/nvme/048 | 16 ++---------- tests/nvme/rc | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 34 files changed, 138 insertions(+), 486 deletions(-) diff --git a/tests/nvme/003 b/tests/nvme/003 index 71b82ce758a3..54e5fe651c9a 100755 --- a/tests/nvme/003 +++ b/tests/nvme/003 @@ -22,15 +22,9 @@ test() { _setup_nvmet - local loop_dev local port - port="$(_create_nvmet_port "${nvme_trtype}")" - - loop_dev="$(losetup -f)" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" nqn.2014-08.org.nvmexpress.discovery @@ -46,9 +40,8 @@ test() { fi _nvme_disconnect_subsys nqn.2014-08.org.nvmexpress.discovery - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" + + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/004 b/tests/nvme/004 index 697c758d3059..68c7619c7fb5 100755 --- a/tests/nvme/004 +++ b/tests/nvme/004 @@ -23,18 +23,8 @@ test() { _setup_nvmet local port - local loop_dev - port="$(_create_nvmet_port "${nvme_trtype}")" - - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -44,12 +34,8 @@ test() { cat "/sys/block/${nvmedev}n1/wwid" _nvme_disconnect_subsys ${def_subsysnqn} - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - losetup -d "$loop_dev" - rm "${def_file_path}" + + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/005 b/tests/nvme/005 index 6646b826ecfa..7dadd8b58dee 100755 --- a/tests/nvme/005 +++ b/tests/nvme/005 @@ -22,19 +22,9 @@ test() { _setup_nvmet local port - local loop_dev local nvmedev - port="$(_create_nvmet_port "${nvme_trtype}")" - - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -45,13 +35,8 @@ test() { echo 1 > "/sys/class/nvme/${nvmedev}/reset_controller" _nvme_disconnect_ctrl "${nvmedev}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_host "${def_hostnqn}" - losetup -d "$loop_dev" - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/006 b/tests/nvme/006 index 910204aaeb90..8507e24b5ec5 100755 --- a/tests/nvme/006 +++ b/tests/nvme/006 @@ -21,24 +21,10 @@ test() { _setup_nvmet local port - local loop_dev - truncate -s "${nvme_img_size}" "${def_file_path}" + port="$(_nvmet_target_setup --blkdev=device)" - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - - losetup -d "$loop_dev" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/007 b/tests/nvme/007 index db00bdcc2d08..255f31e82bc4 100755 --- a/tests/nvme/007 +++ b/tests/nvme/007 @@ -21,18 +21,9 @@ test() { local port - truncate -s "${nvme_img_size}" "${def_file_path}" + port="$(_nvmet_target_setup --blkdev=file)" - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/008 b/tests/nvme/008 index 3921fc6992b2..48c51c9fb288 100755 --- a/tests/nvme/008 +++ b/tests/nvme/008 @@ -22,17 +22,8 @@ test() { local port local nvmedev - local loop_dev - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -44,14 +35,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/009 b/tests/nvme/009 index aac3c1e0f642..5b41c81ee876 100755 --- a/tests/nvme/009 +++ b/tests/nvme/009 @@ -22,13 +22,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -40,12 +34,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/010 b/tests/nvme/010 index 19bb7f3fc7a7..02bf94eb332f 100755 --- a/tests/nvme/010 +++ b/tests/nvme/010 @@ -22,17 +22,8 @@ test() { local port local nvmedev - local loop_dev - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -45,14 +36,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/011 b/tests/nvme/011 index 0e54c2588bc8..93748c406e83 100755 --- a/tests/nvme/011 +++ b/tests/nvme/011 @@ -23,13 +23,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -42,12 +36,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/012 b/tests/nvme/012 index c6b82c821bf2..0d39596608b5 100755 --- a/tests/nvme/012 +++ b/tests/nvme/012 @@ -26,17 +26,8 @@ test() { local port local nvmedev - local loop_dev - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -48,14 +39,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/013 b/tests/nvme/013 index 441db7477d75..b0480e32fbbf 100755 --- a/tests/nvme/013 +++ b/tests/nvme/013 @@ -26,13 +26,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -44,12 +38,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/014 b/tests/nvme/014 index 3656f9399687..77fe64aa39e6 100755 --- a/tests/nvme/014 +++ b/tests/nvme/014 @@ -22,20 +22,11 @@ test() { local port local nvmedev - local loop_dev local size local bs local count - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -54,14 +45,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/015 b/tests/nvme/015 index bc04e39c628c..df36d32e4891 100755 --- a/tests/nvme/015 +++ b/tests/nvme/015 @@ -26,13 +26,7 @@ test() { local bs local count - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -51,12 +45,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/018 b/tests/nvme/018 index 68729c3cb070..9ea9ebc8648a 100755 --- a/tests/nvme/018 +++ b/tests/nvme/018 @@ -24,13 +24,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -48,12 +42,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/019 b/tests/nvme/019 index 33a25d52e9fd..4cb248f66bc3 100755 --- a/tests/nvme/019 +++ b/tests/nvme/019 @@ -22,19 +22,10 @@ test() { local port local nvmedev - local loop_dev local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -46,14 +37,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/020 b/tests/nvme/020 index f436cdc8b262..304a2c3ffc50 100755 --- a/tests/nvme/020 +++ b/tests/nvme/020 @@ -24,13 +24,7 @@ test() { local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -42,12 +36,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/021 b/tests/nvme/021 index 5043fe4916be..c5c578d0a73b 100755 --- a/tests/nvme/021 +++ b/tests/nvme/021 @@ -23,13 +23,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -43,12 +37,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/022 b/tests/nvme/022 index 8b6f610c4894..2b270042ab43 100755 --- a/tests/nvme/022 +++ b/tests/nvme/022 @@ -23,13 +23,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -43,12 +37,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/023 b/tests/nvme/023 index 90af0338e81f..d527b7fff7da 100755 --- a/tests/nvme/023 +++ b/tests/nvme/023 @@ -22,17 +22,8 @@ test() { local port local nvmedev - local loop_dev - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -46,14 +37,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/024 b/tests/nvme/024 index 7a89ddd79fd9..7ba8406dba57 100755 --- a/tests/nvme/024 +++ b/tests/nvme/024 @@ -23,13 +23,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -42,12 +36,7 @@ test() { fi _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/025 b/tests/nvme/025 index 90f214eff6c8..7f9df92fe301 100755 --- a/tests/nvme/025 +++ b/tests/nvme/025 @@ -23,13 +23,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -43,12 +37,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/026 b/tests/nvme/026 index ec352acaa489..9ed929d89708 100755 --- a/tests/nvme/026 +++ b/tests/nvme/026 @@ -23,13 +23,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -43,12 +37,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/027 b/tests/nvme/027 index 339f7605a9f5..bf1a55ca982b 100755 --- a/tests/nvme/027 +++ b/tests/nvme/027 @@ -23,13 +23,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -40,14 +34,10 @@ test() { if ! nvme ns-rescan "/dev/${nvmedev}" >> "$FULL" 2>&1; then echo "ERROR: ns-rescan failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/028 b/tests/nvme/028 index 7f387eb337f6..783433c1ece3 100755 --- a/tests/nvme/028 +++ b/tests/nvme/028 @@ -23,13 +23,7 @@ test() { local port local nvmedev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -40,14 +34,10 @@ test() { if ! nvme list-subsys 2>> "$FULL" | grep -q "${nvme_trtype}"; then echo "ERROR: list-subsys" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/029 b/tests/nvme/029 index 461e6c6c4454..7dda6ddd96df 100755 --- a/tests/nvme/029 +++ b/tests/nvme/029 @@ -55,17 +55,8 @@ test() { local port local nvmedev - local loop_dev - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" @@ -83,14 +74,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/040 b/tests/nvme/040 index 1a9be5c9342c..09f9bddf92c0 100755 --- a/tests/nvme/040 +++ b/tests/nvme/040 @@ -22,17 +22,10 @@ test() { _setup_nvmet local port - local loop_dev local nvmedev local fio_pid - truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${def_file_path}")" - - port="$(_create_nvmet_port "${nvme_trtype}")" - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" udevadm settle @@ -55,14 +48,7 @@ test() { { kill "${fio_pid}"; wait; } &> /dev/null - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm -f "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/041 b/tests/nvme/041 index cb2766619b0e..e690c680c971 100755 --- a/tests/nvme/041 +++ b/tests/nvme/041 @@ -34,13 +34,7 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" + port="$(_nvmet_target_setup --blkdev=file --hostkey "${hostkey}")" # Test unauthenticated connection (should fail) echo "Test unauthenticated connection (should fail)" @@ -61,14 +55,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - - _remove_nvmet_port "${port}" - - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/042 b/tests/nvme/042 index 9180fce17b4e..961d362c9b86 100755 --- a/tests/nvme/042 +++ b/tests/nvme/042 @@ -30,12 +30,7 @@ test() { local hostkey local ctrldev - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" for hmac in 0 1 2 3; do echo "Testing hmac ${hmac}" @@ -74,14 +69,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" done - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - - _remove_nvmet_port "${port}" - - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/043 b/tests/nvme/043 index f08422949efb..47d07e3fa0c5 100755 --- a/tests/nvme/043 +++ b/tests/nvme/043 @@ -37,12 +37,7 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" + port="$(_nvmet_target_setup --blkdev=file --hostkey "${hostkey}")" for hash in "hmac(sha256)" "hmac(sha384)" "hmac(sha512)" ; do @@ -76,14 +71,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" done - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - - _remove_nvmet_port "${port}" - - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/044 b/tests/nvme/044 index 5eb163db2c99..0d2fc1dd83c5 100755 --- a/tests/nvme/044 +++ b/tests/nvme/044 @@ -42,13 +42,8 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ - "${hostkey}" "${ctrlkey}" + port="$(_nvmet_target_setup --blkdev=file --ctrlkey "${ctrlkey}" \ + --hostkey "${hostkey}")" _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" @@ -103,14 +98,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - - _remove_nvmet_port "${port}" - - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/045 b/tests/nvme/045 index 8364d5ec3a2b..d17b4c54c6c3 100755 --- a/tests/nvme/045 +++ b/tests/nvme/045 @@ -46,12 +46,8 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" "${ctrlkey}" + port="$(_nvmet_target_setup --blkdev=file --ctrlkey "${ctrlkey}" \ + --hostkey "${hostkey}")" _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" @@ -116,14 +112,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - - _remove_nvmet_port "${port}" - - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/047 b/tests/nvme/047 index 1da24b5638a6..c0b64bd90eb6 100755 --- a/tests/nvme/047 +++ b/tests/nvme/047 @@ -24,18 +24,9 @@ test() { local port local nvmedev - local loop_dev local rand_io_size - truncate -s "${nvme_img_size}" "${def_file_path}" - - loop_dev="$(losetup -f --show "${def_file_path}")" - - _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=device)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --nr-write-queues 1 || echo FAIL @@ -55,14 +46,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - losetup -d "${loop_dev}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" echo "Test complete" } diff --git a/tests/nvme/048 b/tests/nvme/048 index 19234a5b3791..428add165dce 100755 --- a/tests/nvme/048 +++ b/tests/nvme/048 @@ -89,14 +89,7 @@ test() { local skipped=false local port - truncate -s "${nvme_img_size}" "${def_file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "${def_subsys_uuid}" - port="$(_create_nvmet_port "${nvme_trtype}")" - - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" + port="$(_nvmet_target_setup --blkdev=file)" if [[ -f "${cfs_path}/attr_qid_max" ]] ; then _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ @@ -118,12 +111,7 @@ test() { skipped=true fi - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem "${def_subsysnqn}" - _remove_nvmet_port "${port}" - _remove_nvmet_host "${def_hostnqn}" - - rm "${def_file_path}" + _nvmet_target_cleanup "${port}" if [[ "${skipped}" = true ]] ; then return 1 diff --git a/tests/nvme/rc b/tests/nvme/rc index e6ec32285f7a..564d805cf37d 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -359,6 +359,12 @@ _cleanup_nvmet() { if [[ "${nvme_trtype}" == "rdma" ]]; then stop_soft_rdma fi + + blkdev="$(losetup -l | awk '$6 == "'"${def_file_path}"'" { print $1 }')" + for dev in ${blkdev}; do + losetup -d "${dev}" + done + rm -f "${def_file_path}" } _setup_nvmet() { @@ -779,6 +785,66 @@ _find_nvme_passthru_loop_dev() { echo "/dev/${dev}n${nsid}" } +_nvmet_target_setup() { + local blkdev_type="device" + local blkdev + local ctrlkey="" + local hostkey="" + local port + + while [[ $# -gt 0 ]]; do + case $1 in + --blkdev) + blkdev_type="$2" + shift 2 + ;; + --ctrlkey) + ctrlkey="$2" + shift 2 + ;; + --hostkey) + hostkey="$2" + shift 2 + ;; + *) + shift + ;; + esac + done + + truncate -s "${nvme_img_size}" "${def_file_path}" + if [[ "${blkdev_type}" == "device" ]]; then + blkdev="$(losetup -f --show "${def_file_path}")" + else + blkdev="${def_file_path}" + fi + + _create_nvmet_subsystem "${def_subsysnqn}" "${blkdev}" \ + "${def_subsys_uuid}" + port="$(_create_nvmet_port "${nvme_trtype}")" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ + "${hostkey}" "${ctrlkey}" + + echo "${port}" +} + +_nvmet_target_cleanup() { + local port=$1 + local blkdev + + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" + _remove_nvmet_port "${port}" + _remove_nvmet_host "${def_hostnqn}" + + blkdev="$(losetup -l | awk '$6 == "'"${def_file_path}"'" { print $1 }')" + if [[ -n "${blkdev}" ]] ; then + losetup -d "${blkdev}" + fi + rm "${def_file_path}" +} + _nvmet_passthru_target_setup() { local subsys_name=$1