From patchwork Wed Oct 30 19:52:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11220009 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 53B5E1668 for ; Wed, 30 Oct 2019 19:53:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 31E3320856 for ; Wed, 30 Oct 2019 19:53:06 +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="O1BJxm2A" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbfJ3TxF (ORCPT ); Wed, 30 Oct 2019 15:53:05 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:25749 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbfJ3TxF (ORCPT ); Wed, 30 Oct 2019 15:53:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1572465185; x=1604001185; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7W8UQyH9VKozvCDdJfCBpq1x6IqZopmBHKyNCZoGU6E=; b=O1BJxm2AJmnQ83dUzuEeVJbE/fPaO/4nwI78IhrZsKfSa90lZP5c22b2 iQf4FtxS8UASR3yVSxMU8VYEm6YLL1sv1Kvng1+9N0kMg4xpIWZuh8TbG SVVFhBvf7HTV8pjmrbJrT6BdJvK7Ud3T3TRR2Saj/uTorr2jqu4WJifpO YRp1MfXEjXXJYC1QrB84qyD96iPjZ9/dQreWOA4HbsGQFtUEO7XS2KBQJ D26pSuP3qzQLAJn6Ruw6V0hUrHrtVHzwv6d9/pFoc2G4lfzMJAI43djDw NlKzAWAqarS3w0Ode6liG+LV280Lqp5UveoWpcDm02O16A/QbmpHytP2+ Q==; IronPort-SDR: kgPymFQJLi0OY4sVcQyNTHrfbJFnUjLxyzyA0fDcTZuZHD7GhcSlavu0CVAicUFXl9OMhJl/WW 3AMCE0AOpz/0hbIAmZaoIQkzQuERU1iZ7TO/Xxkg9dGDkJvz3lJi+Ck+bNJB0rrGDvNJxwDVaW geBADYExR2LSGOB5F8nhd+UevFXp2BcKfkFr6VZ5FjguyF/wZsIRRxGvoK7sUKWnI59Wfa3lkD b6HvMLx7fIfAbvOC/sVQQdSF4wnzvVrre9YWQ6Pvayu8ZXNln/dw1axl3xHBzjzclid3cdLyOj ZyA= X-IronPort-AV: E=Sophos;i="5.68,248,1569254400"; d="scan'208";a="126145672" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2019 03:53:05 +0800 IronPort-SDR: 3n6pR4W6bfodqOq9QseL3C3QHDeGbcksCLeq8gikj34A4LE5N1JMXTa4YadyPPDB2GirOG+z8b 2tIpeQBhhtQNrXPvXGwf3B8OqE2pbBPDbk5G18RsSJ0C6Jt1WZfwUCRWuvWXA9+8UrfvGvmWOl ttu5o29qym0p0827hHVTBC4MZbU0RrVSVA24E2v0obqCs3xzFXSwOlwQkdrlizNQEvFhP9FgaZ chd9f+A2ON5jlFqA6sYsiI2L6wijn0CA0CmEZgN7Eqj8h8VDVJxRQbuZ+LqGcrkkTAqwxrpi7L bjKfLNYo3kN7HWZbgoVlGV/S Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2019 12:48:27 -0700 IronPort-SDR: ycSuKK3J0jDjgYw8W0XWpmrdY7HzS8Lls+QUuuV7fIgEUpyTGqYNR9vNtsF5AdiR4y5ZnjB8GC zESwco+E10/WUhhH0O6JR2cWTfvyH8/rKNETBQn7vLREfp/tv0yWqaJnRLv66tgYYp+rx3Kkbu ELUu8oyXkpEZG1EycgFjIgzC3kGkD8MtPYUrmH/hdI7k9e0MK653uVpwYnPR/cYA6ieomVZiFd W+sFA8pNBza7efbeeZqlJU2Ouh/8DcfLvw+OfqQTrQKzvYuYwfgyu+EdEf1cGojUTvsvcTmpIp hKc= WDCIronportException: Internal Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Oct 2019 12:53:05 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Chaitanya Kulkarni Subject: [blktests PATCH 1/2] nvme: handle model attr in subsys create helper Date: Wed, 30 Oct 2019 12:52:57 -0700 Message-Id: <20191030195258.31108-2-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20191030195258.31108-1-chaitanya.kulkarni@wdc.com> References: <20191030195258.31108-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 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}" } From patchwork Wed Oct 30 19:52:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 11220011 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 3A65E1599 for ; Wed, 30 Oct 2019 19:53:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1984920856 for ; Wed, 30 Oct 2019 19:53:07 +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="JxFhfnCI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726377AbfJ3TxG (ORCPT ); Wed, 30 Oct 2019 15:53:06 -0400 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:25749 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726269AbfJ3TxG (ORCPT ); Wed, 30 Oct 2019 15:53:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1572465186; x=1604001186; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xxB8ONVZT3rpIcghMpkObANMXcuVWQBdbOCLaXtbr1I=; b=JxFhfnCIhqxlFXRZAz9hyw/2PADQD66fi2rvfiCeZdcHjecr4CM2o56B WhaglzFGYO8WCYjiiUjtJA7mCZyH2HXr5wWMXX9S3VQ0U6zkW5Cp4z1Km eZDq5O60YuYp8joMqvwcv9nKnXV/MCXnuOWc7yuDAHVbZ1Fjvf3sgX2Va TBBHnC+DpS+wBaFermDNi5YaBhNctI8XjikCWWgrXDplCPVUoad4nfULs Y1xNuhniSJIp0B3gayL+OKPNcgdrAU7VlplYgyC2flXOASTcZK3+ud03b NlpnrfAv2hl6DdRizrW4JZDWOLm7KrovxzhgEeeRYPIP93Vlkmb3LKH5F g==; IronPort-SDR: gzpuZ1ChTqss8rRdi6yo4YvLUntV/Jq1McPyS3go2iQbwIzKh/bpIQybzauTmTbd4Uhzztuo07 JFbhLX4hPehssxVBLeg/3IDjIlGOsvaqpZ3S5lF2eJvXk0wDNO9bVjTq7s9loOoZ9rHHcqKF8i nIF+i3Zurv6Uo8arO5uji/HHCgkupe/M5utOeBIxqBc84PTbv6f9YHClE6HKrXBwhdv+BYiIM5 qR2jpO78iu8cnIEYTyD+7Fy8dHNTl8XEDDp21AGf7u6Z4svyXEYkXCL10v3Zc/tRo1eWCGMXWD 0dA= X-IronPort-AV: E=Sophos;i="5.68,248,1569254400"; d="scan'208";a="126145675" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 31 Oct 2019 03:53:06 +0800 IronPort-SDR: zAs91kX4dButYVBE80Ut/hZCoC18+FLTMwZTjlTJHpdHykOYUOE/eaTUMOxoZp9fSX7LI6j6G5 wJiEmqFkoo5s5qpe1Xw1eWcIHzKWV1bm9BCYnrdsNIjZFAVRrsELOgY5MgQoh/kcK0/Axl57Nd ziyt4nyEQ1JrSHYEaMIFvss2sccH/B2GxhXkK0y6sDKnVzk+4Dgk6KkxtHdQDLRCidiATA58Qv o7rzutb21cyfVlPHZwB9NtwwyXDRu0adrDOIIN/6EDw5Mh+2k5lJmtq/sGLs6bUb0XRxHa4/oK JUZUsWXV50ATFaCCbk2nezy+ Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Oct 2019 12:48:28 -0700 IronPort-SDR: GXvbH9Em6dJjDgNe6Ub/OVEaXoNkdvc7w9xpN2Cp3umpxLOCn9pz0oSy7s6GUkq6pUor08D5j/ JzvF8gEnMaBjU8HsP+xDvybKLrTyr8KeeETqNdCHCCFbI5NO/JEf1tGxTrZ4c7v1UJe8yMiXr/ Wemw3Cg/SsllkFVUc87a4FhRem2ly1rb8hzhpnoKMru1DsEjbwLhbU1vrxQjFzKCa/0VJIMJjR 9Firr6ts4Fkw0bkdeLTGNR24cqhiPfYZ64W9ijP8AIwTQJtRowc7h+MldvVXonpJBhtDEuuHCF Dp0= WDCIronportException: Internal Received: from cvenusqemu.hgst.com ([10.202.66.73]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Oct 2019 12:53:06 -0700 From: Chaitanya Kulkarni To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Chaitanya Kulkarni Subject: [blktests PATCH 2/2] nvme: add new test to check model attribute Date: Wed, 30 Oct 2019 12:52:58 -0700 Message-Id: <20191030195258.31108-3-chaitanya.kulkarni@wdc.com> X-Mailer: git-send-email 2.22.1 In-Reply-To: <20191030195258.31108-1-chaitanya.kulkarni@wdc.com> References: <20191030195258.31108-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 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