Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
* [blktests PATCH 0/2] nvme: add a new test to check model attr
@ 2019-10-30 19:52 Chaitanya Kulkarni
  2019-10-30 19:52 ` [blktests PATCH 1/2] nvme: handle model attr in subsys create helper Chaitanya Kulkarni
  2019-10-30 19:52 ` [blktests PATCH 2/2] nvme: add new test to check model attribute Chaitanya Kulkarni
  0 siblings, 2 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-10-30 19:52 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

Hi,

This is a small patch series which adds a test to verify dynamically
configured subsystem model attribute.

Regards,
Chaitanya

Chaitanya Kulkarni (2):
  nvme: handle model attr in subsys create helper
  nvme: add new test to check model attribute

 tests/nvme/033     | 61 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/033.out |  3 +++
 tests/nvme/rc      |  4 +++
 3 files changed, 68 insertions(+)
 create mode 100755 tests/nvme/033
 create mode 100644 tests/nvme/033.out

-- 
2.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [blktests PATCH 1/2] nvme: handle model attr in subsys create helper
  2019-10-30 19:52 [blktests PATCH 0/2] nvme: add a new test to check model attr Chaitanya Kulkarni
@ 2019-10-30 19:52 ` Chaitanya Kulkarni
  2019-11-01  7:42   ` Chaitanya Kulkarni
  2019-10-30 19:52 ` [blktests PATCH 2/2] nvme: add new test to check model attribute Chaitanya Kulkarni
  1 sibling, 1 reply; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-10-30 19:52 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

This patch allows _create_nvmet_subsystem to handle and optionally
set model attribute for the subsys.
---
 tests/nvme/rc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index 40f0413..2d11e2e 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -121,10 +121,14 @@ _create_nvmet_subsystem() {
 	local nvmet_subsystem="$1"
 	local blkdev="$2"
 	local uuid=$3
+	local model=$4
 	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
 
 	mkdir -p "${cfs_path}"
 	echo 1 > "${cfs_path}/attr_allow_any_host"
+	if [ -f "${cfs_path}/attr_model" ] && [ ! -z ${model+x} ]; then
+		echo -n ${model} > "${cfs_path}/attr_model"
+	fi
 	_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
 }
 
-- 
2.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [blktests PATCH 2/2] nvme: add new test to check model attribute
  2019-10-30 19:52 [blktests PATCH 0/2] nvme: add a new test to check model attr Chaitanya Kulkarni
  2019-10-30 19:52 ` [blktests PATCH 1/2] nvme: handle model attr in subsys create helper Chaitanya Kulkarni
@ 2019-10-30 19:52 ` Chaitanya Kulkarni
  1 sibling, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-10-30 19:52 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Chaitanya Kulkarni

This test allows us to dynamically set the subsys model attribute
and verify in the nvme list command output.
---
 tests/nvme/033     | 61 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/nvme/033.out |  3 +++
 2 files changed, 64 insertions(+)
 create mode 100755 tests/nvme/033
 create mode 100644 tests/nvme/033.out

diff --git a/tests/nvme/033 b/tests/nvme/033
new file mode 100755
index 0000000..8ddadcf
--- /dev/null
+++ b/tests/nvme/033
@@ -0,0 +1,61 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates.
+#
+# Test NVMeOF model attribute for subsys.
+
+. tests/nvme/rc
+
+DESCRIPTION="test added subsys model attribute"
+QUICK=1
+
+requires() {
+	_have_program nvme && _have_modules loop nvme-loop nvmet && \
+		_have_configfs
+}
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	_setup_nvmet
+
+	local port
+	local nvmedev
+	local loop_dev
+	local file_path="$TMPDIR/img"
+	local subsys_name="blktests-subsystem-1"
+
+	truncate -s 1G "${file_path}"
+
+	loop_dev="$(losetup -f --show "${file_path}")"
+
+	_create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \
+		"91fdba0d-f87b-4c25-b80f-db7be1418b9e" "${subsys_name}"
+	port="$(_create_nvmet_port "loop")"
+	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+
+	nvme connect -t loop -n "${subsys_name}"
+
+	nvme list | grep -v grep | grep -q "${subsys_name}"
+	ret=$?
+	
+	nvmedev="$(_find_nvme_loop_dev)"
+
+	udevadm settle
+
+	nvme disconnect -n "${subsys_name}"
+
+	_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+	_remove_nvmet_subsystem "${subsys_name}"
+	_remove_nvmet_port "${port}"
+
+	losetup -d "${loop_dev}"
+
+	rm "${file_path}"
+
+	if [ ${ret} == 1 ]; then
+		echo "Test Fail"
+	else
+		echo "Test complete"
+	fi
+}
diff --git a/tests/nvme/033.out b/tests/nvme/033.out
new file mode 100644
index 0000000..eb508be
--- /dev/null
+++ b/tests/nvme/033.out
@@ -0,0 +1,3 @@
+Running nvme/033
+NQN:blktests-subsystem-1 disconnected 1 controller(s)
+Test complete
-- 
2.22.1


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [blktests PATCH 1/2] nvme: handle model attr in subsys create helper
  2019-10-30 19:52 ` [blktests PATCH 1/2] nvme: handle model attr in subsys create helper Chaitanya Kulkarni
@ 2019-11-01  7:42   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2019-11-01  7:42 UTC (permalink / raw)
  To: linux-block, linux-nvme; +Cc: Omar Sandoval

On 10/30/2019 12:53 PM, Chaitanya Kulkarni wrote:
> This patch allows _create_nvmet_subsystem to handle and optionally
> set model attribute for the subsys.

Will send out updated version along with kernel patch.


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 19:52 [blktests PATCH 0/2] nvme: add a new test to check model attr Chaitanya Kulkarni
2019-10-30 19:52 ` [blktests PATCH 1/2] nvme: handle model attr in subsys create helper Chaitanya Kulkarni
2019-11-01  7:42   ` Chaitanya Kulkarni
2019-10-30 19:52 ` [blktests PATCH 2/2] nvme: add new test to check model attribute Chaitanya Kulkarni

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git