From patchwork Sat Feb 15 01:38:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11383669 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F231B92A for ; Sat, 15 Feb 2020 01:38:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D30EF207FF for ; Sat, 15 Feb 2020 01:38:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="kHiPXtJj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727658AbgBOBih (ORCPT ); Fri, 14 Feb 2020 20:38:37 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:15619 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbgBOBih (ORCPT ); Fri, 14 Feb 2020 20:38:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1581730718; x=1613266718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=E3wcwlsDYokBPz5VBPG3aTzLh2M8vjJRSpWvvi5K6ic=; b=kHiPXtJjAxN+M8bfi1+N7YVABTqOxEqy0/kulrmnkAXnNvtA/5wLtC9c OY8qtxo97OvWrxawQjzSZm2iZhIltmXpB7UkJLjKqxlTxtkFW3SU3RUsR a12eNzQgpy6vzIC1utUTIr2AkPVMkPI1q6tA/fBkLJSHnlK+KYb2AHMxr kbZhOiTVgjzKcUM9/LGLR5/X0jsmRTl1A6aQsZi2EYIrhZiaNmHecTEPq 1e9rQvVuz3l6fppnMAOOiqoapxKQhzXevBXGy/Wr9WrUpbVmH3DwyVfEX qUQM8ofUxMqYpHTo4cBbiyNaDdC0D4PiycWhgwwKI1URrgqzCD0KQnRI3 g==; IronPort-SDR: iqQtzDraecxtIKrl+nmmmiF81l0gSNb9gnfSCsECzw9laUVWY1eTSUOCvskiuwjBB87kBUFl8W BPK4CCxWc+G+eouJrOiK+ZAM1Hen+ylNcNeMnwaxy0cn1G0w1RojJAo6nt+o58G2Tw7NIHmwta 5dy9cSo6zqJjCXV9gYVp3cv2s9nzTenJmofdp/kplno5pFQoMMjRvPwn09regWjl6XfEDJbNYL YkgRHcf/8bBWsG2YQLC8W+A8Rr8cYsBySZaVDL+PQOX8yI8C4OGxBgDBb3pkGXw0a3RC+hqiDy l2E= X-IronPort-AV: E=Sophos;i="5.70,442,1574092800"; d="scan'208";a="130431806" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2020 09:38:38 +0800 IronPort-SDR: cQwpCVrcmp7XAQMaMJS3pT1Op4CImx5djBOY/Z8vHmUoguSLWGgQfmIVNaCJfN/P9i9cPMoN0Y V3NS+XgvxjyMiToLF2eTae7/g8mb5KEfKmTpk7kjlO2rZ3eSFezTzjvHkHMHnpmudgkq24bYel thx42N/f5jZOIvLtpFVzU/NL5wmRRJcBYQnNHu72DYa/qmAknAGeDa/RfJuReLIUMB9S6SLqPv WoWSJgEkr4zcM+CZYoULxfJ2XqKQiSyKcieazmeh5rxz6dU0PtDtgDZpBUn9PFqOWvQX8NeNpU V2b5jUjWHB8GdoA7LZZiPMQ1 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2020 17:31:21 -0800 IronPort-SDR: ioUc+pR+lGn0rilxm0izv8W1ipguQiGrJp66P2+lZCghs3D3rxw3yHJdW9FjvLKSvrJQfRTJH3 W/wj6cMOVsOB/AK8bzk/tXR6LUxxdJpFLV2g7C55Y9jX45SCpZs/PY0+5p49RgJjMhDPXnq1j4 guYAAmWKWb11ScUP7Rl2tLAlZ0rG3lFK0LOxNV7zjbu2nDZQ28Ve4Rnp+GOBICGvVh28azFxnY z/pMqP0W9WKVSZjYgryEPeBW6EQeswyJPT0+5rEr0yLdTvzN+p5mLIhtCdvmEifQDf6YYQGiWS l5E= WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 14 Feb 2020 17:38:36 -0800 From: Chaitanya Kulkarni To: osandov@fb.com Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Chaitanya Kulkarni Subject: [PATCH blktests V2 1/3] nvme: allow target to set cntlid min/max & model Date: Fri, 14 Feb 2020 17:38:29 -0800 Message-Id: <20200215013831.6715-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200215013831.6715-1-chaitanya.kulkarni@wdc.com> References: <20200215013831.6715-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org This patch updates helper function create_nvmet_subsystem() to handle newly introduced model, cntlid_min and cntlid_max attributes. Also, this adds SKIP reason when attributes are not found in the configfs. Signed-off-by: Chaitanya Kulkarni --- tests/nvme/rc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/nvme/rc b/tests/nvme/rc index 40f0413..e4b57cb 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -121,11 +121,36 @@ _create_nvmet_subsystem() { local nvmet_subsystem="$1" local blkdev="$2" local uuid=$3 + local cntlid_min=$4 + local cntlid_max=$5 + local model=$6 local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" mkdir -p "${cfs_path}" echo 1 > "${cfs_path}/attr_allow_any_host" + + if [ $# -eq 5 ]; then + if [ -f "${cfs_path}"/attr_cntlid_min ]; then + echo "${cntlid_min}" > "${cfs_path}"/attr_cntlid_min + echo "${cntlid_max}" > "${cfs_path}"/attr_cntlid_max + else + SKIP_REASON="attr_cntlid_[min|max] not found" + rmdir "${cfs_path}" + return 1 + fi + fi + if [ $# -eq 6 ]; then + if [ -f "${cfs_path}"/attr_model ]; then + echo "${model}" > "${cfs_path}"/attr_model + else + SKIP_REASON="attr_model not found" + rmdir "${cfs_path}" + return 1 + fi + fi _create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}" + + return 0 } _remove_nvmet_ns() { From patchwork Sat Feb 15 01:38:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11383671 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C96BA92A for ; Sat, 15 Feb 2020 01:38:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A8F782073A for ; Sat, 15 Feb 2020 01:38:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="QgSChhn9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727641AbgBOBij (ORCPT ); Fri, 14 Feb 2020 20:38:39 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:15619 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbgBOBij (ORCPT ); Fri, 14 Feb 2020 20:38:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1581730720; x=1613266720; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=PVVWGcIQHoA1Y15S9BkGYIyI5ZJjziivksjUZDcIiq4=; b=QgSChhn90Cm9cfTwFhMfwjqKDnm4bv23g5dps5/hil3ATc5ZJ6OM1bqA F/rG0RVGURm0JlL67MKnjc3ckNHcdjWIOViydozLpMAWxojqFdccwqEfp xpiAf+xf/k2zjCJVMeEJ+l0RZQb7ZOOH69/sTmN7XBtHOyTnLaAPkEUEf GgYtk2SN2EI+aSS7muB4n7+5y3J323Te8wwNa7Q6CJtHQ8dTLb+Dn8ivP xHsJJJ6mxeMajUxqASkdpT9WYuwoWohswp5vNO80N7vC3gkoirK4jMpLZ F8zNEnrrADZXYH5TLuYuwHw8oEOXWm6CDfuZ2b71C5Y7l/OIxT9a2dDfs A==; IronPort-SDR: 8cViXBQBJ/c4hcrXXtfQuEegPxLJ8FkKtFoM/5xhRKWSwPCS30L445TpnoLUGz7Ems3WrGym9r 0J3/niJHHRN5PY1EeujfE5iTchLFnOvv7ZrPh+58JYZ8ZlF9mpMd4/fag6vD13APrVwPURes2D riTpl5ABbVAfZW58VSIEDBbkuvgD62VMfoILQ04QdwuLnYdd2e0wJqxOsflRS9eim9WyYAXyh9 roX/hovC+9FwYvltr6vxExZkuO1aUIv6eBNjvJ9xjAtlrXEKWcOBQeyiM6sGqNCt3WqZoukTN6 /ZA= X-IronPort-AV: E=Sophos;i="5.70,442,1574092800"; d="scan'208";a="130431807" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2020 09:38:39 +0800 IronPort-SDR: ksbNvR1/IacZ1RLC+gOq15oXq9hD2Uequn+lVkPzm4+wP0WUk9GKOeY7hfhMkvPENeK798j2hp EaI5C78VqIerDw6OPca6F7K+4DbzC3kdSG7px+aOTyyd7JTVqv68ARsV1MkSbjLSt/+TeEqHpY UJC5kQ1044BbZ18nZG65ttd7MSqRlXdTtcJD1CGAxKDRNB58FU6Xr9NUS1Tr1NF2w9Mp6FsaNA KGdgvmllrXh52F499vATgLv4g+TDWGMG1JrNBY+YA/lSVmxbvwXgbc3k8uEnwQR/8j/08oO8pr b+4SFGU9Hl89JYq21dwTT3Cc Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2020 17:31:23 -0800 IronPort-SDR: S28rkRdp/fHt66j4ARdXmJ9N3zErjASd2Ogir+OINWiXB52XMzv4bBfrIJwrnB+fuDjOUBQxF9 qgoNys/vi4xbs8F9YOn25v5OYKJgd6rlFB2Y426YMyX9AusvEhsZQES47tTRwh6O7xqjafHDR0 zMtlyhKjvUSfCB9UEd0dciLyqeNNE5r1nZF0YbRdbPnalt33k5af6s+59hkP+xD+gTNI1DBlqz 68FXTl3QHtpFT513vra0NATLlitUtymLvCteneegwDAhstZmW1nWl3Hfwe5UcWYQ7olGQuIDkA HKg= WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 14 Feb 2020 17:38:37 -0800 From: Chaitanya Kulkarni To: osandov@fb.com Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Chaitanya Kulkarni Subject: [PATCH blktests V2 2/3] nvme: test target cntlid min cntlid max Date: Fri, 14 Feb 2020 17:38:30 -0800 Message-Id: <20200215013831.6715-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200215013831.6715-1-chaitanya.kulkarni@wdc.com> References: <20200215013831.6715-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The new testcases exercises newly added cntlid [min|max] attributes for NVMeOF target. Signed-off-by: Chaitanya Kulkarni --- tests/nvme/033 | 61 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/033.out | 4 +++ 2 files changed, 65 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..49f2fa1 --- /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 target cntlid[min|max] attributes. + +. tests/nvme/rc + +DESCRIPTION="Test NVMeOF target cntlid[min|max] attributes" +QUICK=1 + +PORT="" +NVMEDEV="" +LOOP_DEV="" +FILE_PATH="$TMPDIR/img" +SUBSYS_NAME="blktests-subsystem-1" + +_have_cid_min_max() +{ + local cid_min=14 + local cid_max=15 + + _setup_nvmet + truncate -s 1G "${FILE_PATH}" + LOOP_DEV="$(losetup -f --show "${FILE_PATH}")" + + # we can only know skip reason when we create a subsys + _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \ + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" ${cid_min} ${cid_max} +} + +requires() { + _have_program nvme && _have_modules loop nvme-loop nvmet && \ + _have_configfs && _have_cid_min_max +} + +test() { + echo "Running ${TEST_NAME}" + + PORT="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${PORT}" "${SUBSYS_NAME}" + + nvme connect -t loop -n "${SUBSYS_NAME}" + + udevadm settle + + NVMEDEV="$(_find_nvme_loop_dev)" + nvme id-ctrl /dev/"${NVMEDEV}"n1 | grep cntlid | tr -s ' ' ' ' + + 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}" + + echo "Test complete" +} diff --git a/tests/nvme/033.out b/tests/nvme/033.out new file mode 100644 index 0000000..b1b0d15 --- /dev/null +++ b/tests/nvme/033.out @@ -0,0 +1,4 @@ +Running nvme/033 +cntlid : e +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete From patchwork Sat Feb 15 01:38:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11383673 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1AE0C13A4 for ; Sat, 15 Feb 2020 01:38:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F0FBF2081E for ; Sat, 15 Feb 2020 01:38:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=wdc.com header.i=@wdc.com header.b="eqUkJCU9" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727680AbgBOBik (ORCPT ); Fri, 14 Feb 2020 20:38:40 -0500 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:15619 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727572AbgBOBik (ORCPT ); Fri, 14 Feb 2020 20:38:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1581730721; x=1613266721; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5L38YCFHyNaTJJrUPZRKoSjD9YGnj5K8/s1glqKjrms=; b=eqUkJCU9brTjSXgwINqHmjU5ongADY8kw6gdxpNK0Yzc8I0/mYeePPCA gNGP4eXbnjAGbgsdvVqcAuJ0KIHy2fW7KOYVzVZRjljSA+PaXVgQLTULF BcjS+5VXgj8fw8cnTyP22wXNslZVF26QCgbcr/8m9+zNqymPPnKzAxrwD Xr/wK2r5+O9XnvTUxo9flt8iMfDuiNmC8v747HimxO3nMFNf6qX8dobCD /I1L5U8ibS0vFhpQ9JRYj1lC9iPjWeb+K67LkBhGv3VT+Yvl59YD40tdF d0K4MokEfECErtUzjUjv+wEroNIyhGFlb7e/7kZ0egZ6bSQMCDKWmKDlZ w==; IronPort-SDR: q5ax0shiLVnwShsbQ5BfbRBwthuK++HMzP24qzGUPhDVYncSPnaTkkQEmc1xYF4SHzQvwIkkl7 mXRoJagQ70xmyFWblWKHn6iPQYvw6Sb5u/uonzbYqxw3Oi9AaVMfU7dZtSaIt6HpXx0UzAAQnx eRvmkh6FlHRYhqAjmxOLN/MbldjNLMfM50i0gmtHbglXpX8VLD0ZZbkCjSuSBdVWF6FkuQ82Id zf5V1lgkcHz+Cl7zfTRvTmKNJZGec26Dg9on8cwTJ0ZBMBqjtNxHlQ/pcaQ4ly4gI5/sa42pJW cVQ= X-IronPort-AV: E=Sophos;i="5.70,442,1574092800"; d="scan'208";a="130431808" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 15 Feb 2020 09:38:41 +0800 IronPort-SDR: sleUPPdhQHzf3/pZX2y6Pc2Ele57xP2kWlMomX2IG+gg0zsZieZ8Q5xvPreHWm9MdOzxxZU6vi /3E0D7GwIjoGwZrovjt+55vF7BV5vd/it27X1zy05qAfwGHgmWuua8TBHwY5E56zr5r8Nk5xdo X/ITFoF0rkyXURVB9ZV9qJwwLemt49h8j2UVDiY/pIbM+phkh5lEN8i/l8+0P2tZ31UDFe+vP3 gIyoGiF2fasdf/RB7Adwlxx3KMQ1zGUv0fMVjIt7lFiqpc+igOEEWvn0kLRc7RXV5QKIOLpJ8N dhDEfYmGS+VDxlxQsdNPbZ1t Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Feb 2020 17:31:24 -0800 IronPort-SDR: ddlkWu/OvFKpj3IaiZX2oNYEfsDFFydug6wgJKZkSuljNLr79ok5eouWq6JutStbefJSaycQjK mxEwZwOQPsiqg2tcLipcWX0kYMX9h7pJXvJNxU+r3JmXmQOgeIJ5vaEGeNz939b3QKYjht+SsL p59ldazokABtXMNfGXEOoqkC8MLkUu2QtOe4zfkxsBfcYNykU4c5P3iJZiyh+M3tV3bvDr0/Fm AiFM+5DC+5c+pSL+40KIBPRTo90A77y3ko67hg/fKhy+3lkK5qr0hRuCeFmYIvJpsd8bD6b/8I BMg= WDCIronportException: Internal Received: from iouring.labspan.wdc.com (HELO iouring.sc.wdc.com) ([10.6.138.107]) by uls-op-cesaip01.wdc.com with ESMTP; 14 Feb 2020 17:38:39 -0800 From: Chaitanya Kulkarni To: osandov@fb.com Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, Chaitanya Kulkarni Subject: [PATCH blktests V2 3/3] nvme: test target model attribute Date: Fri, 14 Feb 2020 17:38:31 -0800 Message-Id: <20200215013831.6715-4-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20200215013831.6715-1-chaitanya.kulkarni@wdc.com> References: <20200215013831.6715-1-chaitanya.kulkarni@wdc.com> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The new testcases exercises newly added model attribute for NVMeOF target. Signed-off-by: Chaitanya Kulkarni --- tests/nvme/034 | 64 ++++++++++++++++++++++++++++++++++++++++++++++ tests/nvme/034.out | 3 +++ 2 files changed, 67 insertions(+) create mode 100755 tests/nvme/034 create mode 100644 tests/nvme/034.out diff --git a/tests/nvme/034 b/tests/nvme/034 new file mode 100755 index 0000000..0e51a62 --- /dev/null +++ b/tests/nvme/034 @@ -0,0 +1,64 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2017-2018 Western Digital Corporation or its affiliates. +# +# Test NVMeOF target model attributes. + +. tests/nvme/rc + +DESCRIPTION="Test NVMeOF target model attribute" +QUICK=1 + +PORT="" +NVMEDEV="" +LOOP_DEV="" +MODEL="test~model" +FILE_PATH="$TMPDIR/img" +SUBSYS_NAME="blktests-subsystem-1" + +_have_model() + +{ + _setup_nvmet + truncate -s 1G "${FILE_PATH}" + LOOP_DEV="$(losetup -f --show "${FILE_PATH}")" + + # we can only know skip reason when we create a subsys + _create_nvmet_subsystem "${SUBSYS_NAME}" "${LOOP_DEV}" \ + "91fdba0d-f87b-4c25-b80f-db7be1418b9e" 14 15 \ + ${MODEL} +} + +requires() { + _have_program nvme && _have_modules loop nvme-loop nvmet && \ + _have_configfs && _have_model +} + +test() { + echo "Running ${TEST_NAME}" + + PORT="$(_create_nvmet_port "loop")" + _add_nvmet_subsys_to_port "${PORT}" "${SUBSYS_NAME}" + + nvme connect -t loop -n "${SUBSYS_NAME}" + + udevadm settle + + NVMEDEV="$(_find_nvme_loop_dev)" + nvme list | grep "${NVMEDEV}"n1 | grep -q "${MODEL}" + result=$? + + 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 [ ${result} -eq 0 ]; then + echo "Test complete" + fi +} diff --git a/tests/nvme/034.out b/tests/nvme/034.out new file mode 100644 index 0000000..0a7bd2f --- /dev/null +++ b/tests/nvme/034.out @@ -0,0 +1,3 @@ +Running nvme/034 +NQN:blktests-subsystem-1 disconnected 1 controller(s) +Test complete