[PATCH] nvmetcli: Support unique discovery NQN

Hannes Reinecke hare at kernel.org
Wed Apr 3 04:51:56 PDT 2024


If the configuration supports unique discovery NQNs we should be
able to view and modify it from nvmetcli.

Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
 nvmet/nvme.py | 1 +
 nvmetcli      | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index 59efdb5..fc9c7fe 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -241,6 +241,7 @@ class Root(CFSNode):
             raise CFSError("%s does not exist.  Giving up." %
                            self.configfs_dir)
 
+        self.attr_groups = ['discovery']
         self._path = self.configfs_dir
         self._create_in_cfs('lookup')
 
diff --git a/nvmetcli b/nvmetcli
index d949891..3424e6e 100755
--- a/nvmetcli
+++ b/nvmetcli
@@ -94,6 +94,10 @@ class UINode(configshell.node.ConfigNode):
 
 
 class UIRootNode(UINode):
+    ui_desc_attr = {
+            'nqn': ('string', 'Unique discovery NQN')
+    }
+
     def __init__(self, shell):
         UINode.__init__(self, '/', parent=None, cfnode=nvme.Root(),
                         shell=shell)
@@ -116,6 +120,10 @@ class UIRootNode(UINode):
                 "Configuration restored, %d errors:\n%s" %
                 (len(errors), "\n".join(errors)))
 
+    def summary(self):
+        info = []
+        info.append("discovery=" + self.cfnode.get_attr("discovery","nqn"))
+        return (", ".join(info), True)
 
 class UISubsystemsNode(UINode):
     def __init__(self, parent):
-- 
2.35.3




More information about the Linux-nvme mailing list