[PATCH blktests 1/8] nvme/rc: Implement --blkdev none for _nvmet_target_setup()

Shin'ichiro Kawasaki shinichiro.kawasaki at wdc.com
Thu Nov 7 03:13:47 PST 2024


From: Hannes Reinecke <hare at suse.de>

Add an option '--blkdev none' for _nvmet_target_setup() to indicate
that no block devices (and no namespaces) should be created when
setting up the target.

Signed-off-by: Hannes Reinecke <hare at suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
---
 tests/nvme/rc | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index f03851c..05f9192 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -361,11 +361,13 @@ _nvmet_target_setup() {
 		esac
 	done
 
-	truncate -s "${NVME_IMG_SIZE}" "$(_nvme_def_file_path)"
-	if [[ "${blkdev_type}" == "device" ]]; then
-		blkdev="$(losetup -f --show "$(_nvme_def_file_path)")"
-	else
-		blkdev="$(_nvme_def_file_path)"
+	if [[ "${blkdev_type}" != "none" ]]; then
+		truncate -s "${NVME_IMG_SIZE}" "$(_nvme_def_file_path)"
+		if [[ "${blkdev_type}" == "device" ]]; then
+			blkdev="$(losetup -f --show "$(_nvme_def_file_path)")"
+		else
+			blkdev="$(_nvme_def_file_path)"
+		fi
 	fi
 
 	ARGS=(--subsysnqn "${subsysnqn}")
-- 
2.47.0




More information about the Linux-nvme mailing list