From patchwork Tue Mar 26 13:13:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Wagner X-Patchwork-Id: 13604114 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01F9B74BF5 for ; Tue, 26 Mar 2024 13:14:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711458854; cv=none; b=GnsyEs3XrBCEYx+r4ZEZ8rn1Z/kGUxx5HDEIjrZlHM7hhTFnXKWd4+9ArlcRLXsk6xi9PUKVP1/9HDjYqdbUnwGtXXWPA6tS7VpATrepn1DSaQZGK/O2Q87MHGzuIzlUUjAj4T3uftArEIuSDIIo5F6FYNFhQCgHSihgiZPo1QE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711458854; c=relaxed/simple; bh=GEjPRz6vL1/OvGYymjZ5R9fkHwzMYkM7obaX3AnPhpU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jH2zNYsZS5+2fo0SNtpCovjtvLS50OCE9goP6O8EbIfQM+XbrXlbZAaKQls7Pv/smW8z1grBD3ktrfB0cx6AHR03++KU0mu24AkUcRXF2dET9tUOx/NAr/7lmqmfXrBEI5VEdofdcjh8NP/E8/VA7UM7NoEif/NC8CliYfFawJ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=cjKVWR14; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=OmXpkHVk; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=cjKVWR14; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=OmXpkHVk; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="cjKVWR14"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="OmXpkHVk"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="cjKVWR14"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="OmXpkHVk" Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [10.150.64.98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 3E5AE373FB; Tue, 26 Mar 2024 13:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1711458851; 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=qvDOBADFmDw+aOPrwhzt2BHMoHBf/CgZuKxG1LnfDio=; b=cjKVWR14f/xBZ4isBNs6JQs+3Mze8DHjnVlBfD18etw99tSZofDkdkG/Vvt/ZnEGoe+ylT LZoRcEqIAMt9pRBlMlqtWM0bNVOz1SfMLMKDjX+G+iT1cBCewwRWL0V7C0vI3e0xoHn+ZY LmKTSH/shyJI6o/F8RK2tdWq3+JOl3E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1711458851; 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=qvDOBADFmDw+aOPrwhzt2BHMoHBf/CgZuKxG1LnfDio=; b=OmXpkHVkHnX52Kf3JEg9jUeP3GbDCQOeIlljtzEZwpTEZwxEW++JTn5331Uf/6/IeWaxXU vfGAZPS18kWpq1BQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1711458851; 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=qvDOBADFmDw+aOPrwhzt2BHMoHBf/CgZuKxG1LnfDio=; b=cjKVWR14f/xBZ4isBNs6JQs+3Mze8DHjnVlBfD18etw99tSZofDkdkG/Vvt/ZnEGoe+ylT LZoRcEqIAMt9pRBlMlqtWM0bNVOz1SfMLMKDjX+G+iT1cBCewwRWL0V7C0vI3e0xoHn+ZY LmKTSH/shyJI6o/F8RK2tdWq3+JOl3E= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1711458851; 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=qvDOBADFmDw+aOPrwhzt2BHMoHBf/CgZuKxG1LnfDio=; b=OmXpkHVkHnX52Kf3JEg9jUeP3GbDCQOeIlljtzEZwpTEZwxEW++JTn5331Uf/6/IeWaxXU vfGAZPS18kWpq1BQ== Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 2DC5713587; Tue, 26 Mar 2024 13:14:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id UW+5CSPKAmYQNwAAn2gu4w (envelope-from ); Tue, 26 Mar 2024 13:14:11 +0000 From: Daniel Wagner To: Shin'ichiro Kawasaki Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Chaitanya Kulkarni , Hannes Reinecke , Daniel Wagner Subject: [PATCH blktests v3 09/20] nvme/rc: add nqn/uuid args to target setup/cleanup helper Date: Tue, 26 Mar 2024 14:13:51 +0100 Message-ID: <20240326131402.5092-10-dwagner@suse.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240326131402.5092-1-dwagner@suse.de> References: <20240326131402.5092-1-dwagner@suse.de> Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Score: 0.70 X-Spamd-Result: default: False [0.70 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; BROKEN_CONTENT_TYPE(1.50)[]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-0.998]; MID_CONTAINS_FROM(1.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] X-Spam-Level: Authentication-Results: smtp-out1.suse.de; none X-Spam-Flag: NO Make these helper a bit more flexible, so that the caller can setup not just the default subsysnqn. Signed-off-by: Daniel Wagner --- tests/nvme/rc | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/tests/nvme/rc b/tests/nvme/rc index 535bd869bf58..7f436037eb94 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -817,6 +817,8 @@ _nvmet_target_setup() { local blkdev local ctrlkey="" local hostkey="" + local subsysnqn="${def_subsysnqn}" + local subsys_uuid="${def_subsys_uuid}" local port while [[ $# -gt 0 ]]; do @@ -833,6 +835,14 @@ _nvmet_target_setup() { hostkey="$2" shift 2 ;; + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; + --subsys-uuid) + subsys_uuid="$2" + shift 2 + ;; *) echo "WARNING: unknown argument: $1" shift @@ -847,11 +857,11 @@ _nvmet_target_setup() { blkdev="$(_nvme_def_file_path)" fi - _create_nvmet_subsystem "${def_subsysnqn}" "${blkdev}" \ - "${def_subsys_uuid}" + _create_nvmet_subsystem "${subsysnqn}" "${blkdev}" \ + "${subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ + _add_nvmet_subsys_to_port "${port}" "${subsysnqn}" + _create_nvmet_host "${subsysnqn}" "${def_hostnqn}" \ "${hostkey}" "${ctrlkey}" } @@ -859,14 +869,28 @@ _nvmet_target_cleanup() { local ports local port local blkdev + local subsysnqn="${def_subsysnqn}" + + while [[ $# -gt 0 ]]; do + case $1 in + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; + *) + echo "WARNING: unknown argument: $1" + shift + ;; + esac + done - _get_nvmet_ports "${def_subsysnqn}" ports + _get_nvmet_ports "${subsysnqn}" ports for port in "${ports[@]}"; do - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}" _remove_nvmet_port "${port}" done - _remove_nvmet_subsystem "${def_subsysnqn}" + _remove_nvmet_subsystem "${subsysnqn}" _remove_nvmet_host "${def_hostnqn}" _cleanup_blkdev