]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
nvme/{041,042,043,044,045,048}: Use default hostnqn and hostid
authorDaniel Wagner <dwagner@suse.de>
Mon, 3 Jul 2023 09:16:47 +0000 (11:16 +0200)
committerShin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Mon, 10 Jul 2023 02:08:39 +0000 (11:08 +0900)
The host might have enabled the udev/systemd auto connect feature.
This disturbs the blktests for the fc transport. nvme-cli is able
to distinguish between the different invocations via the --context
option.

Instead creating random generated IDs or reuse the hostnqn, it's safer
to always use the same hostnqn to reduce the risk that the matching
logic doesn't work. For this purpose, drop references to
/etc/nvme/hostid and /etc/nvme/hostnqn.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
[Shin'ichiro: resolved conflict and noted /etc/nvme/* in commit message]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
tests/nvme/041
tests/nvme/042
tests/nvme/043
tests/nvme/044
tests/nvme/045
tests/nvme/048
tests/nvme/rc

index 308655dd609040b66a436f8dffe3e62b1158442a..5b04b99b128ed14d9da933cecb85dc11508e4db6 100755 (executable)
@@ -30,12 +30,8 @@ test() {
 
        echo "Running ${TEST_NAME}"
 
-       hostid="$(uuidgen)"
-       if [ -z "$hostid" ] ; then
-               echo "uuidgen failed"
-               return 1
-       fi
-       hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
+       hostid="${def_hostid}"
+       hostnqn="${def_hostnqn}"
        hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)"
        if [ -z "$hostkey" ] ; then
                echo "nvme gen-dhchap-key failed"
index fed2efead013c6c863cb01651fb32cfc3791591a..8df5ed37aaccdac66122ecf36ed3a9651f4f6730 100755 (executable)
@@ -32,12 +32,8 @@ test() {
 
        echo "Running ${TEST_NAME}"
 
-       hostid="$(uuidgen)"
-       if [ -z "$hostid" ] ; then
-               echo "uuidgen failed"
-               return 1
-       fi
-       hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
+       hostid="${def_hostid}"
+       hostnqn="${def_hostnqn}"
 
        _setup_nvmet
 
index d498fd7ae885c5ffd10cc9db888c2c04c1e4046e..8f4b783a02ff229461b3120c12296b9d546653f3 100755 (executable)
@@ -33,12 +33,8 @@ test() {
 
        echo "Running ${TEST_NAME}"
 
-       hostid="$(uuidgen)"
-       if [ -z "$hostid" ] ; then
-               echo "uuidgen failed"
-               return 1
-       fi
-       hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
+       hostid="${def_hostid}"
+       hostnqn="${def_hostnqn}"
        hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)"
        if [ -z "$hostkey" ] ; then
                echo "nvme gen-dhchap-key failed"
index 9928bcc55397b081ca2f2b82130905faf13d33fe..fca0897af27bbcfcadf41ed8efdc3d5a8eb30e2e 100755 (executable)
@@ -32,12 +32,8 @@ test() {
 
        echo "Running ${TEST_NAME}"
 
-       hostid="$(uuidgen)"
-       if [ -z "$hostid" ] ; then
-               echo "uuidgen failed"
-               return 1
-       fi
-       hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
+       hostid="${def_hostid}"
+       hostnqn="${def_hostnqn}"
 
        hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)"
        if [ -z "$hostkey" ] ; then
index 26a55335a92cb0fc9a691940b465a86856af04e8..eca629a1869183cc9aab0bc177c0ebaeeedd9bc4 100755 (executable)
@@ -36,12 +36,8 @@ test() {
 
        echo "Running ${TEST_NAME}"
 
-       hostid="$(uuidgen)"
-       if [ -z "$hostid" ] ; then
-               echo "uuidgen failed"
-               return 1
-       fi
-       hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
+       hostid="${def_hostid}"
+       hostnqn="${def_hostnqn}"
 
        hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)"
        if [ -z "$hostkey" ] ; then
index bbfb9873b5e864e83ec0848e377f63bfcb7fa7e7..a6ebb8927865cc70ba6fa0ff61c51b4eb1f7e3c6 100755 (executable)
@@ -93,12 +93,8 @@ test() {
 
        _setup_nvmet
 
-       hostid="$(uuidgen)"
-       if [ -z "$hostid" ] ; then
-               echo "uuidgen failed"
-               return 1
-       fi
-       hostnqn="nqn.2014-08.org.nvmexpress:uuid:${hostid}"
+       hostid="${def_hostid}"
+       hostnqn="${def_hostnqn}"
 
        truncate -s "${nvme_img_size}" "${file_path}"
 
index 9b5442b2c07ba75a5ef811db4b9341586d36c21c..4f3a994d75ce9a8368be74947bd79cc7754dd4f0 100644 (file)
@@ -14,23 +14,8 @@ def_remote_wwnn="0x10001100aa000001"
 def_remote_wwpn="0x20001100aa000001"
 def_local_wwnn="0x10001100aa000002"
 def_local_wwpn="0x20001100aa000002"
-
-if [ -f "/etc/nvme/hostid" ]; then
-       def_hostid="$(cat /etc/nvme/hostid 2> /dev/null)"
-else
-       def_hostid="$(uuidgen)"
-fi
-if [ -z "$def_hostid" ] ; then
-       def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349"
-fi
-
-if [ -f "/etc/nvme/hostnqn" ]; then
-       def_hostnqn="$(cat /etc/nvme/hostnqn 2> /dev/null)"
-fi
-if [ -z "$def_hostnqn" ] ; then
-       def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}"
-fi
-
+def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349"
+def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}"
 nvme_trtype=${nvme_trtype:-"loop"}
 nvme_img_size=${nvme_img_size:-"1G"}
 nvme_num_iter=${nvme_num_iter:-"1000"}