From patchwork Wed Apr 5 15:46:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13202089 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 6E93EC76188 for ; Wed, 5 Apr 2023 15:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238935AbjDEPrN (ORCPT ); Wed, 5 Apr 2023 11:47:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238972AbjDEPrM (ORCPT ); Wed, 5 Apr 2023 11:47:12 -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 E7D695FC0 for ; Wed, 5 Apr 2023 08:46:43 -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 A47EA1FD64; Wed, 5 Apr 2023 15:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680709595; 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=KQWWvyVOMNwg10qqrGRlHZ3xI6T1/nnXbHNP0F4OczA=; b=he8paOLy12grTI42eoR4LxgQ4eciguZHWMo+4M+xpoV2HRqjd1rz80539nibOfw09JsjmS JhV7QLcYqU23WW9l751NrmfqhgJLguIi99Q5NCdYfxSYyxaUXuhbQf8bfl6dy/S7i6DGd0 tPzn0/Ktyq/CKyFNlWso5s/7wAe6SNY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680709595; 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=KQWWvyVOMNwg10qqrGRlHZ3xI6T1/nnXbHNP0F4OczA=; b=dypq+NkheZxu3UIuQaAWUJoE1BcJzHM0SFkJO3Y5nKLUIMoS2Txw5N0hjtMSNbZgXnHlHT /fUdeAluOJwn++Aw== 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 9510913A10; Wed, 5 Apr 2023 15:46:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 5E9jJNuXLWTaNgAAMHmgww (envelope-from ); Wed, 05 Apr 2023 15:46:35 +0000 From: Daniel Wagner To: linux-block@vger.kernel.org Cc: linux-nvme@lists.infradead.org, Shinichiro Kawasaki , Sagi Grimberg , Hannes Reinecke , James Smart , Daniel Wagner Subject: [PATCH blktests v5 1/4] nvme/rc: Add setter for attr_qid_max Date: Wed, 5 Apr 2023 17:46:27 +0200 Message-Id: <20230405154630.16298-2-dwagner@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405154630.16298-1-dwagner@suse.de> References: <20230405154630.16298-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Signed-off-by: Daniel Wagner --- tests/nvme/rc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index a3c9b42d91e6..ec7678dbe09e 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -617,6 +617,16 @@ _set_nvmet_dhgroup() { "${cfs_path}/dhchap_dhgroup" } +_set_nvmet_attr_qid_max() { + local nvmet_subsystem="$1" + local qid_max="$2" + local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + + if [[ -f "${cfs_path}/attr_qid_max" ]]; then + echo $qid_max > "${cfs_path}/attr_qid_max" + fi +} + _find_nvme_dev() { local subsys=$1 local subsysnqn From patchwork Wed Apr 5 15:46:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13202091 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 9F58BC76188 for ; Wed, 5 Apr 2023 15:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239059AbjDEPrn (ORCPT ); Wed, 5 Apr 2023 11:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238982AbjDEPrm (ORCPT ); Wed, 5 Apr 2023 11:47:42 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4C846E91 for ; Wed, 5 Apr 2023 08:47:18 -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 4DCE422893; Wed, 5 Apr 2023 15:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680709596; 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=EIeIMkrYSH4FNMiLKJvp4Em6z97tlF+da5PMaEbCD6I=; b=WO9e2CmB7uyv65n64fs8d0x8PNZBMeIVuOSWWQEfSMSE3XrQd+0JXlyMqulrWgRRIbGayG Ffhgla7GD7A1f4k5BNI/MRa9bu3nzE8fWn3zUKo0SEWFtD3jhiETpb5un59mrHe4roCU/t rlaDqlr9mFNMUlp7pMyJ+4eR74ZMaBI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680709596; 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=EIeIMkrYSH4FNMiLKJvp4Em6z97tlF+da5PMaEbCD6I=; b=DfSSw8RIzVphuRxt8gkv6wHPmecMZGu5vOKl2lXtd0aH69V5Zw8R5xg9JyDQ5M85AX3IRs mUBheuWAvEQ6/uAQ== 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 3F0E513A10; Wed, 5 Apr 2023 15:46:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ISpkD9yXLWTcNgAAMHmgww (envelope-from ); Wed, 05 Apr 2023 15:46:36 +0000 From: Daniel Wagner To: linux-block@vger.kernel.org Cc: linux-nvme@lists.infradead.org, Shinichiro Kawasaki , Sagi Grimberg , Hannes Reinecke , James Smart , Daniel Wagner Subject: [PATCH blktests v5 2/4] nvme/rc: Add nvmet attribute feature detection function Date: Wed, 5 Apr 2023 17:46:28 +0200 Message-Id: <20230405154630.16298-3-dwagner@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405154630.16298-1-dwagner@suse.de> References: <20230405154630.16298-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org In order to detect if the target supports a attribute, we have to setup a target and check if the attribute file appears. Signed-off-by: Daniel Wagner --- tests/nvme/rc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index ec7678dbe09e..e720a35113aa 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -627,6 +627,31 @@ _set_nvmet_attr_qid_max() { fi } +_detect_nvmet_subsys_attr() { + local attr="$1" + local file_path="${TMPDIR}/img" + local subsys_name="blktests-feature-detect" + local cfs_path="${NVMET_CFS}/subsystems/${subsys_name}" + local port + + truncate -s 1M "${file_path}" + + _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + "b92842df-a394-44b1-84a4-92ae7d112332" + port="$(_create_nvmet_port "${nvme_trtype}")" + + local val=1 + [[ -f "${cfs_path}/${attr}" ]] && val=0 + + _remove_nvmet_subsystem "${subsys_name}" + + _remove_nvmet_port "${port}" + + rm "${file_path}" + + return "${val}" +} + _find_nvme_dev() { local subsys=$1 local subsysnqn From patchwork Wed Apr 5 15:46:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13202092 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 2FB7AC7619A for ; Wed, 5 Apr 2023 15:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239058AbjDEPrq (ORCPT ); Wed, 5 Apr 2023 11:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239041AbjDEPrp (ORCPT ); Wed, 5 Apr 2023 11:47:45 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D11C6E95 for ; Wed, 5 Apr 2023 08:47:21 -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 F3B9C228A5; Wed, 5 Apr 2023 15:46:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680709597; 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=KriKWBgyaGStn0k/pyyPULz1XbvMdnHcfTtuEj30UFk=; b=hXI7/+RAmDrKYDmb/PL0Vk+RHGyndaRKR/Wy2HdNHbFej/Dd0Pwe/mX2lt6ARQNSRkg0E1 J5virmxIoe+5CwxT0MoTJolq/LsE1hXNF6dMMACEUrUTQh0ReRrXyqKkEiqu8lhU3vjNrH xGGOZ+QDQ5hy/zhXbqYN3d6g2m/hMc8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680709597; 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=KriKWBgyaGStn0k/pyyPULz1XbvMdnHcfTtuEj30UFk=; b=7S+5P+EQs7nrqjsSfLuXUYSr7Yx3q7awzcMlT3F/Gc7RZMutAcNS9ZvTIbi8AWuv7jwEXc 1RuoBt4JuaWN1HAQ== 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 E5D0213A10; Wed, 5 Apr 2023 15:46:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qaUvONyXLWTeNgAAMHmgww (envelope-from ); Wed, 05 Apr 2023 15:46:36 +0000 From: Daniel Wagner To: linux-block@vger.kernel.org Cc: linux-nvme@lists.infradead.org, Shinichiro Kawasaki , Sagi Grimberg , Hannes Reinecke , James Smart , Daniel Wagner Subject: [PATCH blktests v5 3/4] nvme/rc: Add helper to wait for nvme ctrl state Date: Wed, 5 Apr 2023 17:46:29 +0200 Message-Id: <20230405154630.16298-4-dwagner@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405154630.16298-1-dwagner@suse.de> References: <20230405154630.16298-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The function waits until it sees a given state (or timeouts). Unfortunately, we can't use /sys/class/nvme/nvme%d because this symlink will be removed if the controller is going through resetting state. Thus use the real nvme%d directly. Signed-off-by: Daniel Wagner Reviewed-by: Chaitanya Kulkarni --- tests/nvme/rc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index e720a35113aa..ae4a69fe8438 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -16,6 +16,7 @@ def_local_wwnn="0x10001100aa000002" def_local_wwpn="0x20001100aa000002" def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)" def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)" +def_state_timeout=20 nvme_trtype=${nvme_trtype:-"loop"} _nvme_requires() { @@ -198,6 +199,28 @@ _nvme_fcloop_del_tport() { echo "wwnn=${wwnn},wwpn=${wwpn}" > ${loopctl}/del_target_port 2> /dev/null } +_nvmf_wait_for_state() { + local subsys_name="$1" + local state="$2" + local timeout="${3:-$def_state_timeout}" + + local nvmedev=$(_find_nvme_dev "${subsys_name}") + local state_file="/sys/class/nvme-fabrics/ctl/${nvmedev}/state" + + local start_time=$(date +%s) + local end_time + + while ! grep -q "${state}" "${state_file}"; do + sleep 1 + end_time=$(date +%s) + if (( end_time - start_time > timeout )); then + echo "expected state \"${state}\" not " \ + "reached within ${timeout} seconds" + break + fi + done +} + _cleanup_fcloop() { local local_wwnn="${1:-$def_local_wwnn}" local local_wwpn="${2:-$def_local_wwpn}" From patchwork Wed Apr 5 15:46:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13202093 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 9B131C77B60 for ; Wed, 5 Apr 2023 15:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239048AbjDEPrs (ORCPT ); Wed, 5 Apr 2023 11:47:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239043AbjDEPrr (ORCPT ); Wed, 5 Apr 2023 11:47:47 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0A075FF7 for ; Wed, 5 Apr 2023 08:47:24 -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 9360D1FF78; Wed, 5 Apr 2023 15:46:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680709597; 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=c+d7byf7E4FRcokSibsW01g7yp7GQa9FjQJ/goiUPdo=; b=LSFqOcdUH056XR42CkVStfw4c+i3SlNDrCm/rAlXu1f8id1sypSp20H7GumDFzSGdr3CZo yyW+6BR129+MK0CBahbhpB3tyQ80ksEGpoYFO4T2BVM3rbedoB8gHyBWXot9tfpBJ0pSlQ ij1n3kLzZvtCnGENhDXkVQq15lZjun4= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680709597; 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=c+d7byf7E4FRcokSibsW01g7yp7GQa9FjQJ/goiUPdo=; b=QF4vJNU10apIu56OMr4YvvfOIUfq0gnR/zgMj3CqVxw4ZLq2ELJhGAi74kwP0CiIGT931X 5354H7ik3t3LDhBQ== 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 867DA13A10; Wed, 5 Apr 2023 15:46:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qmLTIN2XLWTgNgAAMHmgww (envelope-from ); Wed, 05 Apr 2023 15:46:37 +0000 From: Daniel Wagner To: linux-block@vger.kernel.org Cc: linux-nvme@lists.infradead.org, Shinichiro Kawasaki , Sagi Grimberg , Hannes Reinecke , James Smart , Daniel Wagner Subject: [PATCH blktests v5 4/4] nvme/048: test queue count changes on reconnect Date: Wed, 5 Apr 2023 17:46:30 +0200 Message-Id: <20230405154630.16298-5-dwagner@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230405154630.16298-1-dwagner@suse.de> References: <20230405154630.16298-1-dwagner@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The target is allowed to change the number of I/O queues. Test if the host is able to reconnect in this scenario. Signed-off-by: Daniel Wagner Reviewed-by: Chaitanya Kulkarni --- tests/nvme/048 | 81 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/048.out | 3 ++ 2 files changed, 84 insertions(+) create mode 100755 tests/nvme/048 create mode 100644 tests/nvme/048.out diff --git a/tests/nvme/048 b/tests/nvme/048 new file mode 100755 index 000000000000..bc4766e82159 --- /dev/null +++ b/tests/nvme/048 @@ -0,0 +1,81 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0+ +# Copyright (C) 2023 Daniel Wagner, SUSE Labs +# +# Test queue count changes on reconnect + +. tests/nvme/rc + +DESCRIPTION="Test queue count changes on reconnect" +QUICK=1 + +requires() { + _nvme_requires + _have_loop + _require_nvme_trtype tcp rdma fc + _require_min_cpus 2 +} + +set_max_qid() { + local port="$1" + local subsys_name="$2" + local max_qid="$3" + + _set_nvmet_attr_qid_max "${subsys_name}" "${max_qid}" + + # Setting qid_max forces a disconnect and the reconntect attempt starts + # 10s after connection lost, thus we will see the connecting state. + _nvmf_wait_for_state "${subsys_name}" "connecting" + _nvmf_wait_for_state "${subsys_name}" "live" +} + +test() { + local port + local subsys_name="blktests-subsystem-1" + local hostid + local hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}" + local file_path="${TMPDIR}/img" + + echo "Running ${TEST_NAME}" + + hostid="$(uuidgen)" + if [ -z "$hostid" ] ; then + echo "uuidgen failed" + return 1 + fi + + if ! _detect_nvmet_subsys_attr "attr_qid_max"; then + SKIP_REASONS+=("missing attr_qid_max feature") + return 1 + fi + + truncate -s 512M "${file_path}" + + _create_nvmet_subsystem "${subsys_name}" "${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}" + + _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + --hostnqn "${hostnqn}" \ + --hostid "${hostid}" + + _nvmf_wait_for_state "${subsys_name}" "live" + + set_max_qid "${port}" "${subsys_name}" 1 + set_max_qid "${port}" "${subsys_name}" 128 + + _nvme_disconnect_subsys "${subsys_name}" + + _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_subsystem "${subsys_name}" + + _remove_nvmet_port "${port}" + + _remove_nvmet_host "${hostnqn}" + + rm "${file_path}" + + echo "Test complete" +} diff --git a/tests/nvme/048.out b/tests/nvme/048.out new file mode 100644 index 000000000000..7f986ef9637d --- /dev/null +++ b/tests/nvme/048.out @@ -0,0 +1,3 @@ +Running nvme/048 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete