import nvmetcli-0.7-3.el9

This commit is contained in:
CentOS Sources 2022-05-17 06:39:48 -04:00 committed by Stepan Oksanichenko
commit f4c96b2c0a
15 changed files with 781 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/nvmetcli-0.7.tar.gz

1
.nvmetcli.metadata Normal file
View File

@ -0,0 +1 @@
a21ae6d6f7f912be7000384666ff2339f1b12f85 SOURCES/nvmetcli-0.7.tar.gz

View File

@ -0,0 +1,33 @@
From 0827df8deb5304854d9efc58e9df5971aa66f490 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 27 Mar 2020 08:01:34 +0100
Subject: [PATCH 01/12] nvmetcli: don't remove ANA Group 1 on clear
The first ANA group is maintained by the kernel so it cannot
be deleted.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmet/nvme.py | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index 0647ddc..fdec4ff 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -845,6 +845,11 @@ class ANAGroup(CFSNode):
a._setup_attrs(n, err_func)
+ def delete(self):
+ # ANA Group 1 is automatically created/deleted
+ if self.grpid != 1:
+ super(ANAGroup, self).delete()
+
def dump(self):
d = super(ANAGroup, self).dump()
d['grpid'] = self.grpid
--
2.29.2

View File

@ -0,0 +1,30 @@
From a481736441b4c811f57fa84a8e3609b084f93835 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 26 Mar 2020 13:07:44 -0500
Subject: [PATCH 02/12] README: Update URL for configshell-fb
The github repository was moved. There is a github redirect,
so this change is not strictly required.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
README | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README b/README
index c8717e8..5a4ecd1 100644
--- a/README
+++ b/README
@@ -7,7 +7,7 @@ to save, restore or clear the current NVMe target configuration.
Installation
------------
Please install the configshell-fb package from
-https://github.com/agrover/configshell-fb first.
+https://github.com/open-iscsi/configshell-fb first.
nvmetcli can be run directly from the source directory or installed
using setup.py.
--
2.29.2

View File

@ -0,0 +1,61 @@
From 48b8f318e0594d7adfec290ae47d9308eb0f65af Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 26 Mar 2020 13:07:45 -0500
Subject: [PATCH 03/12] nvmetcli: Improve IOError handling on restore
Not all IOErrors are caused by specifying a missing configuration
file. When the file is present, dump the error exception text too,
so the user has a better idea what is wrong.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmetcli | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/nvmetcli b/nvmetcli
index 3d8c16e..a646232 100755
--- a/nvmetcli
+++ b/nvmetcli
@@ -24,6 +24,7 @@ import os
import sys
import configshell_fb as configshell
import nvmet as nvme
+import errno
from string import hexdigits
import uuid
@@ -674,16 +675,26 @@ def save(to_file):
def restore(from_file):
+ errors = None
+
try:
errors = nvme.Root().restore_from_file(from_file)
- except IOError:
- # Not an error if the restore file is not present
- print("No saved config file at %s, ok, exiting" % from_file)
- sys.exit(0)
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ # Not an error if the restore file is not present
+ print("No saved config file at %s, ok, exiting" % from_file)
+ sys.exit(0)
+ else:
+ print("Error processing config file at %s, error %s, exiting" %
+ (from_file, str(e)))
+ sys.exit(1)
+ # These errors are non-fatal
for error in errors:
print(error)
+ sys.exit(0)
+
def clear(unused):
nvme.Root().clear_existing()
--
2.29.2

View File

@ -0,0 +1,29 @@
From 226b73a4ae317c6aa3c7b00da2adbd1ec769ce34 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 26 Mar 2020 13:07:46 -0500
Subject: [PATCH 04/12] nvme.py: Explicit close is redundant
One of the benefits of using 'with' statement for open files is the
close is going to be called regardless of what happens.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmet/nvme.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index fdec4ff..687a45a 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -302,7 +302,6 @@ class Root(CFSNode):
f.write("\n")
f.flush()
os.fsync(f.fileno())
- f.close()
os.rename(savefile + ".temp", savefile)
--
2.29.2

View File

@ -0,0 +1,40 @@
From 12a8764c6113887c5691cab6a92bb1c13414395c Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 26 Mar 2020 13:07:47 -0500
Subject: [PATCH 05/12] nvme.py: Sync the containing directory
It's apparent that some thought went into making sure the config
file makes it atomically to the fs. However, one thing is missing
which is doing a fsync on the containing directory of the config file.
See: https://lwn.net/Articles/457667/
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmet/nvme.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index 687a45a..04659de 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -305,6 +305,15 @@ class Root(CFSNode):
os.rename(savefile + ".temp", savefile)
+ # Sync the containing directory too
+ dir_fd = None
+ try:
+ dir_fd = os.open(savefile_dir, os.O_RDONLY)
+ os.fsync(dir_fd)
+ finally:
+ if dir_fd:
+ os.close(dir_fd)
+
def clear_existing(self):
'''
Remove entire current configuration.
--
2.29.2

View File

@ -0,0 +1,35 @@
From 75c178f6c2943490ef2c13df5863d6ac308f6ef1 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 26 Mar 2020 13:07:48 -0500
Subject: [PATCH 06/12] nvme.py: Make modprobe work for kmod lib too
The python library 'kmod' is included with libkmod, lets try to use that
if the user isn't utilizing kmodpy.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmet/nvme.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index 04659de..db8a03c 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -253,7 +253,12 @@ class Root(CFSNode):
except kmod.KmodError:
pass
except ImportError:
- pass
+ # Try the ctypes library included with the libkmod itself.
+ try:
+ import kmod
+ kmod.Kmod().modprobe(modname)
+ except Exception as e:
+ pass
def _list_subsystems(self):
self._check_self()
--
2.29.2

View File

@ -0,0 +1,48 @@
From 477a04b18e8754dc3f75110f0e7e6cdac70217aa Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 26 Mar 2020 13:07:49 -0500
Subject: [PATCH 07/12] test_nvmet.py: test_invalid_input fails for py3
When you run 'make test' using python 3 the unit test
test_invalid_input fails with:
Traceback (most recent call last):
File "/someuser/projects/nvmetcli/nvmet/test_nvmet.py", line 395, in
test_invalid_input
for i in range(l))
File "/someuser/projects/nvmetcli/nvmet/test_nvmet.py", line 395, in
<genexpr>
for i in range(l))
AttributeError: module 'string' has no attribute 'lowercase'
Python 3 does not have 'string.lowercase' ref.
https://docs.python.org/3/library/string.html
Python 2 does ref.
https://docs.python.org/2/library/string.html
Both have "string.ascii_lowercase" so lets leverage that to
support both.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmet/test_nvmet.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nvmet/test_nvmet.py b/nvmet/test_nvmet.py
index 5caa546..aae4a86 100644
--- a/nvmet/test_nvmet.py
+++ b/nvmet/test_nvmet.py
@@ -391,7 +391,7 @@ class TestNvmet(unittest.TestCase):
nqn='/', mode='create')
for l in [ 257, 512, 1024, 2048 ]:
- toolong = ''.join(random.choice(string.lowercase)
+ toolong = ''.join(random.choice(string.ascii_lowercase)
for i in range(l))
self.assertRaises(nvme.CFSError, nvme.Subsystem,
nqn=toolong, mode='create')
--
2.29.2

View File

@ -0,0 +1,50 @@
From fd09200bba73011b4b7086c96e394ce875fdd38f Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 26 Mar 2020 13:07:50 -0500
Subject: [PATCH 08/12] nvmetcli: Report save name correctly
When a user simply does 'nvmetcli restore' without
specifying a file name the default is used. However, if the
restore fails you end up with the error message:
Error processing config file at None, error [Errno 1] Operation not
permitted: '/sys/kernel/config/nvmet/ports/0/ana_groups/1', exiting
Correct file name if None in error path.
Error processing config file at /etc/nvmet/config.json, error \
[Errno 1] Operation not permitted: \
'/sys/kernel/config/nvmet/ports/1/ana_groups/1', exiting
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmet/__init__.py | 3 ++-
nvmetcli | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/nvmet/__init__.py b/nvmet/__init__.py
index ca05de4..cf172bd 100644
--- a/nvmet/__init__.py
+++ b/nvmet/__init__.py
@@ -1 +1,2 @@
-from .nvme import Root, Subsystem, Namespace, Port, Host, Referral, ANAGroup
+from .nvme import Root, Subsystem, Namespace, Port, Host, Referral, ANAGroup,\
+ DEFAULT_SAVE_FILE
diff --git a/nvmetcli b/nvmetcli
index a646232..8ee8590 100755
--- a/nvmetcli
+++ b/nvmetcli
@@ -680,6 +680,9 @@ def restore(from_file):
try:
errors = nvme.Root().restore_from_file(from_file)
except IOError as e:
+ if not from_file:
+ from_file = nvme.DEFAULT_SAVE_FILE
+
if e.errno == errno.ENOENT:
# Not an error if the restore file is not present
print("No saved config file at %s, ok, exiting" % from_file)
--
2.29.2

View File

@ -0,0 +1,146 @@
From 35e92a1bfedf28868112165892b3eb2cd7f750ce Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Thu, 2 Apr 2020 10:54:43 -0500
Subject: [PATCH 09/12] nvmetcli: Allow different devices for make test
The test_nvmet.py by default uses /dev/ram0 and /dev/ram1 for 2 of the
unit tests. Add env. variable to allow user to specify different devices
or files. Additionally, skip these unit tests that require devices/files
if they are not present. Update README too.
$ sudo make test
......s...s.
----------------------------------------------------------------------
Ran 12 tests in 0.043s
OK (skipped=2)
Name Stmts Miss Cover
-----------------------------------------
nvmet/__init__.py 1 0 100%
nvmet/nvme.py 517 237 54%
nvmet/test_nvmet.py 276 63 77%
-----------------------------------------
TOTAL 794 300 62%
$ sudo NVMET_TEST_DEVICES="/dev/sdc,/dev/sdd" make test
............
----------------------------------------------------------------------
Ran 12 tests in 0.124s
OK
Name Stmts Miss Cover
-----------------------------------------
nvmet/__init__.py 1 0 100%
nvmet/nvme.py 517 100 81%
nvmet/test_nvmet.py 276 4 99%
-----------------------------------------
TOTAL 794 104 87%
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
README | 5 ++++-
nvmet/test_nvmet.py | 26 ++++++++++++++++++++++----
2 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/README b/README
index 5a4ecd1..44f1c33 100644
--- a/README
+++ b/README
@@ -47,7 +47,10 @@ Testing
-------
nvmetcli comes with a testsuite that tests itself and the kernel configfs
interface for the NVMe target. To run it make sure you have nose2 and
-the coverage plugin for it installed and simple run 'make test'.
+the coverage plugin for it installed and simple run 'make test'. To run all
+the tests you also need some test block devices or files. Default is to
+use /dev/ram0 and /dev/ram1. You can override default with environmental
+variable eg. NVMET_TEST_DEVICES="/dev/sdk,/dev/sdj" make test .
Development
-----------------
diff --git a/nvmet/test_nvmet.py b/nvmet/test_nvmet.py
index aae4a86..f8ec232 100644
--- a/nvmet/test_nvmet.py
+++ b/nvmet/test_nvmet.py
@@ -1,9 +1,22 @@
+import os
import random
+import stat
import string
import unittest
import nvmet.nvme as nvme
+# Default test devices are ram disks, but allow user to specify different
+# block devices or files.
+NVMET_TEST_DEVICES = os.getenv("NVMET_TEST_DEVICES",
+ "/dev/ram0,/dev/ram1").split(',')
+
+
+def test_devices_present():
+ return len([x for x in NVMET_TEST_DEVICES
+ if os.path.exists(x) and
+ (stat.S_ISBLK(os.stat(x).st_mode) or os.path.isfile(x))]) >= 2
+
class TestNvmet(unittest.TestCase):
def test_subsystem(self):
@@ -101,6 +114,8 @@ class TestNvmet(unittest.TestCase):
n.delete()
self.assertEqual(len(list(s.namespaces)), 0)
+ @unittest.skipUnless(test_devices_present(),
+ "Devices %s not available or suitable" % ','.join(NVMET_TEST_DEVICES))
def test_namespace_attrs(self):
root = nvme.Root()
root.clear_existing()
@@ -116,7 +131,7 @@ class TestNvmet(unittest.TestCase):
self.assertRaises(nvme.CFSError, n.set_enable, 1)
# now set a path and enable
- n.set_attr('device', 'path', '/dev/ram0')
+ n.set_attr('device', 'path', NVMET_TEST_DEVICES[0])
n.set_enable(1)
self.assertTrue(n.get_enable())
@@ -125,7 +140,7 @@ class TestNvmet(unittest.TestCase):
# test that we can't write to attrs while enabled
self.assertRaises(nvme.CFSError, n.set_attr, 'device', 'path',
- '/dev/ram1')
+ NVMET_TEST_DEVICES[1])
self.assertRaises(nvme.CFSError, n.set_attr, 'device', 'nguid',
'15f7767b-50e7-4441-949c-75b99153dea7')
@@ -403,6 +418,9 @@ class TestNvmet(unittest.TestCase):
self.assertRaises(nvme.CFSError, nvme.Port,
portid=1 << 17, mode='create')
+ @unittest.skipUnless(test_devices_present(),
+ "Devices %s not available or suitable" % ','.join(
+ NVMET_TEST_DEVICES))
def test_save_restore(self):
root = nvme.Root()
root.clear_existing()
@@ -416,7 +434,7 @@ class TestNvmet(unittest.TestCase):
s2.set_attr('attr', 'allow_any_host', 1)
n = nvme.Namespace(s, nsid=42, mode='create')
- n.set_attr('device', 'path', '/dev/ram0')
+ n.set_attr('device', 'path', NVMET_TEST_DEVICES[0])
n.set_enable(1)
nguid = n.get_attr('device', 'nguid')
@@ -454,7 +472,7 @@ class TestNvmet(unittest.TestCase):
# and check everything is still the same
self.assertTrue(n.get_enable())
- self.assertEqual(n.get_attr('device', 'path'), '/dev/ram0')
+ self.assertEqual(n.get_attr('device', 'path'), NVMET_TEST_DEVICES[0])
self.assertEqual(n.get_attr('device', 'nguid'), nguid)
self.assertEqual(p.get_attr('addr', 'trtype'), 'loop')
--
2.29.2

View File

@ -0,0 +1,57 @@
From 9da40b0433b8338f82c2c910b1057e1e1061b9a0 Mon Sep 17 00:00:00 2001
From: Tony Asleson <tasleson@redhat.com>
Date: Wed, 1 Apr 2020 14:13:16 -0500
Subject: [PATCH 10/12] nvmetcli: Correct xrange usage for py3
If you are in a namespace and simply do a 'create' without specifying
a value you will get:
/subsystems/n...f8/namespaces> create
name 'xrange' is not defined
subsystems/n...f8/namespaces>
This is because xrange is not defined in python3 as python3 changed
it to range. As the code is already using six use six.move.xrange
which works for both python2 & python3.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
nvmet/nvme.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index db8a03c..83fd75b 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -23,7 +23,7 @@ import stat
import uuid
import json
from glob import iglob as glob
-from six import iteritems
+from six import iteritems, moves
DEFAULT_SAVE_FILE = '/etc/nvmet/config.json'
@@ -556,7 +556,7 @@ class Namespace(CFSNode):
raise CFSError("Need NSID for lookup")
nsids = [n.nsid for n in subsystem.namespaces]
- for index in xrange(1, self.MAX_NSID + 1):
+ for index in moves.xrange(1, self.MAX_NSID + 1):
if index not in nsids:
nsid = index
break
@@ -816,7 +816,7 @@ class ANAGroup(CFSNode):
raise CFSError("Need grpid for lookup")
grpids = [n.grpid for n in port.ana_groups]
- for index in xrange(2, self.MAX_GRPID + 1):
+ for index in moves.xrange(2, self.MAX_GRPID + 1):
if index not in grpids:
grpid = index
break
--
2.29.2

View File

@ -0,0 +1,99 @@
From 73dcf7ef6b6aa80c87c61f08583cba97ad1c626a Mon Sep 17 00:00:00 2001
From: zhenwei pi <pizhenwei@bytedance.com>
Date: Thu, 10 Dec 2020 17:06:56 +0800
Subject: [PATCH 11/12] nvmetcli: add a tcp example json
Run a tcp nvme target on linux-5.10-rc version, and save the config
as an example.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
README | 5 +++++
tcp.json | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
create mode 100644 tcp.json
diff --git a/README b/README
index 44f1c33..6ebe666 100644
--- a/README
+++ b/README
@@ -41,6 +41,11 @@ fc.json fits your setup:
./nvmetcli restore fc.json
+Or to load the tcp + no host authentication version do the following
+after you've ensured that the IP address in tcp.json fits your setup:
+
+ ./nvmetcli restore tcp.json
+
These files can also be edited directly using your favorite editor.
Testing
diff --git a/tcp.json b/tcp.json
new file mode 100644
index 0000000..e6ff029
--- /dev/null
+++ b/tcp.json
@@ -0,0 +1,58 @@
+{
+ "hosts": [],
+ "ports": [
+ {
+ "addr": {
+ "adrfam": "ipv4",
+ "traddr": "192.168.122.33",
+ "treq": "not specified",
+ "trsvcid": "4420",
+ "trtype": "tcp"
+ },
+ "ana_groups": [
+ {
+ "ana": {
+ "state": "optimized"
+ },
+ "grpid": 1
+ }
+ ],
+ "param": {
+ "inline_data_size": "16384",
+ "pi_enable": "0"
+ },
+ "portid": 1,
+ "referrals": [],
+ "subsystems": [
+ "nvmet-always"
+ ]
+ }
+ ],
+ "subsystems": [
+ {
+ "allowed_hosts": [],
+ "attr": {
+ "allow_any_host": "1",
+ "cntlid_max": "65519",
+ "cntlid_min": "1",
+ "model": "Linux",
+ "pi_enable": "0",
+ "serial": "123456789abcdef",
+ "version": "1.3"
+ },
+ "namespaces": [
+ {
+ "ana_grpid": 1,
+ "device": {
+ "nguid": "00000000-0000-0000-0000-000000000000",
+ "path": "/dev/nvme0n1",
+ "uuid": "d592cdf3-5d1c-44e0-8412-3fcf7d99df27"
+ },
+ "enable": 1,
+ "nsid": 1
+ }
+ ],
+ "nqn": "nvmet-always"
+ }
+ ]
+}
--
2.29.2

View File

@ -0,0 +1,28 @@
From 297f40aef117875d98303b0535fb076626b91a19 Mon Sep 17 00:00:00 2001
From: Maurizio Lombardi <mlombard@redhat.com>
Date: Mon, 1 Feb 2021 15:47:56 +0100
Subject: [PATCH 12/12] Documentation: fix typo
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
Documentation/nvmetcli.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/nvmetcli.txt b/Documentation/nvmetcli.txt
index 05a0344..7d6ffda 100644
--- a/Documentation/nvmetcli.txt
+++ b/Documentation/nvmetcli.txt
@@ -116,7 +116,7 @@ your devices and all dependent modules are loaded,
and configfs is mounted on /sys/kernel/config
using:
- mount -t configs none /sys/kernel/config
+ mount -t configfs none /sys/kernel/config
The following section walks through a configuration example.
--
2.29.2

123
SPECS/nvmetcli.spec Normal file
View File

@ -0,0 +1,123 @@
Name: nvmetcli
License: ASL 2.0
Summary: An adminstration shell for NVMe storage targets
Version: 0.7
Release: 3%{?dist}
URL: ftp://ftp.infradead.org/pub/nvmetcli/
Source: ftp://ftp.infradead.org/pub/nvmetcli/%{name}-%{version}.tar.gz
Patch00: 0001-nvmetcli-don-t-remove-ANA-Group-1-on-clear.patch
Patch01: 0002-README-Update-URL-for-configshell-fb.patch
Patch02: 0003-nvmetcli-Improve-IOError-handling-on-restore.patch
Patch03: 0004-nvme.py-Explicit-close-is-redundant.patch
Patch04: 0005-nvme.py-Sync-the-containing-directory.patch
Patch05: 0006-nvme.py-Make-modprobe-work-for-kmod-lib-too.patch
Patch06: 0007-test_nvmet.py-test_invalid_input-fails-for-py3.patch
Patch07: 0008-nvmetcli-Report-save-name-correctly.patch
Patch08: 0009-nvmetcli-Allow-different-devices-for-make-test.patch
Patch09: 0010-nvmetcli-Correct-xrange-usage-for-py3.patch
Patch10: 0011-nvmetcli-add-a-tcp-example-json.patch
Patch11: 0012-Documentation-fix-typo.patch
BuildArch: noarch
BuildRequires: make
BuildRequires: python3-devel python3-setuptools systemd-units asciidoc xmlto
Requires: python3-configshell python3-kmod
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
This package contains the command line interface to the NVMe over Fabrics
nvmet in the Linux kernel. It allows configuring the nvmet interactively
as well as saving / restoring the configuration to / from a json file.
%prep
%autosetup -p1
%build
%{__python3} setup.py build
cd Documentation
make
gzip --stdout nvmetcli.8 > nvmetcli.8.gz
%install
%{__python3} setup.py install --skip-build --root %{buildroot}
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_sysconfdir}/nvmet
install -m 644 nvmet.service %{buildroot}%{_unitdir}/nvmet.service
mkdir -p %{buildroot}%{_mandir}/man8/
install -m 644 Documentation/nvmetcli.8.gz %{buildroot}%{_mandir}/man8/
%post
%systemd_post nvmet.service
%preun
%systemd_preun nvmet.service
%postun
%systemd_postun_with_restart nvmet.service
%files
%{python3_sitelib}/*
%dir %{_sysconfdir}/nvmet
%{_sbindir}/nvmetcli
%{_unitdir}/nvmet.service
%doc README
%license COPYING
%{_mandir}/man8/nvmetcli.8.gz
%changelog
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.7-3
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 0.7-2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Thu Feb 11 2021 Maurizio Lombardi <mlombard@redhat.com> - 0.7-1
- Rebase to the latest version (git commit id 297f40aef117875d98303b0535fb076626b91a19)
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.4-11
- Rebuilt for Python 3.9
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0.4-9
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.4-8
- Rebuilt for Python 3.8
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.4-4
- Rebuilt for Python 3.7
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Tue May 9 2017 Andy Grover <agrover@redhat.com> - 0.4-1
- Update for new upstream release
- Remove fix-setup.patch
* Tue Feb 21 2017 Andy Grover <agrover@redhat.com> - 0.3-1
- Update for new upstream release
* Wed Oct 12 2016 Andy Grover <agrover@redhat.com> - 0.2-1
- Initial packaging