* [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework
@ 2017-10-25 1:30 Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 01/46] nvmftests: add nvmftests README file Chaitanya Kulkarni
` (47 more replies)
0 siblings, 48 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Hi,
This contains second version of the NVMe Over Fabrics unit test framework (nvmftests).
Changes since V1:-
1. Addition of new testcases to improve the coverage.
2. Improved directory structure for code clarity.
3. Libification of the common code.
4. Support to use different block devices on the target side.
5. Centralize test configuration management.
6. Support to execute File System related operations on the host side.
7. Adjust the code to incorporate the comments received for the
first version.
8. Support for setting different log levels for each component.
9. Support for quick performance measurements.
10. Class hierarchy documentation and sequence diagram.
11. Improved workqueue management for host namesapce to
run parallel commands.
It will be great if I can get some feedback, I'll be happy to incorporate
the comments and make it more usable.
Following is the code repository for current code:-
https://github.com/ChaitanayaKulkarni/nvmftests/releases
For the purpose of review, this patch series is generated against
$KERN_SRC/tools/testing/selftests/.
Regards,
-Chaitanya
Chaitanya Kulkarni (46):
nvmftests: add nvmftests README file
nvmftests-utils: add utility class to define constants
nvmftests-utils: add shell command package
nvmftests-utils: add log package
nvmftests-utils: add diskio package
nvmftests-utils: add fs package
nvmftests-utils: add misc package
nvmftests: add utils package
nvmftests-nvmf: add target config generator
nvmftests-nvmf: add support for target ns
nvmftests-nvmf: add support for target port
nvmftests-nvmf: add support for target subsystem
nvmftests-nvmf: add support for target
nvmftests-nvmf: add target package
nvmftests-nvmf: add support for host ns
nvmftests-nvmf: add support for host subsystem
nvmftests-nvmf: add support for host
nvmftests-nvmf: add host package
nvmftests-nvmf: add nvmf core package
nvmftests-tests: add user config file
nvmftests-tests: add support for test logger
nvmftests-tests: add a parent class for tests
nvmftests-tests: add a test for generic block device
nvmftests-tests: add a test for ns-descs
nvmftests-tests: add a test for create/delete host
nvmftests-tests: add a test for NVMe PCIe target ns
nvmftests-tests: add a test to create and delete target
nvmftests-tests: add a test for controller rescan
nvmftests-tests: add a test for controller reset
nvmftests-tests: add a test for get-ns-id
nvmftests-tests: add a test for identify controller
nvmftests-tests: add a test for identify namespace
nvmftests-tests: add a test for smart-log
nvmftests-tests: add a test to run IOs with dd
nvmftests-tests: add a test to run IOs parallely with dd
nvmftests-tests: add a test to run mkfs and fio
nvmftests-tests: add a test to enable/disable target ns
nvmftests-tests: add a test to run IOs with dd randomly
nvmftests-tests: add a test to scan host ctrls and ns
nvmftests-tests: add a test to scan target subsys/ns
nvmftests-tests: add a target template
nvmftests-tests: add a host template
nvmftests-tests: add a test to run traffic and disable ns
nvmftests-tests: add a test to measure perf with fio
nvmftests: add class documentation and sequence diagram
nvmftests: add Makefile
tools/testing/selftests/nvmftests/Makefile | 63 +++
tools/testing/selftests/nvmftests/README.md | 177 +++++++
tools/testing/selftests/nvmftests/doc/Makefile | 7 +
.../selftests/nvmftests/doc/sequence-diag/Makefile | 7 +
.../nvmftests/doc/sequence-diag/nvmftests.plantuml | 98 ++++
tools/testing/selftests/nvmftests/nvmf/__init__.py | 28 ++
.../selftests/nvmftests/nvmf/host/__init__.py | 23 +
.../testing/selftests/nvmftests/nvmf/host/host.py | 365 ++++++++++++++
.../selftests/nvmftests/nvmf/host/host_ns.py | 262 ++++++++++
.../nvmftests/nvmf/host/host_subsystem.py | 527 +++++++++++++++++++++
.../selftests/nvmftests/nvmf/target/__init__.py | 25 +
.../selftests/nvmftests/nvmf/target/port.py | 122 +++++
.../selftests/nvmftests/nvmf/target/target.py | 210 ++++++++
.../nvmf/target/target_config_generator.py | 222 +++++++++
.../selftests/nvmftests/nvmf/target/target_ns.py | 117 +++++
.../nvmftests/nvmf/target/target_subsystem.py | 140 ++++++
.../nvmftests/tests/config/nvmftests.json | 83 ++++
.../testing/selftests/nvmftests/tests/nvmf_test.py | 204 ++++++++
.../selftests/nvmftests/tests/nvmf_test_logger.py | 50 ++
.../nvmftests/tests/test_nvmf_create_gen_blk.py | 71 +++
.../nvmftests/tests/test_nvmf_create_host.py | 71 +++
.../nvmftests/tests/test_nvmf_create_pci_target.py | 70 +++
.../nvmftests/tests/test_nvmf_create_target.py | 62 +++
.../nvmftests/tests/test_nvmf_ctrl_rescan.py | 63 +++
.../nvmftests/tests/test_nvmf_ctrl_reset.py | 63 +++
.../nvmftests/tests/test_nvmf_get_ns_id.py | 63 +++
.../nvmftests/tests/test_nvmf_host_template.py | 62 +++
.../selftests/nvmftests/tests/test_nvmf_id_ctrl.py | 63 +++
.../selftests/nvmftests/tests/test_nvmf_id_ns.py | 63 +++
.../selftests/nvmftests/tests/test_nvmf_io.py | 65 +++
.../selftests/nvmftests/tests/test_nvmf_mkfs.py | 65 +++
.../nvmftests/tests/test_nvmf_ns_descs.py | 63 +++
.../nvmftests/tests/test_nvmf_ns_enable_disable.py | 83 ++++
.../nvmftests/tests/test_nvmf_parallel_io.py | 65 +++
.../selftests/nvmftests/tests/test_nvmf_perf.py | 63 +++
.../nvmftests/tests/test_nvmf_random_io.py | 65 +++
.../nvmftests/tests/test_nvmf_run_host_traffic.py | 111 +++++
.../nvmftests/tests/test_nvmf_scan_host.py | 76 +++
.../nvmftests/tests/test_nvmf_scan_target.py | 76 +++
.../nvmftests/tests/test_nvmf_smart_log.py | 63 +++
.../nvmftests/tests/test_nvmf_target_template.py | 64 +++
.../testing/selftests/nvmftests/utils/__init__.py | 32 ++
.../selftests/nvmftests/utils/const/__init__.py | 21 +
.../selftests/nvmftests/utils/const/const.py | 50 ++
.../selftests/nvmftests/utils/diskio/__init__.py | 21 +
.../testing/selftests/nvmftests/utils/diskio/dd.py | 50 ++
.../selftests/nvmftests/utils/diskio/fio.py | 74 +++
.../selftests/nvmftests/utils/fs/__init__.py | 21 +
.../testing/selftests/nvmftests/utils/fs/ext4fs.py | 108 +++++
.../selftests/nvmftests/utils/fs/filesystem.py | 122 +++++
.../selftests/nvmftests/utils/log/__init__.py | 20 +
tools/testing/selftests/nvmftests/utils/log/log.py | 58 +++
.../selftests/nvmftests/utils/misc/__init__.py | 23 +
.../nvmftests/utils/misc/generic_blk_dev.py | 58 +++
.../selftests/nvmftests/utils/misc/loopback.py | 103 ++++
.../selftests/nvmftests/utils/misc/nvme_pci.py | 114 +++++
.../selftests/nvmftests/utils/shell/__init__.py | 20 +
.../testing/selftests/nvmftests/utils/shell/cmd.py | 47 ++
58 files changed, 5182 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/Makefile
create mode 100644 tools/testing/selftests/nvmftests/README.md
create mode 100644 tools/testing/selftests/nvmftests/doc/Makefile
create mode 100644 tools/testing/selftests/nvmftests/doc/sequence-diag/Makefile
create mode 100644 tools/testing/selftests/nvmftests/doc/sequence-diag/nvmftests.plantuml
create mode 100644 tools/testing/selftests/nvmftests/nvmf/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host_ns.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host_subsystem.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/port.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_config_generator.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_ns.py
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_subsystem.py
create mode 100644 tools/testing/selftests/nvmftests/tests/config/nvmftests.json
create mode 100644 tools/testing/selftests/nvmftests/tests/nvmf_test.py
create mode 100644 tools/testing/selftests/nvmftests/tests/nvmf_test_logger.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_gen_blk.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_host.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_pci_target.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_target.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_rescan.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_reset.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_get_ns_id.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_host_template.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_id_ctrl.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_id_ns.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_io.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_mkfs.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ns_descs.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ns_enable_disable.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_parallel_io.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_perf.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_random_io.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_run_host_traffic.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_scan_host.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_scan_target.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_smart_log.py
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_target_template.py
create mode 100644 tools/testing/selftests/nvmftests/utils/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/const/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/const/const.py
create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/dd.py
create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/fio.py
create mode 100644 tools/testing/selftests/nvmftests/utils/fs/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/fs/ext4fs.py
create mode 100644 tools/testing/selftests/nvmftests/utils/fs/filesystem.py
create mode 100644 tools/testing/selftests/nvmftests/utils/log/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/log/log.py
create mode 100644 tools/testing/selftests/nvmftests/utils/misc/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/misc/generic_blk_dev.py
create mode 100644 tools/testing/selftests/nvmftests/utils/misc/loopback.py
create mode 100644 tools/testing/selftests/nvmftests/utils/misc/nvme_pci.py
create mode 100644 tools/testing/selftests/nvmftests/utils/shell/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/shell/cmd.py
--
1.8.3.1
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2 01/46] nvmftests: add nvmftests README file
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 02/46] nvmftests-utils: add utility class to define constants Chaitanya Kulkarni
` (46 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds readme file for NVMe Over Fabrics unit test
framework (nvmftests).
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
tools/testing/selftests/nvmftests/README.md | 176 ++++++++++++++++++++++++++++
1 file changed, 177 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/README.md
diff --git a/tools/testing/selftests/nvmftests/README.md b/tools/testing/selftests/nvmftests/README.md
new file mode 100644
index 0000000..b20a96a
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/README.md
@@ -0,0 +1,176 @@
+nvmftests
+=========
+
+
+1. Introduction
+---------------
+
+ This contains NVMe Over Fabrics unit test framework. The purpose of this
+ framework is to provide a platform to create different scenarios and test
+ specific functionality for NVMe Over Fabrics Subsystem (NVMeOF).
+
+2. Overview
+-----------
+
+ The main objective of this framework is to have a platform in place which
+ can provide :-
+ 2.1. Classes and methods for each component in the NVMeOF subsystem.
+ 2.2. Ability to build NVMeOF subsystem based on the configuration file.
+ 2.3. Ability to issue sequential and parallel commands to the different
+ namespaces and controllers from the host and target side.
+
+ All the testcases are written in python3 and nose2 format.
+
+3. Class hierarchy, design considerations and directory structure
+-----------------------------------------------------------------
+
+ This framework follows a simple class hierarchy. Each test is a
+ direct subclass or indirect subclass of NVMeOFTest. To write a new testcase
+ one can copy an existing template test_nvmf_target_template.py or
+ test_nvmf_host_template.py and start adding new testcase specific
+ functionality.
+
+ 3.1. Core Classes :- (path $NVMFTESTSHOME/nvmf/)
+ Target Classes :- (path $NVMFTESTSHOME/nvmf/target)
+ NVMeOFTarget :- Represents Target.
+ NVMeOFTargetSubsystem :- Represents a Target Subsystem.
+ NVMeOFTargetNamespace :- Represents a Target Namespace.
+ NVMeOFTargetPort :- Represents a Target Port.
+ Host Classes :- (path $NVMFTESTSHOME/nvmf/host)
+ NVMeOFHost :- Represents Host.
+ NVMeOFHostController :- Represents a Host Controller.
+ NVMeOFHostNamespace :- Represents a Host Namespace.
+
+ We divide host and target side components into two different class
+ hierarchies. On the host side, we have a controller represented as a
+ character device and each namespace as a block device. In order to
+ add any new functionality to the framework please modify core classes
+ for each component and propagate new interfaces to the top
+ level (in host.py/target.py). On the target side, we have subsystem(s),
+ namespace(s), and port(s) which are configured using configfs.
+ For detailed class hierarchy please look into documentation.
+ 3.2. Testcase class:-
+ NVMeOFTest :- Base class for each testcase, contains common functions.
+ Each testcase is direct or indirect subclass of
+ NVMeOFTest. Testcase class consumes the host and target
+ classes mentioned in the 3.1 to build the
+ NVMeOF subsystems.
+ 3.3 Directory Structure
+ Following is the quick overview of the directory structure :-
+ .
+ |-- doc :- documentation.
+ | |-- Documentation :- class documentation.
+ | |-- sequence-diag :- sequence diagram.
+ |-- nvmf :- NVMF core test framework files.
+ | |-- host :- NVMF host core files.
+ | |-- target :- NVMF target core files.
+ |-- tests :- test cases.
+ | |-- config :- test configuration JSON files.
+ |-- utils :- utility classes.
+ |-- const :- constant(s) definitions.
+ |-- diskio :- diskio related wrappers.
+ |-- fs :- fs related wrappers.
+ |-- misc :- miscellaneous files.
+ |-- shell :- shell command related wrappers.
+ |-- log :- module logger helpers.
+
+4. Adding new testcases
+-----------------------
+
+ 4.1. Please refer to host or target template testcase.
+ 4.2. Copy the template file with your testcase name.
+ 4.3. Update the class name with testcase name, this has to be unique.
+ 4.4. Update the test case function name.
+ 4.5. If necessary update the core files and add new functionality.
+ 4.6. Add testcase main function to determine success or failure.
+ 4.7. Update setUp() and tearDown() to add pre and post functionality.
+ 4.8. Once testcase is ready make sure :-
+ 4.8.1. Run pep8, flake8, pylint and fix errors/warnings.
+ -Example "$ make static_check" will run pep8, flake8, and
+ pylint on all the python files in current directory.
+ 4.8.2. Execute make doc to generate the documentation.
+ -Example "$ make doc" will create and update existing
+ documentation.
+
+5. Running testcases with framework
+-----------------------------------
+
+ Here are some examples of running testcases with nose2 :-
+ 5.1. Running single testcase with nose2 :-
+ from $NVMFTESTSHOME/tests
+ # nose2 --verbose test_nvmf_create_target
+ # nose2 --verbose test_nvmf_create_host
+
+ 5.2. Running all the testcases :-
+ from $NVMFTESTSHOME/tests
+ # nose2 --verbose
+
+ 5.3 Running all the testcases from makefile :-
+ from #NVMFTESTSHOME
+ # make run
+
+ Some notes on execution:-
+ In the current implementation, it uses file backed loop or nvme-pci
+ block device on the target side. For some testcase execution,
+ a new file is created and linked with loop device. It expects that
+ "mount_path" in the nvmftests.json has enough space available to store
+ backend files which are used for target namespaces. Please edit the
+ target subsystems and namespace configuration, size of the loop device
+ backed file on the target side in the
+ $NVMFTESTSHOME/tests/config/nvmftests.json according to your need.
+
+ For host and target setup, you may have to configure timeout (sleep())
+ values in the code to make sure previous steps are completed
+ successfully and resources are online before executing next the steps.
+ We are planning to make these sleep() calls configurable in the future
+ release.
+
+6. Logging
+----------
+
+ For each testcase, it will create a separate log directory with the test
+ name under logs/. This directory will be used for temporary files and
+ storing execution logs of each testcase. Current implementation stores
+ stdout and stderr for each testcase under log directory, e.g.:-
+ logs/
+ |-- TestNVMFCreateHost
+ | |-- TestNVMFCreateHost
+ | |-- stderr.log
+ | |-- stdout.log
+ |-- TestNVMFCreateTarget
+ | |?????? TestNVMFCreateTarget
+ | |-- stderr.log
+ | |-- stdout.log
+ |-- TestNVMFCtrlRescan
+ | |-- TestNVMFCtrlRescan
+ .
+ .
+ .
+
+7. Test configuration
+---------------------
+
+ There are two types of config files used by the framework :-
+ 7.1. nvmftests.json :- ($NVMFTESTSHOME/tests/config/nvmftests.json)
+ file contains the information about various testcase parameters.
+ 7.2. loop.json :- This file is auto-generated by the test framework
+ for the target configuration based on the parameters set in the
+ nvmftests.json.
+
+8. Dependencies
+---------------
+
+ 8.1. Python(>= 3.0)
+ 8.2. nose(http://nose.readthedocs.io
+ 8.3. nose2(Installation guide http://nose2.readthedocs.io/)
+ 8.4. pep8(https://pypi.python.org/pypi/setuptools-pep8)
+ 8.5. flake8(https://pypi.python.org/pypi/flake8)
+ 8.6. pylint(https://www.pylint.org/)
+ 8.7. Epydoc(http://epydoc.sourceforge.net/)
+ 8.8. nvme-cli(https://github.com/linux-nvme/nvme-cli.git)
+ 8.9. fio(https://github.com/axboe/fio)
+
+ Python package management system pip can be used to install most of the
+ listed packages(https://pip.pypa.io/en/stable/installing/) :-
+
+ $ pip install nose nose2 natsort pep8 flake8 pylint epydoc
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 02/46] nvmftests-utils: add utility class to define constants
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 01/46] nvmftests: add nvmftests README file Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 03/46] nvmftests-utils: add shell command package Chaitanya Kulkarni
` (45 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
The new directory utils holds utility classes required
for the framework/tests.
This adds a new class to store all the constants/literals
which are used in the core test framework and tests.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/utils/const/__init__.py | 21 +++++++++
.../selftests/nvmftests/utils/const/const.py | 50 ++++++++++++++++++++++
2 files changed, 71 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/utils/const/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/const/const.py
diff --git a/tools/testing/selftests/nvmftests/utils/const/__init__.py b/tools/testing/selftests/nvmftests/utils/const/__init__.py
new file mode 100644
index 0000000..4623af3
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/const/__init__.py
@@ -0,0 +1,21 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+from .const import Const
diff --git a/tools/testing/selftests/nvmftests/utils/const/const.py b/tools/testing/selftests/nvmftests/utils/const/const.py
new file mode 100644
index 0000000..128b031
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/const/const.py
@@ -0,0 +1,50 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents General Constants used in the framework.
+"""
+
+
+class Const:
+
+ """
+ Represents a host.
+ - Attributes :
+ General constants for testcases.
+ """
+
+ XXX = "XXX"
+ ONE_KB = 1024
+ ONE_MB = ONE_KB * ONE_KB
+ ONE_GB = ONE_MB * ONE_KB
+
+ KB = "KB"
+ MB = "MB"
+ GB = "GB"
+
+ EXT4 = "ext4"
+
+ CTRL_BLK_FILE_NAME = 2
+ SMART_LOG_VALUE = 1
+ ALLOW_HOST_VALUE = 0
+
+ SYSFS_DEFAULT_MOUNT_PATH = "/sys/kernel/config/"
+ SYSFS_NVMET = "/nvmet/"
+ SYSFS_NVMET_SUBSYS = SYSFS_NVMET + "/subsystems/"
+ SYSFS_NVMET_SUBSYS_NS = "/namespaces/"
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 03/46] nvmftests-utils: add shell command package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 01/46] nvmftests: add nvmftests README file Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 02/46] nvmftests-utils: add utility class to define constants Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 04/46] nvmftests-utils: add log package Chaitanya Kulkarni
` (44 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class which is a wrapper to execute
a shell command and support for the shell package.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/utils/shell/__init__.py | 20 +++++++++
.../testing/selftests/nvmftests/utils/shell/cmd.py | 47 ++++++++++++++++++++++
2 files changed, 67 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/utils/shell/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/shell/cmd.py
diff --git a/tools/testing/selftests/nvmftests/utils/shell/__init__.py b/tools/testing/selftests/nvmftests/utils/shell/__init__.py
new file mode 100644
index 0000000..7ddf843
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/shell/__init__.py
@@ -0,0 +1,20 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+from .cmd import Cmd
diff --git a/tools/testing/selftests/nvmftests/utils/shell/cmd.py b/tools/testing/selftests/nvmftests/utils/shell/cmd.py
new file mode 100644
index 0000000..4a1a645
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/shell/cmd.py
@@ -0,0 +1,47 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents Shell Command execution.
+"""
+import subprocess
+
+
+class Cmd(object):
+
+ """
+ Represents a shell command execution.
+ - Attributes :
+ """
+
+ @staticmethod
+ def exec_cmd(cmd):
+ """ Wrapper for executing a shell command.
+ - Args :
+ - cmd : command to execute.
+ - Returns :
+ - True if cmd returns 0, False otherwise.
+ """
+ proc = None
+ try:
+ proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+ except Exception as err:
+ print(str(err))
+ return False
+
+ return True if proc.wait() == 0 else False
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 04/46] nvmftests-utils: add log package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (2 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 03/46] nvmftests-utils: add shell command package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 05/46] nvmftests-utils: add diskio package Chaitanya Kulkarni
` (43 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds support to configure logging for the framework.
The new class uses log-level to configure the component
specific logging. Core framework and tests will use
this class to configure the logging.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/utils/log/__init__.py | 20 ++++++++
tools/testing/selftests/nvmftests/utils/log/log.py | 58 ++++++++++++++++++++++
2 files changed, 78 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/utils/log/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/log/log.py
diff --git a/tools/testing/selftests/nvmftests/utils/log/__init__.py b/tools/testing/selftests/nvmftests/utils/log/__init__.py
new file mode 100644
index 0000000..adf0b7b
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/log/__init__.py
@@ -0,0 +1,20 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+from .log import Log
diff --git a/tools/testing/selftests/nvmftests/utils/log/log.py b/tools/testing/selftests/nvmftests/utils/log/log.py
new file mode 100644
index 0000000..cd6ad66
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/log/log.py
@@ -0,0 +1,58 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents Testcaes Logging setup.
+"""
+import json
+import logging
+
+
+class Log(object):
+
+ """
+ Represents a console logger setup helper for a module.
+ - Attributes :
+ """
+
+ @staticmethod
+ def get_logger(name, element):
+ """ Returns the log level from config file.
+ - Args :
+ - element : NVMe Over Fabrics subsystem element.
+ - Returns :
+ - Valid Log level on success, None otherwise.
+ """
+ logger = None
+ with open('config/nvmftests.json') as cfg_file:
+ cfg = json.load(cfg_file)
+ logger = logging.getLogger(name)
+ if cfg['log'][element] == "NOTSET":
+ logger.setLevel(logging.DEBUG)
+ elif cfg['log'][element] == "DEBUG":
+ logger.setLevel(logging.DEBUG)
+ elif cfg['log'][element] == "INFO":
+ logger.setLevel(logging.INFO)
+ elif cfg['log'][element] == "WARNING":
+ logger.setLevel(logging.WARNING)
+ elif cfg['log'][element] == "ERROR":
+ logger.setLevel(logging.ERROR)
+ elif cfg['log'][element] == "CRITICAL":
+ logger.setLevel(logging.CRITICAL)
+
+ return logger
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 05/46] nvmftests-utils: add diskio package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (3 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 04/46] nvmftests-utils: add log package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 06/46] nvmftests-utils: add fs package Chaitanya Kulkarni
` (42 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds wrapper classes for different I/O utilities.
In current implementation it uses dd(1) and
fio wrapper. These classes will be used by host side tests
to generate I/O workload on host namespace.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/utils/diskio/__init__.py | 21 ++++++
.../testing/selftests/nvmftests/utils/diskio/dd.py | 50 +++++++++++++++
.../selftests/nvmftests/utils/diskio/fio.py | 74 ++++++++++++++++++++++
3 files changed, 145 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/dd.py
create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/fio.py
diff --git a/tools/testing/selftests/nvmftests/utils/diskio/__init__.py b/tools/testing/selftests/nvmftests/utils/diskio/__init__.py
new file mode 100644
index 0000000..52babcf
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/diskio/__init__.py
@@ -0,0 +1,21 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+from .dd import DD
+from .fio import FIO
diff --git a/tools/testing/selftests/nvmftests/utils/diskio/dd.py b/tools/testing/selftests/nvmftests/utils/diskio/dd.py
new file mode 100644
index 0000000..ad71a8b
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/diskio/dd.py
@@ -0,0 +1,50 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents dd(1) wrapper
+"""
+
+import subprocess
+
+
+class DD(object):
+
+ """
+ Represents dd command wrapper.
+ """
+
+ @staticmethod
+ def run_io(iocfg):
+ """ Executes dd command based on the config argument.
+ - Args :
+ - IO Configuration for dd command.
+ - Returns :
+ - True on success, False on failure.
+ """
+ cmd = "dd if=" + iocfg['IF'] + " of=" + iocfg['OF'] + \
+ " bs=" + iocfg['BS'] + " count=" + iocfg['COUNT'] + \
+ " > /tmp/op 2>&1"
+
+ proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+ ret = True
+ rc = proc.wait()
+ if rc != iocfg['RC']:
+ ret = False
+
+ return ret
diff --git a/tools/testing/selftests/nvmftests/utils/diskio/fio.py b/tools/testing/selftests/nvmftests/utils/diskio/fio.py
new file mode 100644
index 0000000..fbc95e9f
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/diskio/fio.py
@@ -0,0 +1,74 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents FIO wrapper
+"""
+
+import subprocess
+
+
+class FIO(object):
+
+ """
+ Represents fio command wrapper.
+ """
+
+ @staticmethod
+ def run_io(iocfg):
+ """ Executes fio command based on the config argument.
+ - Args :
+ - IO Configuration for fio command.
+ - Returns :
+ - True on success, False on failure.
+ """
+ cmd = "fio "
+ cmd += " --group_reporting=" + iocfg['group_reporting']
+ cmd += " --rw=" + iocfg['rw']
+ cmd += " --bs=" + iocfg['bs']
+ cmd += " --numjobs=" + iocfg['numjobs']
+ cmd += " --iodepth=" + iocfg['iodepth']
+ cmd += " --runtime=" + iocfg['runtime']
+ cmd += " --loops=" + iocfg['loop']
+ cmd += " --ioengine=" + iocfg['ioengine']
+ cmd += " --direct=" + iocfg['direct']
+ cmd += " --invalidate=" + iocfg['invalidate']
+ cmd += " --randrepeat=" + iocfg['randrepeat']
+ cmd += " --time_based "
+ cmd += " --norandommap"
+ cmd += " --exitall"
+ cmd += " --size=" + iocfg['size']
+ if 'filename' in iocfg:
+ cmd += " --filename=" + iocfg['filename']
+ cmd += " --output=" + iocfg['filename'].split('/')[-1] + "_fio.log"
+ else:
+ cmd += " --directory=" + iocfg['directory']
+ cmd += " --output=" + iocfg['directory'].split('/')[-2] + \
+ "_fio.log"
+ cmd += " --name=" + iocfg['name']
+ ret = True
+ proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
+ rc = proc.wait()
+ """
+ some testcases expect fio to fail which is success for the
+ testcase so we test against RC value before deciding success and
+ failure of fio execution
+ """
+ if rc != iocfg['RC']:
+ ret = False
+ return ret
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 06/46] nvmftests-utils: add fs package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (4 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 05/46] nvmftests-utils: add diskio package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 07/46] nvmftests-utils: add misc package Chaitanya Kulkarni
` (41 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds wrapper classes for handling different
file system related operations. In current implementation
it has a support for ext4 file system.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/utils/fs/__init__.py | 21 ++++
.../testing/selftests/nvmftests/utils/fs/ext4fs.py | 108 ++++++++++++++++++
.../selftests/nvmftests/utils/fs/filesystem.py | 122 +++++++++++++++++++++
3 files changed, 251 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/utils/fs/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/fs/ext4fs.py
create mode 100644 tools/testing/selftests/nvmftests/utils/fs/filesystem.py
diff --git a/tools/testing/selftests/nvmftests/utils/fs/__init__.py b/tools/testing/selftests/nvmftests/utils/fs/__init__.py
new file mode 100644
index 0000000..e83f580
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/fs/__init__.py
@@ -0,0 +1,21 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+from .filesystem import FileSystem
+from .ext4fs import Ext4FS
diff --git a/tools/testing/selftests/nvmftests/utils/fs/ext4fs.py b/tools/testing/selftests/nvmftests/utils/fs/ext4fs.py
new file mode 100644
index 0000000..e0a5146
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/fs/ext4fs.py
@@ -0,0 +1,108 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents Ext4 File system.
+"""
+import os
+import logging
+
+from .filesystem import FileSystem
+from utils.shell import Cmd
+
+
+class Ext4FS(FileSystem):
+ """
+ Represents Ext4 File System management interface.
+
+ - Attributes :
+ """
+ def __init__(self, dev_path, mount_path=None):
+ super(Ext4FS, self).__init__("ext4", dev_path, mount_path)
+ self.logger = logging.getLogger(__name__)
+ self.log_format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
+ self.log_format += '%(filename)20s %(funcName)20s %(lineno)4d'
+ self.log_format += '%(pathname)s'
+ self.formatter = logging.Formatter(self.log_format)
+ self.logger.setLevel(logging.WARNING)
+
+ def get_mount_path(self):
+ """ Accessor for file system mountpath.
+ - Args :
+ - None.
+ - Returns :
+ - File system mountpath.
+ """
+ return super(Ext4FS, self).get_mount_path()
+
+ def mkfs(self):
+ """ Execute mkfs on target deivce.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if super(Ext4FS, self).mkfs() is False:
+ return False
+
+ if Cmd.exec_cmd("mkfs.ext4 " + self.dev_path) is False:
+ self.logger.error("mkfs failed")
+ return False
+
+ self.logger.info("mkfs successful!!!")
+ return True
+
+ def mount(self):
+ """ Mount Target device on the mount path.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if super(Ext4FS, self).mount() is False:
+ return False
+ return Cmd.exec_cmd("mount " + self.dev_path + " " + self.mount_path)
+
+ def is_mounted(self):
+ """ Check if mount_path is mounted.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ return Cmd.exec_cmd("mountpoint -q " + self.mount_path)
+
+ def umount(self):
+ """ Unmount target device from mount path.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if super(Ext4FS, self).umount() is False:
+ return False
+
+ ret = True
+ Cmd.exec_cmd("umount " + self.mount_path)
+ try:
+ os.rmdir(self.mount_path)
+ except Exception as err:
+ self.logger.info(str(err))
+ ret = False
+
+ return ret
diff --git a/tools/testing/selftests/nvmftests/utils/fs/filesystem.py b/tools/testing/selftests/nvmftests/utils/fs/filesystem.py
new file mode 100644
index 0000000..cedb9e9
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/fs/filesystem.py
@@ -0,0 +1,122 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents File System Base class.
+"""
+import os
+import stat
+import logging
+
+
+from utils.shell import Cmd
+
+
+class FileSystem(object):
+ """
+ Represents file system management interface.
+
+ - Attributes :
+ - fs_name : file system name.
+ - dev_path : target device.
+ - mount_path : path to mount target device.
+ """
+ def __init__(self, fs_name, dev_path, mount_path=None):
+ self.fs_name = fs_name
+ self.dev_path = dev_path
+ self.mount_path = mount_path
+ if self.mount_path is None:
+ self.mount_path = "/mnt/" + self.dev_path.split('/')[-1]
+
+ self.logger = logging.getLogger(__name__)
+ self.log_format = '%(asctime)s %(name)-12s %(levelname)-8s %(message)s'
+ self.log_format += '%(filename)20s %(funcName)20s %(lineno)4d'
+ self.log_format += '%(pathname)s'
+ self.formatter = logging.Formatter(self.log_format)
+ self.logger.setLevel(logging.WARNING)
+
+ def mkfs(self):
+ """ Check preconditions for the mkfs operation, subclass should
+ implement actual mkfs.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if not os.path.exists(self.dev_path):
+ self.logger.info("ERROR : device path %s is not present.",
+ self.dev_path)
+ return False
+
+ if not stat.S_ISBLK(os.stat(self.dev_path).st_mode):
+ self.logger.info("ERRO : block device expected for mkfs.")
+ return False
+
+ if self.is_mounted() is True:
+ self.logger.info("ERROR : device is already mounted.")
+ return False
+
+ return True
+
+ def mount(self):
+ """ Check preconditions for the mount operation.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if not os.path.exists(self.mount_path):
+ try:
+ os.makedirs(self.mount_path)
+ except Exception as err:
+ self.logger.info(str(err))
+ return False
+
+ return True
+
+ def get_mount_path(self):
+ """ Accessor for file system mountpath.
+ - Args :
+ - None.
+ - Returns :
+ - File system mountpath.
+ """
+ # TODO : add mount check here
+ return self.mount_path
+
+ def umount(self):
+ """ Check preconditions for the umount operation.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if not self.is_mounted():
+ self.logger.info("fs is not mounted")
+ return False
+
+ return True
+
+ def is_mounted(self):
+ """ Check if mount_path is mounted.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ return Cmd.exec_cmd("mountpoint -q " + self.mount_path)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 07/46] nvmftests-utils: add misc package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (5 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 06/46] nvmftests-utils: add fs package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 08/46] nvmftests: add utils package Chaitanya Kulkarni
` (40 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds support for misc package. In current implementation
it has different device types which are used on the
NVMe Over Fabrics target namespace. These classes will be
used at the time of target initialization.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/utils/misc/__init__.py | 23 +++++
.../nvmftests/utils/misc/generic_blk_dev.py | 58 +++++++++++
.../selftests/nvmftests/utils/misc/loopback.py | 103 +++++++++++++++++++
.../selftests/nvmftests/utils/misc/nvme_pci.py | 114 +++++++++++++++++++++
4 files changed, 298 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/utils/misc/__init__.py
create mode 100644 tools/testing/selftests/nvmftests/utils/misc/generic_blk_dev.py
create mode 100644 tools/testing/selftests/nvmftests/utils/misc/loopback.py
create mode 100644 tools/testing/selftests/nvmftests/utils/misc/nvme_pci.py
diff --git a/tools/testing/selftests/nvmftests/utils/misc/__init__.py b/tools/testing/selftests/nvmftests/utils/misc/__init__.py
new file mode 100644
index 0000000..07806e7
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/misc/__init__.py
@@ -0,0 +1,23 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+from .loopback import Loopback
+from .generic_blk_dev import GenBlk
+from .nvme_pci import NVMePCIeBlk
diff --git a/tools/testing/selftests/nvmftests/utils/misc/generic_blk_dev.py b/tools/testing/selftests/nvmftests/utils/misc/generic_blk_dev.py
new file mode 100644
index 0000000..b818cea
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/misc/generic_blk_dev.py
@@ -0,0 +1,58 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents generic block device.
+"""
+
+import os
+import stat
+import logging
+
+from utils.log import Log
+
+
+class GenBlk(object):
+ """
+ Represents Generic BLK block devices.
+
+ - Attributes:
+ - nr_devices : max block devices.
+ - dev_list : list of block devices.
+ """
+ def __init__(self, nr_devices):
+ self.nr_devices = str(nr_devices)
+ self.dev_list = []
+ self.logger = Log.get_logger(__name__, 'gen_blk')
+ self.logger.setLevel(logging.DEBUG)
+
+ def init(self, dev_list):
+ """ Create and initialize Generic Block Device.
+ - Args :
+ - dev_list : list of block devices.
+ - Returns :
+ - True on success, False on failure.
+ """
+ for i in range(0, int(self.nr_devices)):
+ self.logger.info(dev_list[i])
+ if stat.S_ISBLK(os.stat(dev_list[i]).st_mode) is False:
+ self.logger.error("block device not found " + dev_list[i])
+ return False
+ self.dev_list.append(dev_list[i])
+ self.logger.info(self.dev_list)
+ return True
diff --git a/tools/testing/selftests/nvmftests/utils/misc/loopback.py b/tools/testing/selftests/nvmftests/utils/misc/loopback.py
new file mode 100644
index 0000000..04817f5
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/misc/loopback.py
@@ -0,0 +1,103 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents Loopback block devices.
+"""
+
+import os
+import logging
+
+from utils.shell import Cmd
+from utils.log import Log
+
+
+class Loopback(object):
+ """
+ Represents Loopback driver block devices.
+
+ - Attributes:
+ - path : path to create backend files.
+ - dev_size : device file size.
+ - block size : block size to create file.
+ - max_loop : max loop devices.
+ - dev_list : list of loop back files.
+ """
+ def __init__(self, path, dev_size, block_size, max_loop):
+ self.path = path
+ self.dev_size = dev_size
+ self.block_size = block_size
+ self.max_loop = max_loop
+ self.dev_list = []
+ self.logger = Log.get_logger(__name__, 'loopback')
+ self.logger.setLevel(logging.DEBUG)
+
+ Cmd.exec_cmd("losetup -D")
+ Cmd.exec_cmd("modprobe -qr loop")
+ Cmd.exec_cmd("modprobe loop max_loop=" + str(max_loop))
+
+ def init(self):
+ """ Create and initialize Loopback.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if self.dev_size == 0 or self.block_size == 0:
+ self.logger.err("invalid device size or block size")
+ return False
+
+ count = self.dev_size / self.block_size
+
+ for i in range(0, self.max_loop):
+ file_path = self.path + "/test" + str(i)
+ cmd = "dd if=/dev/zero of=" + file_path + \
+ " count=" + str(count) + " bs=" + str(self.block_size)
+ self.logger.info(cmd)
+ ret = Cmd.exec_cmd(cmd)
+ if ret is False:
+ self.logger.error("lookback file creation " + self.dev_list[i])
+ self.delete()
+ return False
+ dev = "/dev/loop" + str(i)
+ cmd = "losetup " + dev + " " + file_path
+ self.logger.info(cmd)
+ if Cmd.exec_cmd(cmd) is False:
+ self.logger.error(cmd + " failed.")
+ return False
+
+ self.dev_list.append(dev)
+ return True
+
+ def delete(self):
+ """ Delete this Loopback.
+ - Args :
+ - None.
+ -Returns :
+ - True on success, False on failure.
+ """
+ loop_cnt = 0
+ for i in self.dev_list:
+ cmd = "losetup -d /dev/loop" + str(loop_cnt)
+ self.logger.info(cmd)
+ Cmd.exec_cmd(cmd)
+ file_path = self.path + "/test" + str(loop_cnt)
+ os.remove(file_path)
+ loop_cnt += 1
+
+ return Cmd.exec_cmd("modprobe -qr loop")
diff --git a/tools/testing/selftests/nvmftests/utils/misc/nvme_pci.py b/tools/testing/selftests/nvmftests/utils/misc/nvme_pci.py
new file mode 100644
index 0000000..f8a4b78
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/misc/nvme_pci.py
@@ -0,0 +1,114 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe PCIe block device.
+"""
+import os
+import re
+import sys
+import time
+from natsort import natsorted
+
+sys.path.append('../../')
+from utils.shell import Cmd
+from utils.log import Log
+
+
+class NVMePCIeBlk(object):
+ """
+ Represents NVMe PCIe block devices.
+
+ - Attributes :
+ - nr_devices : number of block devices.
+ - ctrl_list : NVMe PCIe controller list.
+ - dev_list : list of devices.
+ """
+ def __init__(self):
+ self.nr_devices = None
+ self.ctrl_list = []
+ self.dev_list = []
+ self.logger = Log.get_logger(__name__, 'nvme_pci')
+
+ Cmd.exec_cmd("modprobe -r nvme")
+ Cmd.exec_cmd("modprobe nvme")
+ # allow devices to appear in /dev/
+ time.sleep(1)
+
+ def is_pci_ctrl(self, ctrl):
+ """ Validate underlaying device belongs to pci subsystem.
+ - Args :
+ - None.
+ - Returns :
+ - True if device is belongs to PCIe subsystem, False otherwise.
+ """
+ cmd = "find /sys/devices -name " + ctrl + " | grep -i pci"
+ return Cmd.exec_cmd(cmd)
+
+ def init(self):
+ """ Build the list of NVMe PCIe controllers.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ time.sleep(1)
+ ctrl = "XXX "
+ try:
+ dev_list = os.listdir("/dev/")
+ except Exception, err:
+ self.logger.error(str(err) + ".")
+ return False
+ dev_list = natsorted(dev_list, key=lambda y: y.lower())
+ pat = re.compile("^nvme[0-9]+$")
+ for line in dev_list:
+ line = line.strip('\n')
+ if pat.match(line):
+ ctrl = line
+ ctrl_dev = "/dev/" + ctrl
+ if self.is_pci_ctrl(ctrl) is True:
+ self.logger.info("found NVMe PCIe Controller " + ctrl_dev)
+ self.ctrl_list.append(ctrl_dev)
+ else:
+ self.logger.info(ctrl_dev + " is not pci ctrl.")
+
+ # find namespace(s) associated with ctrl
+ try:
+ dir_list = os.listdir("/dev/")
+ except Exception, err:
+ self.logger.error(str(err))
+ return False
+ pat = re.compile("^" + ctrl + "+n[0-9]+$")
+ for line in dir_list:
+ line = line.strip('\n')
+ if pat.match(line):
+ self.logger.info("Generated namespace name /dev/" + line + ".")
+ self.dev_list.append("/dev/" + line)
+
+ self.logger.info(self.ctrl_list)
+ self.logger.info(self.dev_list)
+ return True
+
+ def delete(self):
+ """ Remove the nvme module.
+ - Args :
+ - None.
+ -Returns :
+ - True on success, False on failure.
+ """
+ return Cmd.exec_cmd("modprobe -qr nvme")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 08/46] nvmftests: add utils package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (6 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 07/46] nvmftests-utils: add misc package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 09/46] nvmftests-nvmf: add target config generator Chaitanya Kulkarni
` (39 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../testing/selftests/nvmftests/utils/__init__.py | 32 ++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/utils/__init__.py
diff --git a/tools/testing/selftests/nvmftests/utils/__init__.py b/tools/testing/selftests/nvmftests/utils/__init__.py
new file mode 100644
index 0000000..232b5a5
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/utils/__init__.py
@@ -0,0 +1,32 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+from .fs import FileSystem
+from .fs import Ext4FS
+
+from .shell import cmd
+
+from .diskio import dd
+from .diskio import fio
+
+from .misc import Loopback
+from .misc import GenBlk
+from .misc import NVMePCIeBlk
+
+from .log import Log
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 09/46] nvmftests-nvmf: add target config generator
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (7 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 08/46] nvmftests: add utils package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 10/46] nvmftests-nvmf: add support for target ns Chaitanya Kulkarni
` (38 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class to generate target configuration on
the fly. Framework will read the user configuration file and
create a target configuration JSON file on the
fly using this class.
This is useful to have a centralized configuration management.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmf/target/target_config_generator.py | 222 +++++++++++++++++++++
1 file changed, 222 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_config_generator.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/target/target_config_generator.py b/tools/testing/selftests/nvmftests/nvmf/target/target_config_generator.py
new file mode 100644
index 0000000..0da28f9
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/target/target_config_generator.py
@@ -0,0 +1,222 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe Over Fabric Target config file generator.
+"""
+
+import json
+
+
+class Port:
+ """
+ Represents target port config generator.
+
+ - Attributes:
+ - port_id : unique port identification number.
+ - port_dict : dictionary to hold port attributes.
+ - addr : to hold address attributes.
+ - referrals : list of target port referals.
+ - subsystems : list of the subsystems associated with this port.
+ """
+ def __init__(self, port_id):
+ self.port_id = port_id
+ self.port_dict = {}
+ self.addr = {}
+ self.referrals = [None]
+ self.subsystems = []
+
+ def build_addr(self):
+ """ Initialize address attributes for this port.
+ - Args :
+ - None.
+ - Returns :
+ - None.
+ """
+ self.addr['adrfam'] = ""
+ self.addr['traddr'] = ""
+ self.addr['treq'] = "not specified"
+ self.addr['trsvcid'] = ""
+ self.addr['trtype'] = "loop"
+ self.port_dict['addr'] = self.addr
+
+ def build_subsystems(self, subsys_list):
+ """ Initialize subsystem list associated with this port.
+ - Args :
+ - None.
+ -Returns :
+ - Port attributes dictionary.
+ """
+ self.subsystem = subsys_list
+ self.port_dict['subsystems'] = self.subsystem
+
+ def build_port(self, nqn_list):
+ """ Builds port addr, subsystems, id, and referrals.
+ - Args :
+ - List of the subsystem nqn associated with this port.
+ - Returns :
+ - Port dictionary with valid values.
+ """
+ self.build_addr()
+ self.build_subsystems(nqn_list)
+ self.port_dict['portid'] = self.port_id
+ self.port_dict['referrals'] = self.referrals
+ return self.port_dict
+
+
+class Subsystem:
+ """
+ Represents target subsystem config generator.
+
+ - Attributes:
+ - nr_ns : number of namespaces per subsystem.
+ - dev_list : list of block devices.
+ - nqn : subsystem nqn.
+ - ns_list : namespace list for this subsystem.
+ - allowd_hosts : allowd hosts.
+ - attr : subsystem attributes.
+ - namespace : namespace attributes.
+ - device : namespace device attibutes.
+ """
+ def __init__(self, nr_ns, nqn, dev_list):
+ self.nr_ns = nr_ns
+ self.dev_list = dev_list
+ self.nqn = nqn
+ self.ns_list = []
+ self.allowd_hosts = []
+ self.attr = {}
+ self.namespace = {}
+ self.device = {}
+ self.nguid = "00000000-0000-0000-0000-000000000000"
+
+ def add_ns(self, ns_cfg):
+ """ Updates subsystem namespace list with new namespace.
+ - Args :
+ - ns_cfg : namespace configuration.
+ - Returns :
+ - None.
+ """
+ self.allowd_hosts = []
+ self.attr = {}
+ self.namespace = {}
+ self.device = {}
+
+ self.allowd_hosts.append('hostnqn')
+ self.attr['allow_any_host'] = '1'
+ self.device['nguid'] = ns_cfg['device']['nguid']
+ self.device['path'] = ns_cfg['device']['path']
+ self.namespace['device'] = self.device
+ self.namespace['enable'] = ns_cfg['enable']
+ self.namespace['nsid'] = ns_cfg['nsid']
+ ns = self.namespace
+ self.ns_list.append(ns)
+
+ def build_ns(self):
+ """ Build namespace configuration using available devices.
+ - Args :
+ - ns_cfg : namespace configuration.
+ - Returns :
+ - None.
+ """
+ for i in range(0, self.nr_ns):
+ ns_cfg = {}
+ ns_cfg['device'] = {}
+ ns_cfg['device']['nguid'] = self.nguid
+ ns_cfg['device']['path'] = self.dev_list[i % len(self.dev_list)]
+ ns_cfg['enable'] = 1
+ ns_cfg['nsid'] = i + 1
+ self.add_ns(ns_cfg)
+
+ def build_subsys(self):
+ """ Initialize subsystem entry.
+ - Args :
+ - None.
+ - Returns :
+ - subsystem entry dictionary.
+ """
+ self.build_ns()
+ subsys_entry = {}
+ subsys_entry['allowed_hosts'] = self.allowd_hosts
+ subsys_entry['attr'] = self.attr
+ subsys_entry['namespaces'] = self.ns_list
+ subsys_entry['nqn'] = self.nqn
+ subsys = []
+ subsys.append(subsys_entry)
+ return subsys_entry
+
+
+class TargetConfig:
+ """
+ Represents target config generator.
+
+ - Attributes:
+ - subsys_list : list of subsystems associsted with this target.
+ - port_list : list of the ports associated with this target.
+ - config_file_path : path name to test config file.
+ - nr_subsys : number of subsystems present in this target.
+ - nr_ns : number of namespaces per subsystem.
+ - dev_list : list of devices to be used for namespaces.
+ """
+ def __init__(self, config_file_path, nr_subsys, nr_ns, dev_list):
+ self.subsys_list = []
+ self.port_list = []
+ self.config_file_path = config_file_path
+ self.nr_subsys = nr_subsys
+ self.nr_ns = nr_ns
+ self.dev_list = dev_list
+
+ def pp_json(self, json_string, sort=True, indents=4):
+ """ Prints formatted JSON output.
+ - Args :
+ - json_string : JSON string.
+ - sort : flag to sort JSON values before formatting.
+ - idents : identation width.
+ -Returns :
+ - formatted JSON string.
+ """
+ if type(json_string) is str:
+ return json.dumps(json.loads(json_string),
+ sort_keys=sort, indent=indents)
+ return json.dumps(json_string, sort_keys=sort, indent=indents)
+
+ def build_target_subsys(self):
+ """ Builds the Target config and dumps in JSON format.
+ - Args :
+ - None.
+ - Returns :
+ - None.
+ """
+ nqn_list = []
+ subsys_list = []
+ port_list = []
+ for i in range(0, self.nr_subsys):
+ nqn = "testnqn" + str(i + 1)
+ subsys = Subsystem(self.nr_ns, nqn, self.dev_list)
+ subsys_list.append(subsys.build_subsys())
+ nqn_list.append(nqn)
+
+ # TODO : improve support for multiple ports
+ p = Port(1)
+ port_list.append(p.build_port(nqn_list))
+
+ target_config_str = {}
+ target_config_str['ports'] = port_list
+ target_config_str['subsystems'] = subsys_list
+ data = self.pp_json(target_config_str)
+ with open(self.config_file_path, "w+") as config_file:
+ config_file.write(data)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 10/46] nvmftests-nvmf: add support for target ns
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (8 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 09/46] nvmftests-nvmf: add target config generator Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 11/46] nvmftests-nvmf: add support for target port Chaitanya Kulkarni
` (37 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class to handle the target namespace operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/nvmf/target/target_ns.py | 117 +++++++++++++++++++++
1 file changed, 117 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_ns.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/target/target_ns.py b/tools/testing/selftests/nvmftests/nvmf/target/target_ns.py
new file mode 100644
index 0000000..0e3ba65
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/target/target_ns.py
@@ -0,0 +1,117 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe Over Fabric Target Namespace.
+"""
+
+import os
+import shutil
+
+from utils.shell import Cmd
+from utils.const import Const
+from utils.log import Log
+
+
+class NVMFTargetNamespace(object):
+ """
+ Represents a target namespace.
+
+ - Attributes :
+ - ns_attr : namespace attributes.
+ - cfgfs : configfs path.
+ - nqn : subsystem nqn.
+ - ns_id : namespace identifier.
+ - ns_path : namespace path in configfs tree.
+ - ns_attr : namespace attributes.
+ """
+ def __init__(self, cfgfs, nqn, ns_id, **ns_attr):
+ self.ns_attr = {}
+ self.cfgfs = cfgfs
+ self.nqn = nqn
+ self.ns_id = ns_id
+ self.ns_path = (self.cfgfs + Const.SYSFS_NVMET_SUBSYS +
+ nqn + Const.SYSFS_NVMET_SUBSYS_NS + str(ns_id) + "/")
+ self.ns_attr['device_nguid'] = ns_attr['device_nguid']
+ self.ns_attr['device_path'] = ns_attr['device_path']
+ self.ns_attr['enable'] = ns_attr['enable']
+ self.logger = Log.get_logger(__name__, 'target_ns')
+
+ def init(self):
+ """ Create and initialize namespace.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Creating ns " + self.ns_path + " ...")
+ try:
+ os.makedirs(self.ns_path)
+ except Exception, err:
+ self.logger.error(str(err) + ".")
+ return False
+
+ cmd = "echo -n " + self.ns_attr['device_path'] + " > " + \
+ self.ns_path + "/device_path"
+
+ if Cmd.exec_cmd(cmd) is False:
+ self.logger.error("failed to configure device path.")
+ return False
+
+ if self.ns_attr['enable'] == '1':
+ if self.enable() is False:
+ self.logger.error("enable ns " + self.ns_path + " failed.")
+ return False
+
+ self.logger.info("NS " + self.ns_path + " enabled.")
+ return True
+
+ def disable(self):
+ """ Disable Namespace.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.ns_attr['enable'] = '0'
+ return Cmd.exec_cmd("echo 0 > " + self.ns_path + "/enable")
+
+ def enable(self):
+ """ Enable Namespace.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.ns_attr['enable'] = '1'
+ return Cmd.exec_cmd("echo 1 > " + self.ns_path + "/enable")
+
+ def delete(self):
+ """ Delete namespace.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Removing NS " + self.ns_path + ".")
+ ret = os.path.exists(self.ns_path)
+ if ret is True:
+ shutil.rmtree(self.ns_path, ignore_errors=True)
+ else:
+ self.logger.error("path " + self.ns_path + " doesn't exists.")
+ return ret
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 11/46] nvmftests-nvmf: add support for target port
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (9 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 10/46] nvmftests-nvmf: add support for target ns Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 12/46] nvmftests-nvmf: add support for target subsystem Chaitanya Kulkarni
` (36 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class to handle the target port operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/nvmf/target/port.py | 122 +++++++++++++++++++++
1 file changed, 122 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/port.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/target/port.py b/tools/testing/selftests/nvmftests/nvmf/target/port.py
new file mode 100644
index 0000000..a622ea2
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/target/port.py
@@ -0,0 +1,122 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe Over Fabric Target Port.
+"""
+
+import os
+import shutil
+
+from utils.shell import Cmd
+from utils.const import Const
+from utils.log import Log
+
+
+class NVMFTargetPort(object):
+ """
+ Represents a target port.
+
+ - Attributes :
+ - cfgfs : configfs mountpoint.
+ - port_id : port identification number.
+ - port_path : port path in configfs.
+ - port_conf : dictionary to hold the port attributes.
+ """
+ def __init__(self, cfgfs, port_id, **port_conf):
+ self.cfgfs = cfgfs
+ self.port_id = port_id
+ self.port_path = self.cfgfs + "/nvmet/ports/" + port_id + "/"
+ self.port_conf = {}
+ self.port_conf['addr_treq'] = port_conf['addr_treq']
+ self.port_conf['addr_traddr'] = port_conf['addr_traddr']
+ self.port_conf['addr_trtype'] = port_conf['addr_trtype']
+ self.port_conf['addr_adrfam'] = port_conf['addr_adrfam']
+ self.port_conf['addr_trsvcid'] = port_conf['addr_trsvcid']
+ self.port_conf['referrals'] = Const.XXX
+ self.port_conf['subsystems'] = port_conf['subsystems']
+ self.logger = Log.get_logger(__name__, 'port')
+
+ def init(self):
+ """ Create and initialize port.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if self.port_conf['addr_trtype'] != "loop":
+ self.logger.error("only loop transport type is supported.")
+ return False
+
+ ret = Cmd.exec_cmd("mkdir -p " + self.port_path)
+ if ret is False:
+ self.logger.error("failed to create " + self.port_path + ".")
+ return False
+
+ # initialize transport type
+ self.logger.info("Port " + self.port_path + " created successfully.")
+
+ ret = Cmd.exec_cmd("echo -n \"" + self.port_conf['addr_trtype'] +
+ "\" > " + self.port_path + "/addr_trtype")
+ if ret is False:
+ status = "trtype " + self.port_path + " failed."
+ self.logger.error(status)
+ else:
+ status = "Port " + self.port_path + " initialized successfully."
+ self.logger.info(status)
+ return ret
+
+ def add_subsys(self, subsys_name):
+ """ Link Subsystem to this port.
+ - Args :
+ - subsys_name : subsystem nqn to be linked.
+ - Returns :
+ - True on success, False on failure.
+ """
+ src = self.cfgfs + "/nvmet/subsystems/" + subsys_name
+ if not os.path.exists(src):
+ self.logger.error("subsystem '" + src + "' not present.")
+ return False
+ dest = self.port_path + "/subsystems/"
+ cmd = "ln -s " + src + " " + dest
+ self.logger.info(cmd)
+ return Cmd.exec_cmd(cmd)
+
+ def delete(self):
+ """ Delete this port.
+ - Args :
+ - None.
+ -Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Deleting port " + self.port_id + ".")
+ subsys_symlink = self.port_path + "/subsystem/"
+ try:
+
+ if os.path.isdir(subsys_symlink):
+ shutil.rmtree(subsys_symlink, ignore_errors=True)
+ self.logger.info("Unlink subsystem fromn port successfully.")
+
+ if os.path.isdir(self.port_path):
+ shutil.rmtree(self.port_path, ignore_errors=True)
+
+ except Exception, err:
+ self.logger.error(str(err) + ".")
+ return False
+ self.logger.info("Removed port " + self.port_path + " successfully.")
+ return True
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 12/46] nvmftests-nvmf: add support for target subsystem
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (10 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 11/46] nvmftests-nvmf: add support for target port Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 13/46] nvmftests-nvmf: add support for target Chaitanya Kulkarni
` (35 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class to handle the target subsystem operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/nvmf/target/target_subsystem.py | 140 +++++++++++++++++++++
1 file changed, 140 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_subsystem.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/target/target_subsystem.py b/tools/testing/selftests/nvmftests/nvmf/target/target_subsystem.py
new file mode 100644
index 0000000..abaaecd
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/target/target_subsystem.py
@@ -0,0 +1,140 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe Over Fabric Target Subsystem.
+"""
+
+import os
+import shutil
+
+from utils.shell import Cmd
+from utils.const import Const
+from utils.log import Log
+from nvmf.target.target_ns import NVMFTargetNamespace
+
+
+class NVMFTargetSubsystem(object):
+ """
+ Represents a target subsystem.
+
+ - Attributes :
+ - ns_list : list of namespaces.
+ - cfgfs : configfs path.
+ - nqn : subsystem nqn.
+ - subsys_path : subsystem path in configfs.
+ - allowed_hosts : configfs allowed host attribute.
+ - attr_allow_any_host : configfs allow any host attribute.
+ """
+ def __init__(self, cfgfs, nqn, allowed_hosts, attr_allow_any_host):
+ self.ns_list = []
+ self.cfgfs = cfgfs
+ self.nqn = nqn
+ self.subsys_path = self.cfgfs + Const.SYSFS_NVMET_SUBSYS + nqn + "/"
+ self.allowed_hosts = allowed_hosts
+ self.attr_allow_any_host = attr_allow_any_host
+ self.logger = Log.get_logger(__name__, 'target_subsystem')
+ self.ns_list_index = 0
+
+ def __iter__(self):
+ self.ns_list_index = 0
+ return self
+
+ def __next__(self):
+ index = self.ns_list_index
+ self.ns_list_index += 1
+ if len(self.ns_list) > index:
+ return self.ns_list[index]
+ raise StopIteration
+
+ def next(self):
+ """ Iterator next function """
+ return self.__next__()
+
+ def init(self):
+ """ Create and initialize target subsystem.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ # create subsystem dir
+ self.logger.info("Creating subsys path " + self.subsys_path + ".")
+ try:
+ os.makedirs(self.subsys_path)
+ except Exception, err:
+ self.logger.error(str(err) + ".")
+ return False
+ # allow any host
+ self.logger.info("Configuring allowed hosts ...")
+ ret = Cmd.exec_cmd("echo " + self.attr_allow_any_host + " >" +
+ self.subsys_path + "/attr_allow_any_host")
+ if ret is False:
+ self.logger.error(self.subsys_path + " creation failed.")
+ else:
+ self.logger.info(self.subsys_path + " created successfully.")
+ return ret
+
+ def create_ns(self, **ns_attr):
+ """ Create, initialize and store namespace in subsystem's list.
+ - Args :
+ - ns_attr : namespace attributes.
+ - Returns :
+ - namespace handle on success, None on error.
+ """
+ ns_id = len(self.ns_list) + 1
+
+ ns = NVMFTargetNamespace(self.cfgfs, self.nqn, ns_id, **ns_attr)
+ if ns.init() is False:
+ return None
+ self.ns_list.append(ns)
+ return ns
+
+ def delete_ns(self, ns):
+ """ Delete single namespace.
+ - Args :
+ - ns : target namespace object to be deleted.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Deleting namespace " + self.nqn + " : " +
+ ns.ns_path + ".")
+ ret = ns.delete()
+ if ret is False:
+ self.logger.error("delete ns failed for " + ns.ns_path + ".")
+
+ return ret
+
+ def delete(self):
+ """ Delete subsystem and associated namespace(s).
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Deleting subsystem " + self.nqn)
+ ret = True
+ for ns in iter(self):
+ if self.delete_ns(ns) is False:
+ # try and continue deleting namespaces for cleanup after error
+ ret = False
+
+ if os.path.exists(self.subsys_path):
+ shutil.rmtree(self.subsys_path, ignore_errors=True)
+
+ return ret
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 13/46] nvmftests-nvmf: add support for target
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (11 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 12/46] nvmftests-nvmf: add support for target subsystem Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 14/46] nvmftests-nvmf: add target package Chaitanya Kulkarni
` (34 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class to handle the target operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/nvmf/target/target.py | 210 +++++++++++++++++++++
1 file changed, 210 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/target/target.py b/tools/testing/selftests/nvmftests/nvmf/target/target.py
new file mode 100644
index 0000000..87cae14
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/target/target.py
@@ -0,0 +1,210 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe Over Fabric Target.
+"""
+
+import sys
+import json
+from nose.tools import assert_equal
+
+from utils.shell import Cmd
+from utils.const import Const
+from utils.log import Log
+from nvmf.target.target_subsystem import NVMFTargetSubsystem
+from nvmf.target.port import NVMFTargetPort
+
+
+class NVMFTarget(object):
+
+ """
+ Represents a target subsystem.
+
+ - Attributes:
+ - subsys_list : list of the subsystem.
+ - port_list : list of the ports.
+ - target_type : target type for ports.
+ - cfgfs : configfs mount point.
+ """
+ def __init__(self, target_type):
+ self.subsys_list = []
+ self.port_list = []
+ self.target_type = target_type
+ self.cfgfs = Const.SYSFS_DEFAULT_MOUNT_PATH
+ self.logger = Log.get_logger(__name__, 'target')
+ self.subsys_list_index = 0
+
+ assert_equal(self.load_configfs(), True)
+
+ def __iter__(self):
+ self.subsys_list_index = 0
+ return self
+
+ def __next__(self):
+ index = self.subsys_list_index
+ self.subsys_list_index += 1
+ if len(self.subsys_list) > index:
+ return self.subsys_list[index]
+ raise StopIteration
+
+ def next(self):
+ """ Iterator next function """
+ return self.__next__()
+
+ def load_configfs(self):
+ """ Load configfs.
+ - Args :
+ - None.
+ -Returns :
+ - True on success, False on failure.
+ """
+ Cmd.exec_cmd("modprobe configfs")
+ ret = Cmd.exec_cmd("mountpoint -q " + self.cfgfs)
+ if ret is False:
+ ret = Cmd.exec_cmd("mount -t configfs none " + self.cfgfs)
+ if ret is False:
+ self.logger.error("failed to mount configfs.")
+ sys.exit(ret)
+ ret = Cmd.exec_cmd("mountpoint -q " + self.cfgfs)
+ if ret is True:
+ self.logger.info("Configfs mounted at " + self.cfgfs + ".")
+ else:
+ self.logger.error("unable to mount configfs at " +
+ self.cfgfs + ".")
+ return ret
+
+ def config_loop_target(self, config_file):
+ """ Configure loop target :-
+ 1. Create subsystem(s) and respective namespace(s).
+ 2. Create port(s) and linked them to respective subsystem(s).
+ 3. Create in memory configuration from JSON config file.
+ - Args :
+ - config_file : json config file path.
+ -Returns :
+ - True on success, False on failure.
+ """
+ ret = Cmd.exec_cmd("modprobe nvme-loop")
+ if ret is False:
+ self.logger.error("failed to load nvme-loop.")
+ return False
+
+ try:
+ config_file_handle = open(config_file, "r")
+ config = json.loads(config_file_handle.read())
+ config_file_handle.close()
+ except Exception, err:
+ self.logger.error(str(err) + ".")
+ return False
+
+ # Subsystem
+ for sscfg in config['subsystems']:
+ # Create Subsystem
+ subsys = NVMFTargetSubsystem(self.cfgfs,
+ sscfg['nqn'],
+ sscfg['allowed_hosts']
+ [Const.ALLOW_HOST_VALUE],
+ sscfg['attr']['allow_any_host'])
+ if subsys.init() is False:
+ return False
+
+ self.subsys_list.append(subsys)
+
+ for nscfg in sscfg['namespaces']:
+ ns_attr = {}
+ ns_attr['device_nguid'] = str(nscfg['device']['nguid'])
+ ns_attr['device_path'] = str(nscfg['device']['path'])
+ ns_attr['enable'] = str(nscfg['enable'])
+ ns_attr['nsid'] = str(nscfg['nsid'])
+ if subsys.create_ns(**ns_attr) is False:
+ return False
+
+ # Port
+ for pcfg in config['ports']:
+ port_cfg = {}
+ port_cfg['addr_treq'] = pcfg['addr']['treq']
+ port_cfg['addr_traddr'] = pcfg['addr']['traddr']
+ port_cfg['addr_trtype'] = pcfg['addr']['trtype']
+ port_cfg['addr_adrfam'] = pcfg['addr']['adrfam']
+ port_cfg['addr_trsvcid'] = pcfg['addr']['trsvcid']
+ port_cfg['portid'] = str(pcfg['portid'])
+ port_cfg['subsystems'] = pcfg['subsystems']
+
+ port = NVMFTargetPort(self.cfgfs, port_cfg['portid'], **port_cfg)
+ if port.init() is False:
+ return False
+
+ self.port_list.append(port)
+
+ for subsys in port_cfg['subsystems']:
+ ret = port.add_subsys(subsys)
+ if ret is False:
+ self.logger.error("failed to add subsystem " +
+ subsys + " to port " +
+ port.port_id + ".")
+ return False
+
+ return True
+
+ def config(self, config_file="config/loop.json"):
+ """ Wrapper for creating target configuration.
+ - Args :
+ - config_file : json config_file.
+ -Returns :
+ - True on success, False on failure.
+ """
+ if Cmd.exec_cmd("modprobe nvme") is False:
+ self.logger.error("failed to load nvme.")
+ return False
+
+ if Cmd.exec_cmd("modprobe nvmet") is False:
+ self.logger.error("unable to load nvmet module.")
+ return False
+
+ ret = False
+ if self.target_type == "loop":
+ self.logger.info("Configuring loop target ... ")
+ ret = self.config_loop_target(config_file)
+ else:
+ self.logger.error("only loop target type is supported.")
+
+ return ret
+
+ def delete(self):
+ """ Target Cleanup.
+ - Args :
+ - None.
+ -Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Cleanup is in progress ...")
+ ret = True
+ for port in self.port_list:
+ if port.delete() is False:
+ ret = False
+
+ for subsys in iter(self):
+ if subsys.delete() is False:
+ ret = False
+
+ self.logger.info("Removing Modules ...")
+ Cmd.exec_cmd("modprobe -r nvme_loop")
+ Cmd.exec_cmd("modprobe -r nvmet")
+ Cmd.exec_cmd("modprobe -r nvme_fabrics")
+ self.logger.info("DONE.")
+ return ret
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 14/46] nvmftests-nvmf: add target package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (12 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 13/46] nvmftests-nvmf: add support for target Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 15/46] nvmftests-nvmf: add support for host ns Chaitanya Kulkarni
` (33 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a support for target package. In current implementation
target package supports port, ns, subsystem and configuration
management in loop mode.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/nvmf/target/__init__.py | 25 ++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/__init__.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/target/__init__.py b/tools/testing/selftests/nvmftests/nvmf/target/__init__.py
new file mode 100644
index 0000000..66a1320
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/target/__init__.py
@@ -0,0 +1,25 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+from .target import NVMFTarget
+from .target_subsystem import NVMFTargetSubsystem
+from .target_ns import NVMFTargetNamespace
+from .port import NVMFTargetPort
+from .target_config_generator import TargetConfig
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 15/46] nvmftests-nvmf: add support for host ns
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (13 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 14/46] nvmftests-nvmf: add target package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 16/46] nvmftests-nvmf: add support for host subsystem Chaitanya Kulkarni
` (32 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class to handle the host namespace operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/nvmf/host/host_ns.py | 262 +++++++++++++++++++++
1 file changed, 262 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host_ns.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/host/host_ns.py b/tools/testing/selftests/nvmftests/nvmf/host/host_ns.py
new file mode 100644
index 0000000..42d6f6b
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/host/host_ns.py
@@ -0,0 +1,262 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe Over Fabric Host Namespace.
+"""
+
+import Queue
+import time
+import copy
+import threading
+
+from utils.fs import Ext4FS
+from utils.log import Log
+from utils.shell import Cmd
+
+
+class NVMFNSThread(threading.Thread):
+ """
+ Represents a worker thread.
+
+ - Attributes :
+ - target : thread Target.
+ - workq : workqueue shared between producer and worker thread.
+ """
+ def __init__(self, group=None, target=None, name=None,
+ args=[], kwargs=None, verbose=None):
+ """Default Thread Constructor."""
+ super(NVMFNSThread, self).__init__()
+ self.target = target
+ self.name = name
+ self.workq = args[0]
+ self.q_cond_var = args[1]
+
+ def run(self):
+ """ Default Thread Function """
+ while True:
+ with self.q_cond_var:
+ # if queue is empty wait
+ if self.workq.empty():
+ self.q_cond_var.wait()
+
+ # get the item from the queue if None exit
+ # use None as signal to exit worker queue
+ item = self.workq.get()
+ if item is None:
+ break
+
+ ret = item['THREAD'](item)
+ # On Error just shutdown the worker thread
+ # complete all the remaining operations and quit
+ if ret is False:
+ self.workq.put(None)
+
+
+class NVMFHostNamespace(object):
+ """
+ Represents a host namespace.
+
+ - Attributes :
+ - ns_dev : block device associated with this namespace.
+ - mount_path : mounted directory.
+ - worker_thread : handle for io worker thread.
+ - workq : workqueue shared between producer and worker thread.
+ - q_cond_var : condition variable for queue operations.
+ - fs_type : file system type for mkfs.
+ - fs : file system object.
+ """
+ def __init__(self, ns_dev):
+ self.ns_dev = ns_dev
+ self.mount_path = None
+ self.worker_thread = None
+ self.workq = Queue.Queue()
+ self.q_cond_var = threading.Condition()
+ self.fs_type = None
+ self.fs = None
+ self.logger = Log.get_logger(__name__, 'host_ns')
+
+ def init(self):
+ """ Create worker thread.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if self.id_ns() is False:
+ return False
+
+ # Create worker thread for this ns
+ self.worker_thread = NVMFNSThread(args=[self.workq, self.q_cond_var])
+ self.worker_thread.setDaemon(True)
+ self.worker_thread.start()
+ return True
+
+ def id_ns(self):
+ """ Wrapper for id-ns command.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ id_ns_cmd = "nvme id-ns " + self.ns_dev
+ return Cmd.exec_cmd(id_ns_cmd)
+
+ def ns_descs(self):
+ """ Wrapper for ns-descs command.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ns_descs_cmd = "nvme ns-descs " + self.ns_dev
+ return Cmd.exec_cmd(ns_descs_cmd)
+
+ def get_ns_id(self):
+ """ Wrapper for get-ns-id command.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ get_ns_id_cmd = "nvme get-ns-id " + self.ns_dev
+ return Cmd.exec_cmd(get_ns_id_cmd)
+
+ def mkfs(self, fs_type):
+ """ Format namespace with file system and mount on the unique
+ namespace directory.
+ - Args :
+ - fs_type : file system type.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if fs_type == "ext4":
+ self.fs = Ext4FS(self.ns_dev)
+ if self.fs.mkfs() is True and self.fs.mount() is True:
+ return True
+ else:
+ self.logger.error("mkfs failed for " + self.ns_dev + ".")
+ return False
+ else:
+ self.logger.error("file system is not supported.")
+
+ return False
+
+ def run_fs_ios(self, iocfg):
+ """ Run IOs on mounted file system.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if self.fs.is_mounted() is False:
+ return False
+
+ mount_path = self.fs.get_mount_path()
+ iocfg['directory'] = mount_path + "/"
+
+ if self.worker_thread.is_alive():
+ with self.q_cond_var:
+ self.workq.put(iocfg)
+ self.q_cond_var.notifyAll()
+ else:
+ self.logger.error("worker thread is not running.")
+ return False
+ return True
+
+ def start_io(self, iocfg):
+ """ Add new work IO item to workqueue and notify worker thread.
+ - Args :
+ - IO Configuration passed to worker thread.
+ - Returns :
+ - True on success, False on failure.
+ """
+ iocfg = copy.deepcopy(iocfg)
+ self.logger.info(iocfg)
+ if iocfg['IO_TYPE'] == 'dd':
+ if iocfg['IODIR'] == "read":
+ iocfg['IF'] = self.ns_dev
+ elif iocfg['IODIR'] == "write":
+ iocfg['OF'] = self.ns_dev
+ else:
+ self.logger.error("io config " + iocfg + " not supported.")
+ return False
+ elif iocfg['IO_TYPE'] == 'fio':
+ iocfg['filename'] = self.ns_dev
+ else:
+ self.logger.error("invalid IO type " + iocfg['IO_TYPE'])
+ if self.worker_thread.is_alive():
+ with self.q_cond_var:
+ self.workq.put(iocfg)
+ self.q_cond_var.notifyAll()
+ else:
+ self.logger.error("worker thread is not running.")
+ return False
+
+ return True
+
+ def wait_io(self):
+ """ Wait until queue is empty.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False otherwise.
+ """
+ self.logger.info("Checking for worker thread " + self.ns_dev + ".")
+ if self.worker_thread.is_alive():
+ self.logger.info("Waiting for thread " + self.ns_dev + ".")
+ while not self.workq.empty() and \
+ self.worker_thread.is_alive() is True:
+ # Wait till waorker thread is alive.
+ time.sleep(1)
+ else:
+ self.logger.error("worker thread is not alive")
+ return False
+ self.logger.info("# WAIT COMPLETE " + self.ns_dev + ".")
+ return True
+
+ def unmount_cleanup(self):
+ """ Unmount the namespace and cleanup the mount path.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if self.fs is not None:
+ return self.fs.umount()
+
+ return True
+
+ def delete(self):
+ """ Namespace clanup.
+ - Args :
+ - None.
+ - Returns :
+ - None.
+ """
+ self.logger.info("delete ns waiting for workq to finish all items")
+ if self.worker_thread.is_alive():
+ with self.q_cond_var:
+ self.workq.put(None)
+ self.q_cond_var.notifyAll()
+
+ while not self.workq.empty() and \
+ self.worker_thread.is_alive() is True:
+ time.sleep(1)
+
+ self.unmount_cleanup()
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 16/46] nvmftests-nvmf: add support for host subsystem
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (14 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 15/46] nvmftests-nvmf: add support for host ns Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 17/46] nvmftests-nvmf: add support for host Chaitanya Kulkarni
` (31 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class to handle the host subsystem operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/nvmf/host/host_subsystem.py | 527 +++++++++++++++++++++
1 file changed, 527 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host_subsystem.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/host/host_subsystem.py b/tools/testing/selftests/nvmftests/nvmf/host/host_subsystem.py
new file mode 100644
index 0000000..e32d952
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/host/host_subsystem.py
@@ -0,0 +1,527 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe Over Fabric Host Controller.
+"""
+
+import re
+import os
+import stat
+import time
+import random
+import string
+import subprocess
+from natsort import natsorted
+
+from utils.const import Const
+from utils.shell import Cmd
+from utils.log import Log
+from nvmf.host.host_ns import NVMFHostNamespace
+
+
+class NVMFHostController(object):
+ """
+ Represents a host controller.
+
+ - Attributes :
+ - nqn : ctrl nqn.
+ - ctrl_dev : controller device.
+ - ctrl_dict : controller attributes.
+ - ns_list : list of namespaces.
+ - ns_dev_list : namespace device list.
+ - transport : transport type.
+ """
+ def __init__(self, nqn, transport):
+ self.nqn = nqn
+ self.ctrl_dev = None
+ self.ctrl_dict = {}
+ self.ns_list = []
+ self.ns_dev_list = []
+ self.transport = transport
+ self.ns_list_index = 0
+ self.logger = Log.get_logger(__name__, 'host_subsystem')
+
+ def __iter__(self):
+ self.ns_list_index = 0
+ return self
+
+ def __next__(self):
+ index = self.ns_list_index
+ self.ns_list_index += 1
+ if (len(self.ns_list) > index):
+ return self.ns_list[index]
+ raise StopIteration
+
+ def next(self):
+ """ Iterator next function """
+ return self.__next__()
+
+ def run_io_all_ns(self, iocfg):
+ """ Start IOs on all the namespaces of this controller parallelly.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ns in iter(self):
+ try:
+ if ns.start_io(iocfg) is False:
+ self.logger.error("start IO " + ns.ns_dev + ".")
+ ret = False
+ break
+ self.logger.info("start IO " + ns.ns_dev + " SUCCESS.")
+ except StopIteration:
+ break
+
+ return ret
+
+ def wait_io_all_ns(self):
+ """ Wait until workqueue is empty.
+ - Args :
+ - None.
+ - Returns :
+ - True if namespace wait IO is successful, False otherwise.
+ """
+ for ns in iter(self):
+ try:
+ ret = ns.wait_io()
+ if ret is False:
+ return False
+ except StopIteration:
+ break
+ return True
+
+ def run_io_seq(self, iocfg):
+ """ Exercise IOs on each namespace.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ns in iter(self):
+ try:
+ if ns.start_io(iocfg) is False:
+ self.logger.error("start IO " + ns.ns_dev + ".")
+ ret = False
+ break
+ ret = ns.wait_io()
+ except StopIteration:
+ break
+ return ret
+
+ def run_mkfs_seq(self, fs_type):
+ """ Run mkfs.
+ - Args :
+ - fs_type : file system type.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ns in iter(self):
+ try:
+ if ns.mkfs(fs_type) is False:
+ ret = False
+ break
+ except StopIteration:
+ break
+ return ret
+
+ def run_fs_ios(self, iocfg):
+ """ Run IOs on mounted file system.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ns in iter(self):
+ try:
+ if ns.run_fs_ios(iocfg) is False:
+ ret = False
+ break
+ except StopIteration:
+ break
+ return ret
+
+ def run_io_random(self, iocfg):
+ """ Select the namespce randomely and wait for the IOs completion,
+ repeat this for all the namespaces.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - True on success, False on failure.
+ """
+ num_list = range(0, len(self.ns_list))
+
+ for i in range(0, len(self.ns_list)):
+ random.shuffle(num_list)
+ ns_id = num_list.pop()
+
+ host_ns = self.ns_list[ns_id]
+ if host_ns.start_io(iocfg) is False:
+ return False
+ host_ns.wait_io()
+
+ return True
+
+ def __ctrl_set_attr__(self, attr):
+ """ Set host controller attribute.
+ - Args :
+ - attr : sysfs attribute to set.
+ - Returns :
+ - True on success, False on failure.
+ """
+ sysfs_path = "/sys/class/nvme-fabrics/ctl/"
+ cmd = "echo 1 >" + sysfs_path + self.ctrl_dev.split('/')[-1] \
+ + "/" + attr
+ return Cmd.exec_cmd(cmd)
+
+ def ctrl_rescan(self):
+ """ Issue controller rescan.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ return self.__ctrl_set_attr__("rescan_controller")
+
+ def ctrl_reset(self):
+ """ Issue controller reset.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ return self.__ctrl_set_attr__("reset_controller")
+
+ def run_smart_log(self, nsid="0xFFFFFFFF"):
+ """ Wrapper for nvme smart-log command.
+ - Args :
+ - nsid : namespace id for smart log, defaults to ctrl.
+ - Returns:
+ - True on success, False on failure.
+ """
+ smart_log_cmd = "nvme smart-log " + self.ctrl_dev + " -n " + str(nsid)
+ self.logger.info(smart_log_cmd)
+ proc = subprocess.Popen(smart_log_cmd,
+ shell=True,
+ stdout=subprocess.PIPE)
+ err = proc.wait()
+ if err != 0:
+ self.logger.error("nvme smart log failed.")
+ return False
+
+ for line in proc.stdout:
+ if "data_units_read" in line:
+ temp_str = line.split(":")[Const.SMART_LOG_VALUE].strip()
+ data_units_read = string.replace(temp_str, ",", "")
+ if "data_units_written" in line:
+ temp_str = line.split(":")[Const.SMART_LOG_VALUE].strip()
+ data_units_written = string.replace(temp_str, ",", "")
+ if "host_read_commands" in line:
+ temp_str = line.split(":")[Const.SMART_LOG_VALUE].strip()
+ host_read_commands = string.replace(temp_str, ",", "")
+ if "host_write_commands" in line:
+ temp_str = line.split(":")[Const.SMART_LOG_VALUE].strip()
+ host_write_commands = string.replace(temp_str, ",", "")
+
+ self.logger.info("data_units_read " + data_units_read)
+ self.logger.info("data_units_written " + data_units_written)
+ self.logger.info("host_read_commands " + host_read_commands)
+ self.logger.info("host_write_commands " + host_write_commands)
+ return True
+
+ def smart_log(self):
+ """ Execute smart-log command.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ # Run smart log on controller
+ self.run_smart_log()
+ i = 1
+ for ns in iter(self):
+ try:
+ if self.run_smart_log(i) is False:
+ return False
+ i += 1
+ except StopIteration:
+ break
+ return True
+
+ def validate_sysfs_ns(self):
+ """ Validate sysfs entries for the host controller and namespace(s).
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ctrl_bdev = self.ctrl_dev.split("/")[Const.CTRL_BLK_FILE_NAME]
+ # Validate ctrl in the sysfs
+ cmd = "basename $(dirname $(grep -ls " + self.nqn + \
+ " /sys/class/nvme-fabrics/ctl/*/subsysnqn))"
+ proc = subprocess.Popen(cmd,
+ shell=True,
+ stdout=subprocess.PIPE)
+ for line in proc.stdout:
+ line = line.strip('\n')
+ # compare nvmeN in /dev/nvmeN in sysfs
+ if line != ctrl_bdev:
+ self.logger.error("host ctrl " + self.ctrl_dev +
+ " not present.")
+ return False
+ dir_list = os.listdir("/sys/class/nvme-fabrics/ctl/" + ctrl_bdev + "/")
+
+ pat = re.compile("^" + ctrl_bdev + "+n[0-9]+$")
+ for line in dir_list:
+ line = line.strip('\n')
+ if pat.match(line):
+ if "/dev/" + line not in self.ns_dev_list:
+ self.logger.error("ns " + line + " not found in sysfs.")
+ return False
+
+ self.logger.info("sysfs entries for ctrl and ns created successfully.")
+ return True
+
+ def build_ns_list(self):
+ """ Generate next available controller and namespace id on the fly.
+ Build the ns list for this controller.
+ - Args :
+ - None.
+ - Returns :
+ - ctrl and ns list on success, None on failure.
+ """
+ ctrl = Const.XXX
+ ns_list = []
+ try:
+ dev_list = os.listdir("/dev/")
+ except Exception, err:
+ self.logger.error(str(err) + ".")
+ return None, None
+ dev_list = natsorted(dev_list, key=lambda y: y.lower())
+ # we assume that atleast one namespace is created on target
+ # find ctrl
+ pat = re.compile("^nvme[0-9]+$")
+ for line in dev_list:
+ line = line.strip('\n')
+ if pat.match(line):
+ ctrl = line
+
+ if ctrl == Const.XXX:
+ self.logger.error("controller '/dev/nvme*' not found.")
+ return None, None
+ # allow namespaces to appear in the /dev/
+ time.sleep(2)
+ # find namespace(s) associated with ctrl
+ try:
+ dir_list = os.listdir("/dev/")
+ except Exception, err:
+ self.logger.error(str(err))
+ return None, None
+ pat = re.compile("^" + ctrl + "+n[0-9]+$")
+ for line in dir_list:
+ line = line.strip('\n')
+ if pat.match(line):
+ self.logger.info("Generated namespace name /dev/" + line + ".")
+ ns_list.append("/dev/" + line)
+
+ if len(ns_list) == 0:
+ self.logger.error("host ns not found for ctrl " + ctrl + ".")
+ return None, None
+
+ ctrl = "/dev/" + ctrl
+ return ctrl, ns_list
+
+ def init_ns(self):
+ """ Initialize and build namespace list and validate sysfs entries.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Expecting following namespaces " +
+ str(self.ns_dev_list) + ".")
+ for ns_dev in self.ns_dev_list:
+ if not stat.S_ISBLK(os.stat(ns_dev).st_mode):
+ self.logger.error("expected block dev " + ns_dev + ".")
+ return False
+
+ self.logger.info("Found NS " + ns_dev + ".")
+ host_ns = NVMFHostNamespace(ns_dev)
+ host_ns.init()
+ self.ns_list.append(host_ns)
+ # allow sysfs entries to populate
+ time.sleep(1)
+ if self.validate_sysfs_ns() is False:
+ self.logger.error("unable to verify sysfs entries.")
+ return False
+ self.logger.info("Host sysfs entries are validated.")
+ return True
+
+ def validate_fabric_ctrl(self):
+ """ Validate this is a fabric controller.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+
+ if not stat.S_ISCHR(os.stat(self.ctrl_dev).st_mode):
+ self.logger.error("failed to find char device for host ctrl.")
+
+ cmd = "find /sys/devices -name " + self.ctrl_dev.split("/")[-2] \
+ + " | grep nvme-fabric"
+ self.logger.info(cmd)
+ return Cmd.exec_cmd(cmd)
+
+ def init_ctrl(self):
+ """ Initialize controller and build controller attributes.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ # initialize nqn and transport
+ cmd = "echo \"transport=" + self.transport + ",nqn=" + \
+ self.nqn + "\" > /dev/nvme-fabrics"
+ self.logger.info("Host Connect command : " + cmd)
+ if Cmd.exec_cmd(cmd) is False:
+ self.logger.info("ERROR : host connect command failed")
+ return False
+ self.ctrl_dev, self.ns_dev_list = self.build_ns_list()
+
+ if self.validate_fabric_ctrl() is False or self.id_ctrl() is False:
+ return False
+
+ return self.init_ns()
+
+ def id_ctrl(self):
+ """ Wrapper for executing id-ctrl command.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ id_ctrl_cmd = "nvme id-ctrl " + self.ctrl_dev
+ proc = subprocess.Popen(id_ctrl_cmd,
+ shell=True,
+ stdout=subprocess.PIPE)
+ err = proc.wait()
+ if err != 0:
+ self.logger.error("nvme id-ctrl failed.")
+ return False
+
+ for line in proc.stdout:
+ if line.startswith('subnqn') or \
+ line.startswith('NVME Identify Controller'):
+ continue
+ if line.startswith('ps ') or line.strip().startswith('rwt'):
+ continue
+ key, val = line.split(':')
+ self.ctrl_dict[key.strip()] = val.strip()
+
+ self.logger.info("ID controller :- ")
+ self.logger.info(self.ctrl_dict)
+ return True
+
+ def id_ns(self):
+ """ Wrapper for executing id-ns command on all namespaces of this
+ controller.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ for host_ns in iter(self):
+ if host_ns.id_ns() is False:
+ return False
+ return True
+
+ def ns_descs(self):
+ """ Wrapper for executing ns_descs command on all namespaces of this
+ controller.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ for host_ns in iter(self):
+ if host_ns.ns_descs() is False:
+ return False
+ return True
+
+ def get_ns_id(self):
+ """ Wrapper for executing get-ns-id command on all namespaces of this
+ controller.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ for host_ns in iter(self):
+ if host_ns.get_ns_id() is False:
+ return False
+ return True
+
+ def generate_next_ns_id(self):
+ """ Return next namespace id.
+ - Args :
+ - None.
+ - Returns :
+ - next namespace id.
+ """
+ return len(self.ns_list) + 1
+
+ def delete(self):
+ """ Delete subsystem and associated namespace(s).
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Deleting subsystem " + self.nqn + ".")
+ for host_ns in self.ns_list:
+ host_ns.delete()
+ cmd = "dirname $(grep -ls " + self.nqn + \
+ " /sys/class/nvme-fabrics/ctl/*/subsysnqn)"
+ try:
+ proc = subprocess.Popen(cmd,
+ shell=True,
+ stdout=subprocess.PIPE)
+ for line in proc.stdout:
+ line = line.strip('\n')
+ if not os.path.isdir(line):
+ self.logger.error("host ctrl dir " + self.nqn +
+ " not present.")
+ return False
+ cmd = "nvme disconnect -n " + self.nqn
+ self.logger.info("disconnecting : " + cmd)
+ ret = Cmd.exec_cmd(cmd)
+ if ret is False:
+ self.logger.error("failed to delete ctrl " +
+ self.nqn + ".")
+ return False
+ except Exception, err:
+ self.logger.error(str(err) + ".")
+ return False
+
+ return True
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 17/46] nvmftests-nvmf: add support for host
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (15 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 16/46] nvmftests-nvmf: add support for host subsystem Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 18/46] nvmftests-nvmf: add host package Chaitanya Kulkarni
` (30 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new class to handle the host operations.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../testing/selftests/nvmftests/nvmf/host/host.py | 365 +++++++++++++++++++++
1 file changed, 365 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/host/host.py b/tools/testing/selftests/nvmftests/nvmf/host/host.py
new file mode 100644
index 0000000..d14fb77
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/host/host.py
@@ -0,0 +1,365 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Represents NVMe Over Fabric Host Subsystem.
+"""
+
+import json
+import random
+from nose.tools import assert_equal
+
+from utils.shell import Cmd
+from utils.log import Log
+from nvmf.host.host_subsystem import NVMFHostController
+
+
+class NVMFHost(object):
+
+ """
+ Represents a host.
+
+ - Attributes :
+ - target_type : rdma/loop/fc. (only loop supported now)
+ - ctrl_list : list of the host controllers.
+ """
+ def __init__(self, target_type):
+ self.target_type = target_type
+ self.ctrl_list = []
+ self.ctrl_list_index = 0
+ self.logger = Log.get_logger(__name__, 'host')
+ assert_equal(self.load_modules(), True)
+
+ def __iter__(self):
+ self.ctrl_list_index = 0
+ return self
+
+ def __next__(self):
+ index = self.ctrl_list_index
+ self.ctrl_list_index += 1
+ if len(self.ctrl_list) > index:
+ return self.ctrl_list[index]
+ raise StopIteration
+
+ def next(self):
+ """ Iterator next function """
+ return self.__next__()
+
+ def load_modules(self):
+ """ Wrapper for Loading NVMF Host modules.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ if Cmd.exec_cmd("modprobe nvme-fabrics") is False:
+ self.logger.error("unable to load nvme-fabrics.")
+ return False
+ return True
+
+ def config_loop(self, config_file):
+ """ Configure host for loop target :-
+ 1. Load config from json file.
+ 2. Create Controller list.
+ - Args :
+ - config_file : json config file.
+ -Returns :
+ - True on success, False on failure.
+ """
+ try:
+ config_file_handle = open(config_file, "r")
+ config = json.loads(config_file_handle.read())
+ config_file_handle.close()
+ except Exception, err:
+ self.logger.error(str(err) + ".")
+ return False
+
+ for sscfg in config['subsystems']:
+ ctrl = NVMFHostController(sscfg['nqn'], "loop")
+ if ctrl.init_ctrl()is False:
+ self.logger.error("ctrl init " + str(ctrl.ctrl_dev) + ".")
+ return False
+ self.ctrl_list.append(ctrl)
+ return True
+
+ def run_traffic_parallel(self, iocfg):
+ """ Run parallel IO traffic on all host controller(s) and
+ wait for completion.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - None.
+ """
+ ret = True
+ self.logger.info("Starting traffic parallelly on all controllers ...")
+ for ctrl in iter(self):
+ if ctrl.run_io_all_ns(iocfg) is False:
+ ret = False
+ return ret
+
+ def wait_traffic_parallel(self):
+ """ Wait for IOs completion on all controllers.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - None.
+ """
+ ret = True
+ self.logger.info("Waiting for all threads to finish the IOs ...")
+ for ctrl in iter(self):
+ if ctrl.wait_io_all_ns() is False:
+ self.logger.error("wait on " + ctrl.ctrl_dev + ".")
+ ret = False
+
+ return ret
+
+ def run_ios_parallel(self, iocfg):
+ """ Run parallel IOs on all host controller(s) and
+ wait for completion.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - None.
+ """
+ if self.run_traffic_parallel(iocfg) is False:
+ return False
+
+ if self.wait_traffic_parallel() is False:
+ return False
+
+ return True
+
+ def run_perf_parallel(self, iocfg):
+ """ Run parallel IO traffic on all host controller(s) and
+ wait for completion.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - None.
+ """
+ if self.run_ios_parallel(iocfg) is False:
+ return False
+
+ # add perf report generation mechanism here
+
+ return True
+
+ def run_ios_seq(self, iocfg):
+ """ Run IOs on all host controllers sequentially.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - True on success, False on failure.
+ """
+ self.logger.info("Starting IOs seq ...")
+ ret = True
+ for ctrl in iter(self):
+ try:
+ if ctrl.run_io_seq(iocfg) is False:
+ ret = False
+ break
+ except StopIteration:
+ break
+ return ret
+
+ def run_ios_random(self, iocfg):
+ """ Select a controller from the list of controllers
+ randomly and run IOs. Exhaust entire list.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - None.
+ """
+ ctrl_list = range(0, len(self.ctrl_list))
+
+ ret = True
+ for i in range(0, len(self.ctrl_list)):
+ random.shuffle(ctrl_list)
+ ctrl_id = ctrl_list.pop()
+ ctrl = self.ctrl_list[ctrl_id]
+ if ctrl.run_io_random(iocfg) is False:
+ ret = False
+ break
+ return ret
+
+ def ctrl_rescan(self):
+ """ Run controller_rescan on all host controllers sequentially.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ try:
+ if ctrl.ctrl_rescan() is False:
+ ret = False
+ break
+ except StopIteration:
+ break
+ return ret
+
+ def ctrl_reset(self):
+ """ Run controller_reset on all host controllers sequentially.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ try:
+ if ctrl.ctrl_reset() is False:
+ ret = False
+ break
+ except StopIteration:
+ break
+ return ret
+
+ def smart_log(self):
+ """ Execute smart log.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ if ctrl.smart_log() is False:
+ ret = False
+ break
+ return ret
+
+ def id_ctrl(self):
+ """ Execute id-ctrl on all the controllers(s).
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ if ctrl.id_ctrl() is False:
+ ret = False
+ break
+ return ret
+
+ def id_ns(self):
+ """ Execute id-ns on controller(s) and all its namespace(s).
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ if ctrl.id_ns() is False:
+ ret = False
+ break
+ return ret
+
+ def ns_descs(self):
+ """ Execute ns-descs on all namespace(s).
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ if ctrl.ns_descs() is False:
+ ret = False
+ break
+ return ret
+
+ def get_ns_id(self):
+ """ Execute get-ns-id on all namespace(s).
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ if ctrl.get_ns_id() is False:
+ ret = False
+ break
+ return ret
+
+ def mkfs_seq(self, fs_type):
+ """ Run mkfs, mount fs and run IOs.
+ - Args :
+ - fs_type : file system type.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ try:
+ if ctrl.run_mkfs_seq(fs_type) is False:
+ ret = False
+ break
+ except StopIteration:
+ break
+ return ret
+
+ def run_fs_ios(self, iocfg):
+ """ Run IOs on mounted file system.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for ctrl in iter(self):
+ try:
+ if ctrl.run_fs_ios(iocfg) is False:
+ ret = False
+ break
+ except StopIteration:
+ break
+ return ret
+
+ def config(self, config_file="config/loop.json"):
+ """ Configure Host based on the target transport.
+ - Args :
+ - config_file : JSON config.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = False
+ if self.target_type == "loop":
+ self.logger.info("Configuring loop host")
+ ret = self.config_loop(config_file)
+ self.logger.info("Host configure successfully")
+ else:
+ self.logger.error("only loop target type is supported.")
+ return ret
+
+ def delete(self):
+ """ Delete all the Host Controllers.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ ret = True
+ for subsys in iter(self):
+ if subsys.delete() is False:
+ ret = False
+ return ret
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 18/46] nvmftests-nvmf: add host package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (16 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 17/46] nvmftests-nvmf: add support for host Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 19/46] nvmftests-nvmf: add nvmf core package Chaitanya Kulkarni
` (29 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a support for host package. In current implementation
host package supports ns, subsystem and configuration
management in loop mode.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/nvmf/host/__init__.py | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/__init__.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/host/__init__.py b/tools/testing/selftests/nvmftests/nvmf/host/__init__.py
new file mode 100644
index 0000000..10a2e4ee
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/host/__init__.py
@@ -0,0 +1,23 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+from .host import NVMFHost
+from .host_subsystem import NVMFHostController
+from .host_ns import NVMFHostNamespace
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 19/46] nvmftests-nvmf: add nvmf core package
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (17 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 18/46] nvmftests-nvmf: add host package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 20/46] nvmftests-tests: add user config file Chaitanya Kulkarni
` (28 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
tools/testing/selftests/nvmftests/nvmf/__init__.py | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/nvmf/__init__.py
diff --git a/tools/testing/selftests/nvmftests/nvmf/__init__.py b/tools/testing/selftests/nvmftests/nvmf/__init__.py
new file mode 100644
index 0000000..57c3985
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/nvmf/__init__.py
@@ -0,0 +1,28 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+from .host import NVMFHost
+from .host import NVMFHostController
+from .host import NVMFHostNamespace
+
+from .target import NVMFTarget
+from .target import NVMFTargetSubsystem
+from .target import NVMFTargetNamespace
+from .target import NVMFTargetPort
+from .target import TargetConfig
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 20/46] nvmftests-tests: add user config file
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (18 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 19/46] nvmftests-nvmf: add nvmf core package Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 21/46] nvmftests-tests: add support for test logger Chaitanya Kulkarni
` (27 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a centralized config file which can be used to
specify different parameters for the execution of the test.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/config/nvmftests.json | 83 ++++++++++++++++++++++
1 file changed, 83 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/config/nvmftests.json
diff --git a/tools/testing/selftests/nvmftests/tests/config/nvmftests.json b/tools/testing/selftests/nvmftests/tests/config/nvmftests.json
new file mode 100644
index 0000000..7dccdad
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/config/nvmftests.json
@@ -0,0 +1,83 @@
+{
+ "mount_path" : "/mnt/",
+ "data_size" : "128MB",
+ "block_size" : "4KB",
+ "nr_dev" : "5",
+ "nr_target_subsys" : "1",
+ "nr_ns_per_subsys" : "1",
+ "target_config_file" : "loop.json",
+ "target_type" : "loop",
+ "fio_read": {
+ "IO_TYPE": "fio",
+ "group_reporting": "1",
+ "rw": "randread",
+ "bs": "4k",
+ "numjobs": "4",
+ "iodepth": "8",
+ "runtime": "30",
+ "loop": "1",
+ "ioengine": "libaio",
+ "direct": "1",
+ "invalidate": "1",
+ "randrepeat": "1",
+ "size": "100M",
+ "filename": "XXX",
+ "name": "test1",
+ "THREAD": "XXX",
+ "RC": "0"
+ },
+ "fio_fs_write": {
+ "IO_TYPE": "fio",
+ "group_reporting": "1",
+ "rw": "randwrite",
+ "bs": "4k",
+ "numjobs": "4",
+ "iodepth": "8",
+ "runtime": "30",
+ "loop": "1",
+ "ioengine": "libaio",
+ "direct": "1",
+ "invalidate": "1",
+ "randrepeat": "1",
+ "size": "10M",
+ "directory": "XXX",
+ "name": "test1",
+ "THREAD": "XXX",
+ "RC": "0"
+ },
+ "dd_read": {
+ "IO_TYPE": "dd",
+ "IODIR": "read",
+ "THREAD": "XXX",
+ "IF": "XXX",
+ "OF": "/dev/null",
+ "BS": "4K",
+ "COUNT": "XXX",
+ "RC": "0"
+ },
+ "dd_write": {
+ "IO_TYPE": "dd",
+ "IODIR": "write",
+ "THREAD": "XXX",
+ "IF": "/dev/zero",
+ "OF": "XXX",
+ "BS": "4K",
+ "COUNT": "XXX",
+ "RC": "0"
+ },
+ "block_dev_pool": [
+ "/dev/nvme0n1"
+ ],
+ "log": {
+ "host" : "DEBUG",
+ "host_subsystem" : "DEBUG",
+ "host_ns" : "DEBUG",
+ "target" : "DEBUG",
+ "target_subsystem" : "DEBUG",
+ "target_ns" : "DEBUG",
+ "port" : "DEBUG",
+ "nvme_pci": "DEBUG",
+ "loopback": "DEBUG",
+ "gen_blk": "DEBUG"
+ }
+}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 21/46] nvmftests-tests: add support for test logger
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (19 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 20/46] nvmftests-tests: add user config file Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 22/46] nvmftests-tests: add a parent class for tests Chaitanya Kulkarni
` (26 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds support to store hierarchical logs for each execution.
Each test will use its unique class name under which this will
store all the logs.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/tests/nvmf_test_logger.py | 50 ++++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/nvmf_test_logger.py
diff --git a/tools/testing/selftests/nvmftests/tests/nvmf_test_logger.py b/tools/testing/selftests/nvmftests/tests/nvmf_test_logger.py
new file mode 100644
index 0000000..16230f8
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/nvmf_test_logger.py
@@ -0,0 +1,50 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""Logger for NVMe Test Framwwork.
+"""
+import sys
+
+
+class NVMFLogger(object):
+ """ Represents Logger for NVMe Testframework. """
+ def __init__(self, log_file_path):
+ """ Logger setup.
+ - Args :
+ - log_file_path : path to store the log.
+ """
+ self.terminal = sys.stdout
+ self.log = open(log_file_path, "w")
+
+ def write(self, log_message):
+ """ Logger write.
+ - Args :
+ - log_message : string to write in the log file.
+ - Returns:
+ - None.
+ """
+ self.terminal.write(log_message)
+ self.log.write(log_message)
+
+ def flush(self):
+ """ This flush method is needed for python 3 compatibility.
+ this handles the flush command by doing nothing.
+ you might want to specify some extra behavior here.
+ """
+ pass
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 22/46] nvmftests-tests: add a parent class for tests
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (20 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 21/46] nvmftests-tests: add support for test logger Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 23/46] nvmftests-tests: add a test for generic block device Chaitanya Kulkarni
` (25 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a parent class for tests. Each test should inherit this
class and use common code present in the base class if possible.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../testing/selftests/nvmftests/tests/nvmf_test.py | 204 +++++++++++++++++++++
1 file changed, 204 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/nvmf_test.py
diff --git a/tools/testing/selftests/nvmftests/tests/nvmf_test.py b/tools/testing/selftests/nvmftests/tests/nvmf_test.py
new file mode 100644
index 0000000..e1c155e
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/nvmf_test.py
@@ -0,0 +1,204 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+""" Base Class for all NVMF testcases.
+"""
+
+import os
+import sys
+import json
+from nose.tools import assert_equal
+
+from utils.const import Const
+from utils.diskio import DD
+from utils.diskio import FIO
+from nvmf.target import NVMFTarget
+from nvmf.host import NVMFHost
+from nvmf.target.target_config_generator import TargetConfig
+from nvmf_test_logger import NVMFLogger
+
+
+def __dd_worker__(iocfg):
+ """ dd worker thread function.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - Return value of dd command.
+ """
+ return DD.run_io(iocfg)
+
+
+def __fio_worker__(iocfg):
+ """ fio worker thread function.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - Return value of fio command.
+ """
+ return FIO.run_io(iocfg)
+
+
+class NVMFTest(object):
+
+ """ Common attributes for all testcases """
+
+ def __init__(self):
+ # TODO : make this dictionary
+ self.config_file = 'config/nvmftests.json'
+ self.data_size = 0
+ self.block_size = 0
+ self.nr_dev = 0
+ self.mount_path = Const.XXX
+ self.test_log_dir = Const.XXX
+ self.nr_dev = 0
+ self.nr_target_subsys = 0
+ self.nr_ns_per_subsys = 0
+ self.target_config_file = Const.XXX
+ self.target_type = Const.XXX
+ self.loopdev = None
+ self.host_subsys = None
+ self.target_subsys = None
+ self.log_dir = './logs/' + self.__class__.__name__ + '/'
+ self.err_str = "ERROR : " + self.__class__.__name__ + " : "
+ self.fio_read = {}
+ self.fio_fs_write = {}
+ self.dd_read = {}
+ self.dd_write = {}
+ self.blk_dev_pool = []
+
+ self.load_config()
+
+ def build_target_config(self, dev_list):
+ """ Generates target config file in JSON format from test config file.
+ - Args :
+ - None.
+ - Returns :
+ - None.
+ """
+ with open(self.config_file) as cfg_file:
+ cfg = json.load(cfg_file)
+ # target subsystem and namespsce config
+ self.nr_dev = int(cfg['nr_dev'])
+ self.nr_target_subsys = int(cfg['nr_target_subsys'])
+ self.nr_ns_per_subsys = int(cfg['nr_ns_per_subsys'])
+ self.target_config_file = cfg['target_config_file']
+ target_cfg = TargetConfig(self.target_config_file,
+ self.nr_target_subsys,
+ self.nr_ns_per_subsys,
+ dev_list)
+ target_cfg.build_target_subsys()
+
+ def load_config(self):
+ """ Load basic test configuration.
+ - Args :
+ - None.
+ - Returns :
+ - True on success, False on failure.
+ """
+ with open(self.config_file) as nvmftest_config:
+ cfg = json.load(nvmftest_config)
+ self.mount_path = cfg['mount_path']
+ self.data_size = self.human_to_bytes(cfg['data_size'])
+ self.block_size = self.human_to_bytes(cfg['block_size'])
+ self.nr_dev = int(cfg['nr_dev'])
+ # fio device read
+ self.fio_read = cfg['fio_read']
+ self.fio_read['filename'] = Const.XXX
+ self.fio_read['THREAD'] = __fio_worker__
+ self.fio_read['RC'] = 0
+ # fio file system write
+ self.fio_fs_write = cfg['fio_fs_write']
+ self.fio_fs_write['directory'] = Const.XXX
+ self.fio_fs_write['THREAD'] = __fio_worker__
+ self.fio_fs_write['RC'] = 0
+ # dd write
+ self.dd_read = cfg['dd_read']
+ self.dd_read['THREAD'] = __dd_worker__
+ self.dd_read['IF'] = None
+ self.dd_read['COUNT'] = str(self.data_size / self.block_size)
+ self.dd_read['RC'] = 0
+ # dd read
+ self.dd_write = cfg['dd_write']
+ self.dd_write['THREAD'] = __dd_worker__
+ self.dd_write['OF'] = None
+ self.dd_write['COUNT'] = str(self.data_size / self.block_size)
+ self.dd_write['RC'] = 0
+
+ self.target_type = cfg['target_type']
+ # block_dev_pool
+ self.blk_dev_pool = cfg['block_dev_pool']
+ return True
+ return False
+
+ def human_to_bytes(self, num_str):
+ """ Converts human readble format to bytes.
+ Args :
+ - num_str : human readble string.
+ Returns :
+ - On success decimal equivalant of num_str, 0 on failure.
+ """
+ decimal_bytes = 0
+ num_suffix = str(num_str[-2:]).upper()
+ if num_suffix == Const.KB:
+ decimal_bytes = int(num_str.split("K")[0]) * Const.ONE_KB
+ elif num_suffix == Const.MB:
+ decimal_bytes = int(num_str.split("M")[0]) * Const.ONE_MB
+ elif num_suffix == Const.GB:
+ decimal_bytes = int(num_str.split("G")[0]) * Const.ONE_GB
+ else:
+ print(self.err_str + "invalid suffix " + num_str)
+
+ return decimal_bytes
+
+ def setup_log_dir(self, test_name):
+ """ Set up the log directory for a testcase.
+ Args :
+ - test_name : name of the testcase.
+ Returns :
+ - None.
+ """
+ self.test_log_dir = self.log_dir + "/" + test_name
+ if not os.path.exists(self.test_log_dir):
+ os.makedirs(self.test_log_dir)
+ sys.stdout = NVMFLogger(self.test_log_dir + "/" + "stdout.log")
+ sys.stderr = NVMFLogger(self.test_log_dir + "/" + "stderr.log")
+
+ def common_setup(self):
+ """ Common test case setup function.
+ Args :
+ - None.
+ Returns :
+ - None.
+ """
+ self.target_subsys = NVMFTarget(self.target_type)
+ ret = self.target_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : target config failed")
+ self.host_subsys = NVMFHost(self.target_type)
+ ret = self.host_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : host config failed")
+
+ def common_tear_down(self):
+ """ Common test case tear down function.
+ Args :
+ - None.
+ Returns :
+ - None.
+ """
+ self.host_subsys.delete()
+ self.target_subsys.delete()
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 23/46] nvmftests-tests: add a test for generic block device
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (21 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 22/46] nvmftests-tests: add a parent class for tests Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 24/46] nvmftests-tests: add a test for ns-descs Chaitanya Kulkarni
` (24 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new testcase to create target and host, on the
target side it uses generic block device.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_create_gen_blk.py | 71 ++++++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_gen_blk.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_create_gen_blk.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_create_gen_blk.py
new file mode 100644
index 0000000..7ee4eab
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_create_gen_blk.py
@@ -0,0 +1,71 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF Create/Delete Host using generic block device :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Delete Host.
+ 4. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.generic_blk_dev import GenBlk
+from nvmf_test import NVMFTest
+from nvmf.target import NVMFTarget
+from nvmf.host import NVMFHost
+
+
+class TestNVMFCreateGenBlk(NVMFTest):
+
+ """ Represents Host Creation testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.host_subsys = None
+ self.target_subsys = None
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.gendev = GenBlk(len(self.blk_dev_pool))
+ self.gendev.init(self.blk_dev_pool)
+
+ self.build_target_config(self.gendev.dev_list)
+
+ self.target_subsys = NVMFTarget(self.target_type)
+ ret = self.target_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : target config failed")
+
+ self.host_subsys = NVMFHost(self.target_type)
+
+ def tearDown(self):
+ """ Post section of testcase """
+ self.host_subsys.delete()
+ self.target_subsys.delete()
+
+ def test_create_gen_blk(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : host config failed")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 24/46] nvmftests-tests: add a test for ns-descs
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (22 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 23/46] nvmftests-tests: add a test for generic block device Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 25/46] nvmftests-tests: add a test for create/delete host Chaitanya Kulkarni
` (23 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test for namespace identification
descriptors command.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_ns_descs.py | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ns_descs.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_ns_descs.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_ns_descs.py
new file mode 100644
index 0000000..3f3d04f
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_ns_descs.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test ns-descs on each controller :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Execute ns-descs.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFNsDescs(NVMFTest):
+
+ """ Represents Identify Controller testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFNsDescs, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFNsDescs, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_ns_descs(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.ns_descs()
+ assert_equal(ret, True, "ERROR : id controller failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 25/46] nvmftests-tests: add a test for create/delete host
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (23 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 24/46] nvmftests-tests: add a test for ns-descs Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 26/46] nvmftests-tests: add a test for NVMe PCIe target ns Chaitanya Kulkarni
` (22 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to create and delete host with loopback
device.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_create_host.py | 71 ++++++++++++++++++++++
1 file changed, 71 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_host.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_create_host.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_create_host.py
new file mode 100644
index 0000000..1f69535
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_create_host.py
@@ -0,0 +1,71 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF Create/Delete Host :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Delete Host.
+ 4. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+from nvmf.target import NVMFTarget
+from nvmf.host import NVMFHost
+
+
+class TestNVMFCreateHost(NVMFTest):
+
+ """ Represents Host Creation testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.host_subsys = None
+ self.target_subsys = None
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ self.target_subsys = NVMFTarget(self.target_type)
+ ret = self.target_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : target config failed")
+ self.host_subsys = NVMFHost(self.target_type)
+
+ def tearDown(self):
+ """ Post section of testcase """
+ self.host_subsys.delete()
+ self.target_subsys.delete()
+ self.loopdev.delete()
+
+ def test_create_host(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : host config failed")
+ raw_input("Press enter to continue ...")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 26/46] nvmftests-tests: add a test for NVMe PCIe target ns
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (24 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 25/46] nvmftests-tests: add a test for create/delete host Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 27/46] nvmftests-tests: add a test to create and delete target Chaitanya Kulkarni
` (21 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to create and delete host with NVMe
PCIe block device on the target side.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_create_pci_target.py | 70 ++++++++++++++++++++++
1 file changed, 70 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_pci_target.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_create_pci_target.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_create_pci_target.py
new file mode 100644
index 0000000..f1a8a5f
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_create_pci_target.py
@@ -0,0 +1,70 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF Create/Delete Host with PCIe device on target namespace :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Delete Host.
+ 4. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.nvme_pci import NVMePCIeBlk
+from nvmf_test import NVMFTest
+from nvmf.target import NVMFTarget
+from nvmf.host import NVMFHost
+
+
+class TestNVMFCreatePCIeTarget(NVMFTest):
+
+ """ Represents Host Creation testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.host_subsys = None
+ self.target_subsys = None
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.nvme_pci = NVMePCIeBlk()
+ self.nvme_pci.init()
+ self.build_target_config(self.nvme_pci.dev_list)
+ self.target_subsys = NVMFTarget(self.target_type)
+ ret = self.target_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : target config failed")
+ self.host_subsys = NVMFHost(self.target_type)
+
+ def tearDown(self):
+ """ Post section of testcase """
+ self.host_subsys.delete()
+ self.target_subsys.delete()
+ self.nvme_pci.delete()
+
+ def test_create_pci_target(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : host config failed")
+ raw_input("Press enter to continue ...")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 27/46] nvmftests-tests: add a test to create and delete target
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (25 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 26/46] nvmftests-tests: add a test for NVMe PCIe target ns Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 28/46] nvmftests-tests: add a test for controller rescan Chaitanya Kulkarni
` (20 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to create and delete target with loopback
device.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_create_target.py | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_target.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_create_target.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_create_target.py
new file mode 100644
index 0000000..4f2497c
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_create_target.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF Create/Delete Target :-
+
+ 1. From the config file create Target.
+ 2. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+from nvmf.target import NVMFTarget
+
+
+class TestNVMFCreateTarget(NVMFTest):
+
+ """ Represents Create Target testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.target_subsys = None
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ self.target_subsys = NVMFTarget(self.target_type)
+
+ def tearDown(self):
+ """ Post section of testcase """
+ self.target_subsys.delete()
+ self.loopdev.delete()
+
+ def test_create_target(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.target_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : config target failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 28/46] nvmftests-tests: add a test for controller rescan
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (26 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 27/46] nvmftests-tests: add a test to create and delete target Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 29/46] nvmftests-tests: add a test for controller reset Chaitanya Kulkarni
` (19 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to execute controller rescan command
from host.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_ctrl_rescan.py | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_rescan.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_rescan.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_rescan.py
new file mode 100644
index 0000000..f75f443
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_rescan.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF host controller rescan :-
+
+ 1. From config file create Target.
+ 2. From config file create host and connect to target.
+ 3. Call controller rescan on each host controller.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFCtrlRescan(NVMFTest):
+
+ """ Represents host controller rescan testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFCtrlRescan, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFCtrlRescan, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_ctrl_rescan(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.ctrl_rescan()
+ assert_equal(ret, True, "ERROR : ctrl rescan failed")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 29/46] nvmftests-tests: add a test for controller reset
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (27 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 28/46] nvmftests-tests: add a test for controller rescan Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 30/46] nvmftests-tests: add a test for get-ns-id Chaitanya Kulkarni
` (18 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to execute controller reset command
from host.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_ctrl_reset.py | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_reset.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_reset.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_reset.py
new file mode 100644
index 0000000..acad21c
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_reset.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF host controller reset :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Call controller reset on each host controller.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFCtrlReset(NVMFTest):
+
+ """ Represents host controller reset testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFCtrlReset, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFCtrlReset, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_ctrl_reset(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.ctrl_reset()
+ assert_equal(ret, True, "ERROR : ctrl reset failed")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 30/46] nvmftests-tests: add a test for get-ns-id
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (28 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 29/46] nvmftests-tests: add a test for controller reset Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 31/46] nvmftests-tests: add a test for identify controller Chaitanya Kulkarni
` (17 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to execute get-ns-id command
from host.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_get_ns_id.py | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_get_ns_id.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_get_ns_id.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_get_ns_id.py
new file mode 100644
index 0000000..9e49a08
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_get_ns_id.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test get-ns-id on each controller :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Execute get-ns-id on all controllers.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFGetNsId(NVMFTest):
+
+ """ Represents Identify Controller testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFGetNsId, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFGetNsId, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_get_nsid(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.get_ns_id()
+ assert_equal(ret, True, "ERROR : id controller failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 31/46] nvmftests-tests: add a test for identify controller
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (29 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 30/46] nvmftests-tests: add a test for get-ns-id Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 32/46] nvmftests-tests: add a test for identify namespace Chaitanya Kulkarni
` (16 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to execute identify controller command
from host.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/tests/test_nvmf_id_ctrl.py | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_id_ctrl.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_id_ctrl.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_id_ctrl.py
new file mode 100644
index 0000000..37acd76
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_id_ctrl.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test id-ctrl on each controller :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Execute id-ctrl on all controllers.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFIdentifyController(NVMFTest):
+
+ """ Represents Identify Controller testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFIdentifyController, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFIdentifyController, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_identify_controller(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.id_ctrl()
+ assert_equal(ret, True, "ERROR : id controller failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 32/46] nvmftests-tests: add a test for identify namespace
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (30 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 31/46] nvmftests-tests: add a test for identify controller Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 33/46] nvmftests-tests: add a test for smart-log Chaitanya Kulkarni
` (15 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to execute identify namespace command
from host.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/tests/test_nvmf_id_ns.py | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_id_ns.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_id_ns.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_id_ns.py
new file mode 100644
index 0000000..365bcad
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_id_ns.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test id-ns on each namespace :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Execute id-ns.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFIdentifyNamespace(NVMFTest):
+
+ """ Represents Identify Namespace Test testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFIdentifyNamespace, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFIdentifyNamespace, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_identify_namespace(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.id_ns()
+ assert_equal(ret, True, "ERROR : id ns failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 33/46] nvmftests-tests: add a test for smart-log
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (31 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 32/46] nvmftests-tests: add a test for identify namespace Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 34/46] nvmftests-tests: add a test to run IOs with dd Chaitanya Kulkarni
` (14 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to execute smart-log command
from host.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_smart_log.py | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_smart_log.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_smart_log.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_smart_log.py
new file mode 100644
index 0000000..952ca04
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_smart_log.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test smart log on all controllers :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Execute smart-log on all controllers and its namespaces.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFSmartLog(NVMFTest):
+
+ """ Represents Smart Log testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFSmartLog, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFSmartLog, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_smart_log(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.smart_log()
+ assert_equal(ret, True, "ERROR : running smart log failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 34/46] nvmftests-tests: add a test to run IOs with dd
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (32 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 33/46] nvmftests-tests: add a test for smart-log Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 35/46] nvmftests-tests: add a test to run IOs parallely " Chaitanya Kulkarni
` (13 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to run IOs on all the controllers
and its namespaces. At a time it selects only one namespace
to run IOs.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/tests/test_nvmf_io.py | 65 ++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_io.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_io.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_io.py
new file mode 100644
index 0000000..b1ccaa8
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_io.py
@@ -0,0 +1,65 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF sequntially select a controller and run IOs:-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Run IOs sequentially iterating over controller(s) and its namespaces(s).
+ 3. Delete Host.
+ 4. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFIO(NVMFTest):
+
+ """ Represents Sequential Subsystem IO testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFIO, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFIO, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_io(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.run_ios_seq(self.dd_read)
+ assert_equal(ret, True, "ERROR : running IOs failed.")
+ ret = self.host_subsys.run_ios_seq(self.dd_write)
+ assert_equal(ret, True, "ERROR : running IOs failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 35/46] nvmftests-tests: add a test to run IOs parallely with dd
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (33 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 34/46] nvmftests-tests: add a test to run IOs with dd Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 36/46] nvmftests-tests: add a test to run mkfs and fio Chaitanya Kulkarni
` (12 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to run IOs on all the controller
and its namespaces parallely from host.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_parallel_io.py | 65 ++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_parallel_io.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_parallel_io.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_parallel_io.py
new file mode 100644
index 0000000..1b28e44
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_parallel_io.py
@@ -0,0 +1,65 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test parallel IOs on all controllers :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Run parallel IOs on all available controller(s) and its namespace(s).
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFParallelIO(NVMFTest):
+
+ """ Represents Parallel Subsystem IO testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFParallelIO, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFParallelIO, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_parallel_io(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.run_ios_parallel(self.dd_read)
+ assert_equal(ret, True, "ERROR : running IOs failed.")
+ ret = self.host_subsys.run_ios_parallel(self.dd_write)
+ assert_equal(ret, True, "ERROR : running IOs failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 36/46] nvmftests-tests: add a test to run mkfs and fio
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (34 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 35/46] nvmftests-tests: add a test to run IOs parallely " Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 37/46] nvmftests-tests: add a test to enable/disable target ns Chaitanya Kulkarni
` (11 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to format host namespace(s) with mkfs,
mount the file system and run fio.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/tests/test_nvmf_mkfs.py | 65 ++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_mkfs.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_mkfs.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_mkfs.py
new file mode 100644
index 0000000..6f78e86
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_mkfs.py
@@ -0,0 +1,65 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test mkfs on each subsystem :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Execute mkfs on all host namespaces.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFMKFS(NVMFTest):
+
+ """ Represents mkfs testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFMKFS, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFMKFS, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_mkfs(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.mkfs_seq("ext4")
+ assert_equal(ret, True, "ERROR : mkfs failed.")
+ ret = self.host_subsys.run_fs_ios(self.fio_fs_write)
+ assert_equal(ret, True, "ERROR : fio failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 37/46] nvmftests-tests: add a test to enable/disable target ns
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (35 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 36/46] nvmftests-tests: add a test to run mkfs and fio Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 38/46] nvmftests-tests: add a test to run IOs with dd randomly Chaitanya Kulkarni
` (10 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to enable/disable target namespace.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_ns_enable_disable.py | 83 ++++++++++++++++++++++
1 file changed, 83 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ns_enable_disable.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_ns_enable_disable.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_ns_enable_disable.py
new file mode 100644
index 0000000..94b521b
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_ns_enable_disable.py
@@ -0,0 +1,83 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test enable disable target namespace :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Exercise enable disable target namespace options.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFNSEnableDisable(NVMFTest):
+
+ """ Represents enable disable target namespace testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFNSEnableDisable, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFNSEnableDisable, self).common_tear_down()
+ self.loopdev.delete()
+
+ def target_ns_enable_disable(self, target_ns):
+ target_ns_path_str = " Target NS Path " + target_ns.ns_path
+ print(" Target NS ID " + str(target_ns.ns_id))
+
+ ret = target_ns.disable()
+ assert_equal(ret, True, "ERROR : target ns enable failed ...")
+ print(target_ns_path_str + " disabled successfully")
+
+ ret = target_ns.enable()
+ assert_equal(ret, True, "ERROR : target ns disable failed ...")
+ print(target_ns_path_str + " enabled successfully")
+
+ def test_ns_enable_disable(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ for target_subsys in iter(self.target_subsys):
+ try:
+ print("Target Subsystem NQN " + target_subsys.nqn)
+ for target_ns in iter(target_subsys):
+ try:
+ self.target_ns_enable_disable(target_ns)
+ except StopIteration:
+ break
+ except StopIteration:
+ break
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 38/46] nvmftests-tests: add a test to run IOs with dd randomly
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (36 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 37/46] nvmftests-tests: add a test to enable/disable target ns Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 39/46] nvmftests-tests: add a test to scan host ctrls and ns Chaitanya Kulkarni
` (9 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to run IOs on all the controller
and its namespaces by randomly selecting the controller
from the host.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_random_io.py | 65 ++++++++++++++++++++++
1 file changed, 65 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_random_io.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_random_io.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_random_io.py
new file mode 100644
index 0000000..33bb4cb
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_random_io.py
@@ -0,0 +1,65 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF randomly select a controller and run IOs :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Randomly select the controller and run IOs on all namespaces(s).
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFRandomIO(NVMFTest):
+
+ """ Represents Random Susbsytem IO testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFRandomIO, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFRandomIO, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_random_io(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.run_ios_random(self.dd_read)
+ assert_equal(ret, True, "ERROR : running IOs failed.")
+ ret = self.host_subsys.run_ios_random(self.dd_write)
+ assert_equal(ret, True, "ERROR : running IOs failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 39/46] nvmftests-tests: add a test to scan host ctrls and ns
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (37 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 38/46] nvmftests-tests: add a test to run IOs with dd randomly Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 40/46] nvmftests-tests: add a test to scan target subsys/ns Chaitanya Kulkarni
` (8 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to scan all the host ctrls and ns.
This can be used as a template in future tests where scanning
of the host subsystem is needed. e.g. adding a new ns after
connecting to the target and verifying that newly added ns
on target is appearing on the host in a timely manner.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_scan_host.py | 76 ++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_scan_host.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_scan_host.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_scan_host.py
new file mode 100644
index 0000000..6ffd309
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_scan_host.py
@@ -0,0 +1,76 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF scan host :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Scan host subsystem.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFScanHost(NVMFTest):
+
+ """ Represents host controller scan testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFScanHost, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFScanHost, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_scan_host(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ success = True
+ for host_subsys in iter(self.host_subsys):
+ try:
+ print("Host Controller " + host_subsys.ctrl_dev)
+ for host_ns in iter(host_subsys):
+ try:
+ print(" Host NS " + host_ns.ns_dev)
+ except StopIteration:
+ success = False
+ break
+ except StopIteration:
+ success = False
+ break
+
+ assert_equal(success, True, "ERROR : failed to scan host")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 40/46] nvmftests-tests: add a test to scan target subsys/ns
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (38 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 39/46] nvmftests-tests: add a test to scan host ctrls and ns Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 41/46] nvmftests-tests: add a target template Chaitanya Kulkarni
` (7 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to scan all the target subsys and ns.
This can be used as a template where scanning of target subsystems
is needed while the test is in progress.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_scan_target.py | 76 ++++++++++++++++++++++
1 file changed, 76 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_scan_target.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_scan_target.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_scan_target.py
new file mode 100644
index 0000000..b65e737
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_scan_target.py
@@ -0,0 +1,76 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF scan Target :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Scan target subsystem.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFScanTarget(NVMFTest):
+
+ """ Represents host controller scan testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFScanTarget, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFScanTarget, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_scan_target(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ success = True
+ for target_subsys in iter(self.target_subsys):
+ try:
+ print("Target Controller " + target_subsys.nqn)
+ for target_ns in iter(target_subsys):
+ try:
+ print(" Target NS " + target_ns.ns_path)
+ except StopIteration:
+ success = False
+ break
+ except StopIteration:
+ success = False
+ break
+
+ assert_equal(success, True, "ERROR : failed to scan host")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 41/46] nvmftests-tests: add a target template
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (39 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 40/46] nvmftests-tests: add a test to scan target subsys/ns Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 42/46] nvmftests-tests: add a host template Chaitanya Kulkarni
` (6 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a target test template which can be easily copied
to write a new testcase.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_target_template.py | 64 ++++++++++++++++++++++
1 file changed, 64 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_target_template.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_target_template.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_target_template.py
new file mode 100644
index 0000000..08f0978
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_target_template.py
@@ -0,0 +1,64 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF target template :-
+
+ 1. From the config file create Target.
+ 2. Write testcase code here.
+ 3. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+from nvmf.target import NVMFTarget
+
+
+class TestNVMFTargetTemplate(NVMFTest):
+
+ """ Represents target template testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.target_subsys = None
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ self.target_subsys = NVMFTarget(self.target_type)
+ ret = self.target_subsys.config(self.target_config_file)
+ assert_equal(ret, True, "ERROR : target config failed")
+
+ def tearDown(self):
+ """ Post section of testcase """
+ self.target_subsys.delete()
+ self.loopdev.delete()
+
+ def test_target(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ assert_equal(0, 0, "")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 42/46] nvmftests-tests: add a host template
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (40 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 41/46] nvmftests-tests: add a target template Chaitanya Kulkarni
@ 2017-10-25 1:30 ` Chaitanya Kulkarni
2017-10-25 1:31 ` [PATCH V2 43/46] nvmftests-tests: add a test to run traffic and disable ns Chaitanya Kulkarni
` (5 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:30 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a host test template which can be easily copied
to write a new testcase.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_host_template.py | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_host_template.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_host_template.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_host_template.py
new file mode 100644
index 0000000..bd3e50b
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_host_template.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF host template :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Write testcase code in the testcase function.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFHostTemplate(NVMFTest):
+
+ """ Represents host template testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFHostTemplate, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFHostTemplate, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_host(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ assert_equal(0, 0, "")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 43/46] nvmftests-tests: add a test to run traffic and disable ns
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (41 preceding siblings ...)
2017-10-25 1:30 ` [PATCH V2 42/46] nvmftests-tests: add a host template Chaitanya Kulkarni
@ 2017-10-25 1:31 ` Chaitanya Kulkarni
2017-10-25 1:31 ` [PATCH V2 44/46] nvmftests-tests: add a test to measure perf with fio Chaitanya Kulkarni
` (4 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:31 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test to run the IOs from the host
and disable the ns on the target.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../nvmftests/tests/test_nvmf_run_host_traffic.py | 111 +++++++++++++++++++++
1 file changed, 111 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_run_host_traffic.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_run_host_traffic.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_run_host_traffic.py
new file mode 100644
index 0000000..bf057d0
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_run_host_traffic.py
@@ -0,0 +1,111 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF run host traffic and disable target namespace(s) :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Start host traffic parallely on all host ns, disable target ns.
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import time
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.diskio import DD
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+def __run_traffic__(iocfg):
+ """ dd worker thread function to run IOs until it fails.
+ - Args :
+ - iocfg : io configuration.
+ - Returns :
+ - True when dd command fails.
+ """
+ print("Run traffic :- ")
+ while True:
+ ret = DD.run_io(iocfg)
+ # For this testcase we need dd to fail after disabling the ns
+ if ret is False:
+ return True
+
+
+class TestNVMFHostTraffic(NVMFTest):
+
+ """ Represents disable target namespace(s) while host traffic is running
+ testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ self.dd_read_traffic = {"IO_TYPE": "dd",
+ "IODIR": "read",
+ "THREAD": __run_traffic__,
+ "IF": None,
+ "OF": "/dev/null",
+ "BS": "4K",
+ "COUNT": str(self.data_size / self.block_size),
+ "RC": 0}
+ super(TestNVMFHostTraffic, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFHostTraffic, self).common_tear_down()
+ self.loopdev.delete()
+
+ def disable_target_ns(self):
+ ret = True
+ for target_subsys in iter(self.target_subsys):
+ try:
+ print("Target Subsystem NQN " + target_subsys.nqn)
+ for target_ns in iter(target_subsys):
+ try:
+ ns_path = target_ns.ns_path
+ print(" Target NS ID " + str(target_ns.ns_id))
+ print(" Disabling Target NS Path " + ns_path)
+ if target_ns.disable() is False:
+ print("ERROR : failed to disable ns " + ns_path)
+ ret = False
+ except StopIteration:
+ break
+ except StopIteration:
+ break
+ return ret
+
+ def test_host_traffic(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ self.host_subsys.run_traffic_parallel(self.dd_read_traffic)
+ time.sleep(5)
+ ret = self.disable_target_ns()
+ assert_equal(ret, True, "ERROR : target ns disable failed")
+ self.host_subsys.wait_traffic_parallel()
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 44/46] nvmftests-tests: add a test to measure perf with fio
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (42 preceding siblings ...)
2017-10-25 1:31 ` [PATCH V2 43/46] nvmftests-tests: add a test to run traffic and disable ns Chaitanya Kulkarni
@ 2017-10-25 1:31 ` Chaitanya Kulkarni
2017-10-25 1:31 ` [PATCH V2 45/46] nvmftests: add class documentation and sequence diagram Chaitanya Kulkarni
` (3 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:31 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
This adds a new test which runs fio to measure performance
with simple workload.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
.../selftests/nvmftests/tests/test_nvmf_perf.py | 63 ++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_perf.py
diff --git a/tools/testing/selftests/nvmftests/tests/test_nvmf_perf.py b/tools/testing/selftests/nvmftests/tests/test_nvmf_perf.py
new file mode 100644
index 0000000..853b5558
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/tests/test_nvmf_perf.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+"""
+NVMF test parallel IOs on all controllers :-
+
+ 1. From the config file create Target.
+ 2. From the config file create host and connect to target.
+ 3. Run parallel IOs on all available controller(s) and its namespace(s).
+ 4. Delete Host.
+ 5. Delete Target.
+"""
+
+
+import sys
+from nose.tools import assert_equal
+sys.path.append("../")
+from utils.misc.loopback import Loopback
+from nvmf_test import NVMFTest
+
+
+class TestNVMFParallelPerf(NVMFTest):
+
+ """ Represents Parallel Subsystem IO testcase """
+
+ def __init__(self):
+ NVMFTest.__init__(self)
+ self.setup_log_dir(self.__class__.__name__)
+
+ def setUp(self):
+ """ Pre section of testcase """
+ self.loopdev = Loopback(self.mount_path, self.data_size,
+ self.block_size, self.nr_dev)
+ self.loopdev.init()
+ self.build_target_config(self.loopdev.dev_list)
+ super(TestNVMFParallelPerf, self).common_setup()
+
+ def tearDown(self):
+ """ Post section of testcase """
+ super(TestNVMFParallelPerf, self).common_tear_down()
+ self.loopdev.delete()
+
+ def test_parallel_perf(self):
+ """ Testcase main """
+ print("Now Running " + self.__class__.__name__)
+ ret = self.host_subsys.run_perf_parallel(self.fio_read)
+ assert_equal(ret, True, "ERROR : running IOs failed.")
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 45/46] nvmftests: add class documentation and sequence diagram
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (43 preceding siblings ...)
2017-10-25 1:31 ` [PATCH V2 44/46] nvmftests-tests: add a test to measure perf with fio Chaitanya Kulkarni
@ 2017-10-25 1:31 ` Chaitanya Kulkarni
2017-10-25 1:31 ` [PATCH V2 46/46] nvmftests: add Makefile Chaitanya Kulkarni
` (2 subsequent siblings)
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:31 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
tools/testing/selftests/nvmftests/doc/Makefile | 7 ++
.../selftests/nvmftests/doc/sequence-diag/Makefile | 7 ++
.../nvmftests/doc/sequence-diag/nvmftests.plantuml | 98 ++++++++++++++++++++++
3 files changed, 112 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/doc/Makefile
create mode 100644 tools/testing/selftests/nvmftests/doc/sequence-diag/Makefile
create mode 100644 tools/testing/selftests/nvmftests/doc/sequence-diag/nvmftests.plantuml
diff --git a/tools/testing/selftests/nvmftests/doc/Makefile b/tools/testing/selftests/nvmftests/doc/Makefile
new file mode 100644
index 0000000..868b34a
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/doc/Makefile
@@ -0,0 +1,7 @@
+doc:
+ @epydoc -v --output=Documentation ../nvmf/*py ../tests/*py ../utils/*py
+ @make -C sequence-diag/
+
+clean:
+ @make -C sequence-diag/ clean
+ @rm -fr Documentation
diff --git a/tools/testing/selftests/nvmftests/doc/sequence-diag/Makefile b/tools/testing/selftests/nvmftests/doc/sequence-diag/Makefile
new file mode 100644
index 0000000..4a25c61
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/doc/sequence-diag/Makefile
@@ -0,0 +1,7 @@
+SRC=nvmftests
+
+all:
+ @plantuml ${SRC}.plantuml
+
+clean:
+ @rm -fr ${SRC}.png
diff --git a/tools/testing/selftests/nvmftests/doc/sequence-diag/nvmftests.plantuml b/tools/testing/selftests/nvmftests/doc/sequence-diag/nvmftests.plantuml
new file mode 100644
index 0000000..f3df765
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/doc/sequence-diag/nvmftests.plantuml
@@ -0,0 +1,98 @@
+ at startuml
+autonumber
+
+title nvmftest Sequence
+
+box "testcase.py" #LightBlue
+participant "Testcase" as tc
+end box
+
+box "target.py " #LightYellow
+participant "Target subsystems" as t
+end box
+
+box "target_subsystem.py" #LightBlue
+participant "Target namespace" as ts
+
+end box
+
+box "target_ns.py" #Gray
+participant "target namespace processing" as tns
+end box
+
+activate tc
+tc->t : initialize target object
+
+activate t
+t->ts : read config file and create target subsystem config_loop_target()
+ts->ts : initialize the target subsystem init()
+activate ts
+
+activate tns
+tns->tns : create and initialize namespace(s) init()
+tns->tns : initialize with device nguid
+tns->tns : initialize with device path
+tns->tns : enable ns enable_ns()
+
+tns->ts :
+ts->t :
+t->t : initialize port and assign subsystems to the port init()
+t->tc
+
+box "host.py " #LightYellow
+participant "host subsystems" as h
+end box
+
+box "host_subsystem.py" #LightBlue
+participant "host Namespace" as hs
+end box
+
+box "host_ns.py" #Gray
+participant "host namespace processing" as hns
+end box
+
+activate tc
+tc->h : initialize and configure host config()
+
+activate h
+h->hs : read config file and create host subsystem config_loop()
+hs->hs : initialize the host subsystem, connect to target init_ctrl()
+
+activate hs
+hs->hns : create and initialize namespace init_ctrl_ns()
+hns->hns : validate sysfs entries
+
+activate hns
+hns->hns : validate host namespace as a block device init()
+hns->hns : validate sysfs entries validate_sysfs_ns()
+
+hns->hs :
+hs->h :
+h->tc
+
+tc->tc : execute test case operations
+
+tc->h : delete host delete()
+h->hs : delete host system delete()
+hs->hns : delete host namespace delete()
+
+hns->hs :
+deactivate hns
+hs->h :
+deactivate hs
+h->tc
+deactivate h
+
+tc->t : delete target delete()
+t->t : delete port delete()
+t->ts : delete target subsystem delete()
+ts->tns : delete target namespaces delete()
+tns->ts
+deactivate tns
+deactivate ts
+ts->t
+deactivate t
+t->tc
+deactivate tc
+
+ at enduml
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 46/46] nvmftests: add Makefile
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (44 preceding siblings ...)
2017-10-25 1:31 ` [PATCH V2 45/46] nvmftests: add class documentation and sequence diagram Chaitanya Kulkarni
@ 2017-10-25 1:31 ` Chaitanya Kulkarni
2017-10-25 7:30 ` [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Johannes Thumshirn
2018-02-21 13:00 ` Michael Moese
47 siblings, 0 replies; 49+ messages in thread
From: Chaitanya Kulkarni @ 2017-10-25 1:31 UTC (permalink / raw)
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
---
tools/testing/selftests/nvmftests/Makefile | 63 ++++++++++++++++++++++++++++++
1 file changed, 63 insertions(+)
create mode 100644 tools/testing/selftests/nvmftests/Makefile
diff --git a/tools/testing/selftests/nvmftests/Makefile b/tools/testing/selftests/nvmftests/Makefile
new file mode 100644
index 0000000..ecb523a
--- /dev/null
+++ b/tools/testing/selftests/nvmftests/Makefile
@@ -0,0 +1,63 @@
+# Copyright (c) 2016-2017 Western Digital Corporation or its affiliates.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+#
+# Author: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
+#
+
+help: all
+
+all:
+ @echo "Usage:"
+ @echo
+ @echo " make run - Run all testcases."
+ @echo " make doc - Generate Documentation."
+ @echo " make cleanall - removes *pyc, documentation."
+ @echo " make static_check- runs pep8, flake8, and pylint on code."
+
+doc:
+ @make -C doc/
+
+run:
+ @ln -s tests/config config
+ nose2 --verbose
+ @rm -fr config
+
+static_check:
+ for i in `find . -name \*.py | grep -v __init__ | grep -v state_machine`;\
+ do\
+ echo "Pylint :- " ;\
+ printf "%10s " $${i};\
+ pylint $${i} 2>&1 | grep "^Your code" | awk '{print $$7}';\
+ echo "--------------------------------------------";\
+ echo "pep8 :- ";\
+ pep8 $${i};\
+ echo "flake8 :- ";\
+ flake8 $${i};\
+ done
+
+cleanall: clean
+ @rm -fr tests/logs tests/*fio.log loop.json logs
+ @find . -name \*_fio.log | xargs rm -fr
+ @make -C doc/ clean
+
+clean:
+ @rm -fr config
+ @find . -name \*pyc | xargs rm -fr
+ @find . -name __pycache__ | xargs rm -fr
+ @find . -name \*ropeproject | xargs rm -fr
+
+.PHONY: doc clean cleanall
--
1.8.3.1
^ permalink raw reply related [flat|nested] 49+ messages in thread
* [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (45 preceding siblings ...)
2017-10-25 1:31 ` [PATCH V2 46/46] nvmftests: add Makefile Chaitanya Kulkarni
@ 2017-10-25 7:30 ` Johannes Thumshirn
2018-02-21 13:00 ` Michael Moese
47 siblings, 0 replies; 49+ messages in thread
From: Johannes Thumshirn @ 2017-10-25 7:30 UTC (permalink / raw)
Hi Chaitanya,
thanks for doing this. I'll give it a spin in my NVMf test setup.
Byte,
Johannes
--
Johannes Thumshirn Storage
jthumshirn at suse.de +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
^ permalink raw reply [flat|nested] 49+ messages in thread
* [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
` (46 preceding siblings ...)
2017-10-25 7:30 ` [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Johannes Thumshirn
@ 2018-02-21 13:00 ` Michael Moese
47 siblings, 0 replies; 49+ messages in thread
From: Michael Moese @ 2018-02-21 13:00 UTC (permalink / raw)
Hi,
I was able to play a bit with your testsuite, and I am currently
working on integrating it into our automated tests.
In general I am not sure if having all these tests in python is quite
a good idea, as you pull in a huge list of dependencies. And most
developers just use a kernel and an initrd to run a bunch of tests.
However, I think there should be less output, but a nice summary on
passed/failed testcases. I would suggest taking a look at blktests.
One other remark I found so far:
In the two files tests/test_nvmf_create_host.py and
tests/test_nvmf_create_pci_target.py you wait for "Press enter..".
using raw_input(), but this is a major annoyance when executing the
testsuite automated and unattended, so I would suggest removing those.
Said that, I would like to contribute to your tests and help improve
them. You should have received a pull request regarding my remarks
above.
Michael
On Tue, Oct 24, 2017@06:30:17PM -0700, Chaitanya Kulkarni wrote:
> From: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
>
> Hi,
>
> This contains second version of the NVMe Over Fabrics unit test framework (nvmftests).
>
> Changes since V1:-
> 1. Addition of new testcases to improve the coverage.
> 2. Improved directory structure for code clarity.
> 3. Libification of the common code.
> 4. Support to use different block devices on the target side.
> 5. Centralize test configuration management.
> 6. Support to execute File System related operations on the host side.
> 7. Adjust the code to incorporate the comments received for the
> first version.
> 8. Support for setting different log levels for each component.
> 9. Support for quick performance measurements.
> 10. Class hierarchy documentation and sequence diagram.
> 11. Improved workqueue management for host namesapce to
> run parallel commands.
>
> It will be great if I can get some feedback, I'll be happy to incorporate
> the comments and make it more usable.
>
> Following is the code repository for current code:-
> https://github.com/ChaitanayaKulkarni/nvmftests/releases
>
> For the purpose of review, this patch series is generated against
> $KERN_SRC/tools/testing/selftests/.
>
> Regards,
> -Chaitanya
>
> Chaitanya Kulkarni (46):
> nvmftests: add nvmftests README file
> nvmftests-utils: add utility class to define constants
> nvmftests-utils: add shell command package
> nvmftests-utils: add log package
> nvmftests-utils: add diskio package
> nvmftests-utils: add fs package
> nvmftests-utils: add misc package
> nvmftests: add utils package
> nvmftests-nvmf: add target config generator
> nvmftests-nvmf: add support for target ns
> nvmftests-nvmf: add support for target port
> nvmftests-nvmf: add support for target subsystem
> nvmftests-nvmf: add support for target
> nvmftests-nvmf: add target package
> nvmftests-nvmf: add support for host ns
> nvmftests-nvmf: add support for host subsystem
> nvmftests-nvmf: add support for host
> nvmftests-nvmf: add host package
> nvmftests-nvmf: add nvmf core package
> nvmftests-tests: add user config file
> nvmftests-tests: add support for test logger
> nvmftests-tests: add a parent class for tests
> nvmftests-tests: add a test for generic block device
> nvmftests-tests: add a test for ns-descs
> nvmftests-tests: add a test for create/delete host
> nvmftests-tests: add a test for NVMe PCIe target ns
> nvmftests-tests: add a test to create and delete target
> nvmftests-tests: add a test for controller rescan
> nvmftests-tests: add a test for controller reset
> nvmftests-tests: add a test for get-ns-id
> nvmftests-tests: add a test for identify controller
> nvmftests-tests: add a test for identify namespace
> nvmftests-tests: add a test for smart-log
> nvmftests-tests: add a test to run IOs with dd
> nvmftests-tests: add a test to run IOs parallely with dd
> nvmftests-tests: add a test to run mkfs and fio
> nvmftests-tests: add a test to enable/disable target ns
> nvmftests-tests: add a test to run IOs with dd randomly
> nvmftests-tests: add a test to scan host ctrls and ns
> nvmftests-tests: add a test to scan target subsys/ns
> nvmftests-tests: add a target template
> nvmftests-tests: add a host template
> nvmftests-tests: add a test to run traffic and disable ns
> nvmftests-tests: add a test to measure perf with fio
> nvmftests: add class documentation and sequence diagram
> nvmftests: add Makefile
>
> tools/testing/selftests/nvmftests/Makefile | 63 +++
> tools/testing/selftests/nvmftests/README.md | 177 +++++++
> tools/testing/selftests/nvmftests/doc/Makefile | 7 +
> .../selftests/nvmftests/doc/sequence-diag/Makefile | 7 +
> .../nvmftests/doc/sequence-diag/nvmftests.plantuml | 98 ++++
> tools/testing/selftests/nvmftests/nvmf/__init__.py | 28 ++
> .../selftests/nvmftests/nvmf/host/__init__.py | 23 +
> .../testing/selftests/nvmftests/nvmf/host/host.py | 365 ++++++++++++++
> .../selftests/nvmftests/nvmf/host/host_ns.py | 262 ++++++++++
> .../nvmftests/nvmf/host/host_subsystem.py | 527 +++++++++++++++++++++
> .../selftests/nvmftests/nvmf/target/__init__.py | 25 +
> .../selftests/nvmftests/nvmf/target/port.py | 122 +++++
> .../selftests/nvmftests/nvmf/target/target.py | 210 ++++++++
> .../nvmf/target/target_config_generator.py | 222 +++++++++
> .../selftests/nvmftests/nvmf/target/target_ns.py | 117 +++++
> .../nvmftests/nvmf/target/target_subsystem.py | 140 ++++++
> .../nvmftests/tests/config/nvmftests.json | 83 ++++
> .../testing/selftests/nvmftests/tests/nvmf_test.py | 204 ++++++++
> .../selftests/nvmftests/tests/nvmf_test_logger.py | 50 ++
> .../nvmftests/tests/test_nvmf_create_gen_blk.py | 71 +++
> .../nvmftests/tests/test_nvmf_create_host.py | 71 +++
> .../nvmftests/tests/test_nvmf_create_pci_target.py | 70 +++
> .../nvmftests/tests/test_nvmf_create_target.py | 62 +++
> .../nvmftests/tests/test_nvmf_ctrl_rescan.py | 63 +++
> .../nvmftests/tests/test_nvmf_ctrl_reset.py | 63 +++
> .../nvmftests/tests/test_nvmf_get_ns_id.py | 63 +++
> .../nvmftests/tests/test_nvmf_host_template.py | 62 +++
> .../selftests/nvmftests/tests/test_nvmf_id_ctrl.py | 63 +++
> .../selftests/nvmftests/tests/test_nvmf_id_ns.py | 63 +++
> .../selftests/nvmftests/tests/test_nvmf_io.py | 65 +++
> .../selftests/nvmftests/tests/test_nvmf_mkfs.py | 65 +++
> .../nvmftests/tests/test_nvmf_ns_descs.py | 63 +++
> .../nvmftests/tests/test_nvmf_ns_enable_disable.py | 83 ++++
> .../nvmftests/tests/test_nvmf_parallel_io.py | 65 +++
> .../selftests/nvmftests/tests/test_nvmf_perf.py | 63 +++
> .../nvmftests/tests/test_nvmf_random_io.py | 65 +++
> .../nvmftests/tests/test_nvmf_run_host_traffic.py | 111 +++++
> .../nvmftests/tests/test_nvmf_scan_host.py | 76 +++
> .../nvmftests/tests/test_nvmf_scan_target.py | 76 +++
> .../nvmftests/tests/test_nvmf_smart_log.py | 63 +++
> .../nvmftests/tests/test_nvmf_target_template.py | 64 +++
> .../testing/selftests/nvmftests/utils/__init__.py | 32 ++
> .../selftests/nvmftests/utils/const/__init__.py | 21 +
> .../selftests/nvmftests/utils/const/const.py | 50 ++
> .../selftests/nvmftests/utils/diskio/__init__.py | 21 +
> .../testing/selftests/nvmftests/utils/diskio/dd.py | 50 ++
> .../selftests/nvmftests/utils/diskio/fio.py | 74 +++
> .../selftests/nvmftests/utils/fs/__init__.py | 21 +
> .../testing/selftests/nvmftests/utils/fs/ext4fs.py | 108 +++++
> .../selftests/nvmftests/utils/fs/filesystem.py | 122 +++++
> .../selftests/nvmftests/utils/log/__init__.py | 20 +
> tools/testing/selftests/nvmftests/utils/log/log.py | 58 +++
> .../selftests/nvmftests/utils/misc/__init__.py | 23 +
> .../nvmftests/utils/misc/generic_blk_dev.py | 58 +++
> .../selftests/nvmftests/utils/misc/loopback.py | 103 ++++
> .../selftests/nvmftests/utils/misc/nvme_pci.py | 114 +++++
> .../selftests/nvmftests/utils/shell/__init__.py | 20 +
> .../testing/selftests/nvmftests/utils/shell/cmd.py | 47 ++
> 58 files changed, 5182 insertions(+)
> create mode 100644 tools/testing/selftests/nvmftests/Makefile
> create mode 100644 tools/testing/selftests/nvmftests/README.md
> create mode 100644 tools/testing/selftests/nvmftests/doc/Makefile
> create mode 100644 tools/testing/selftests/nvmftests/doc/sequence-diag/Makefile
> create mode 100644 tools/testing/selftests/nvmftests/doc/sequence-diag/nvmftests.plantuml
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host_ns.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/host/host_subsystem.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/port.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_config_generator.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_ns.py
> create mode 100644 tools/testing/selftests/nvmftests/nvmf/target/target_subsystem.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/config/nvmftests.json
> create mode 100644 tools/testing/selftests/nvmftests/tests/nvmf_test.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/nvmf_test_logger.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_gen_blk.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_host.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_pci_target.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_create_target.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_rescan.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ctrl_reset.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_get_ns_id.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_host_template.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_id_ctrl.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_id_ns.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_io.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_mkfs.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ns_descs.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_ns_enable_disable.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_parallel_io.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_perf.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_random_io.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_run_host_traffic.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_scan_host.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_scan_target.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_smart_log.py
> create mode 100644 tools/testing/selftests/nvmftests/tests/test_nvmf_target_template.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/const/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/const/const.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/dd.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/diskio/fio.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/fs/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/fs/ext4fs.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/fs/filesystem.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/log/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/log/log.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/misc/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/misc/generic_blk_dev.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/misc/loopback.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/misc/nvme_pci.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/shell/__init__.py
> create mode 100644 tools/testing/selftests/nvmftests/utils/shell/cmd.py
>
> --
> 1.8.3.1
>
>
> _______________________________________________
> Linux-nvme mailing list
> Linux-nvme at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-nvme
--
SUSE Linux GmbH, GF: Felix Imend?rffer, Jane Smithard, Graham Norton, HRB 21284 (AG N?rnberg)
^ permalink raw reply [flat|nested] 49+ messages in thread
end of thread, other threads:[~2018-02-21 13:00 UTC | newest]
Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-25 1:30 [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 01/46] nvmftests: add nvmftests README file Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 02/46] nvmftests-utils: add utility class to define constants Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 03/46] nvmftests-utils: add shell command package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 04/46] nvmftests-utils: add log package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 05/46] nvmftests-utils: add diskio package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 06/46] nvmftests-utils: add fs package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 07/46] nvmftests-utils: add misc package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 08/46] nvmftests: add utils package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 09/46] nvmftests-nvmf: add target config generator Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 10/46] nvmftests-nvmf: add support for target ns Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 11/46] nvmftests-nvmf: add support for target port Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 12/46] nvmftests-nvmf: add support for target subsystem Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 13/46] nvmftests-nvmf: add support for target Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 14/46] nvmftests-nvmf: add target package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 15/46] nvmftests-nvmf: add support for host ns Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 16/46] nvmftests-nvmf: add support for host subsystem Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 17/46] nvmftests-nvmf: add support for host Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 18/46] nvmftests-nvmf: add host package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 19/46] nvmftests-nvmf: add nvmf core package Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 20/46] nvmftests-tests: add user config file Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 21/46] nvmftests-tests: add support for test logger Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 22/46] nvmftests-tests: add a parent class for tests Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 23/46] nvmftests-tests: add a test for generic block device Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 24/46] nvmftests-tests: add a test for ns-descs Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 25/46] nvmftests-tests: add a test for create/delete host Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 26/46] nvmftests-tests: add a test for NVMe PCIe target ns Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 27/46] nvmftests-tests: add a test to create and delete target Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 28/46] nvmftests-tests: add a test for controller rescan Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 29/46] nvmftests-tests: add a test for controller reset Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 30/46] nvmftests-tests: add a test for get-ns-id Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 31/46] nvmftests-tests: add a test for identify controller Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 32/46] nvmftests-tests: add a test for identify namespace Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 33/46] nvmftests-tests: add a test for smart-log Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 34/46] nvmftests-tests: add a test to run IOs with dd Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 35/46] nvmftests-tests: add a test to run IOs parallely " Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 36/46] nvmftests-tests: add a test to run mkfs and fio Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 37/46] nvmftests-tests: add a test to enable/disable target ns Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 38/46] nvmftests-tests: add a test to run IOs with dd randomly Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 39/46] nvmftests-tests: add a test to scan host ctrls and ns Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 40/46] nvmftests-tests: add a test to scan target subsys/ns Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 41/46] nvmftests-tests: add a target template Chaitanya Kulkarni
2017-10-25 1:30 ` [PATCH V2 42/46] nvmftests-tests: add a host template Chaitanya Kulkarni
2017-10-25 1:31 ` [PATCH V2 43/46] nvmftests-tests: add a test to run traffic and disable ns Chaitanya Kulkarni
2017-10-25 1:31 ` [PATCH V2 44/46] nvmftests-tests: add a test to measure perf with fio Chaitanya Kulkarni
2017-10-25 1:31 ` [PATCH V2 45/46] nvmftests: add class documentation and sequence diagram Chaitanya Kulkarni
2017-10-25 1:31 ` [PATCH V2 46/46] nvmftests: add Makefile Chaitanya Kulkarni
2017-10-25 7:30 ` [PATCH V2 00/46] nvmftests: NVMe Over Fabrics Unit Test Framework Johannes Thumshirn
2018-02-21 13:00 ` Michael Moese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).