Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] nvmetcli: store DHCHAP attributes
@ 2026-07-13 13:53 Hannes Reinecke
  2026-07-14 16:58 ` Daniel Wagner
  0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2026-07-13 13:53 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Daniel Wagner, linux-nvme, Sagi Grimberg, Keith Busch,
	Hannes Reinecke

The DHCHAP authentication is stored under hosts/, and are starting
with 'dhchap_'. So add a 'dhchap' attribute group for the host object
to correctly save and restore DHCHAP values.

Signed-off-by: Hannes Reinecke <hare@kernel.org>
---
 nvmet/nvme.py       | 1 +
 nvmet/test_nvmet.py | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index faf1eb2..80d3953 100644
--- a/nvmet/nvme.py
+++ b/nvmet/nvme.py
@@ -1013,6 +1013,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)
diff --git a/nvmet/test_nvmet.py b/nvmet/test_nvmet.py
index 13e2f6c..086d7bc 100644
--- a/nvmet/test_nvmet.py
+++ b/nvmet/test_nvmet.py
@@ -426,6 +426,7 @@ class TestNvmet(unittest.TestCase):
         root.clear_existing()
 
         h = nvme.Host(nqn='hostnqn', mode='create')
+        h.set_attr('dhgroup','ffdhe2048')
 
         s = nvme.Subsystem(nqn='testnqn', mode='create')
         s.add_allowed_host(nqn='hostnqn')
@@ -475,6 +476,7 @@ class TestNvmet(unittest.TestCase):
         self.assertEqual(n.get_attr('device', 'path'), NVMET_TEST_DEVICES[0])
         self.assertEqual(n.get_attr('device', 'nguid'), nguid)
 
+        self.assertEqual(h.get_attr('dhchap', 'dhgroup'), 'ffdhe2048')
         self.assertEqual(p.get_attr('addr', 'trtype'), 'loop')
         self.assertEqual(p.get_attr('addr', 'adrfam'), 'ipv4')
         self.assertEqual(p.get_attr('addr', 'traddr'), '192.168.0.1')
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-14 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 13:53 [PATCHv2] nvmetcli: store DHCHAP attributes Hannes Reinecke
2026-07-14 16:58 ` Daniel Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox