[PATCH] nvmetcli: support 'dhchap' attribute group
Hannes Reinecke
hare at suse.de
Wed Mar 23 00:33:16 PDT 2022
NVMe authentication support added a new attribute group 'dhchap'
to the host configfs directories. This patch adds functions to
display and modify these entries from nvmetcli.
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
nvmet/nvme.py | 2 ++
nvmetcli | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index d170204..2ad9006 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -892,6 +892,7 @@ class Host(CFSNode):
'''
super(Host, self).__init__()
+ self.attr_groups = ['dhchap']
self.nqn = nqn
self._path = "%s/hosts/%s" % (self.configfs_dir, nqn)
self._create_in_cfs(mode)
@@ -913,6 +914,7 @@ class Host(CFSNode):
except CFSError as e:
err_func("Could not create Host object: %s" % e)
return
+ h._setup_attrs(t, err_func)
def dump(self):
d = super(Host, self).dump()
diff --git a/nvmetcli b/nvmetcli
index 8ee8590..8da379b 100755
--- a/nvmetcli
+++ b/nvmetcli
@@ -661,6 +661,10 @@ class UIHostNode(UINode):
def __init__(self, parent, cfnode):
UINode.__init__(self, cfnode.nqn, parent, cfnode)
+ def summary(self):
+ info = []
+ info.append("key=" + self.cfnode.get_attr("dhchap", "key"))
+ return (", ".join(info), True)
def usage():
print("syntax: %s save [file_to_save_to]" % sys.argv[0])
--
2.29.2
More information about the Linux-nvme
mailing list