Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@kernel.org>
To: Daniel Wagner <wagi@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>,
	linux-nvme@lists.infradead.org, Hannes Reinecke <hare@kernel.org>
Subject: [PATCHv3] nvmetcli: store DHCHAP attributes
Date: Wed, 15 Jul 2026 11:07:33 +0200	[thread overview]
Message-ID: <20260715090733.94695-1-hare@kernel.org> (raw)

The DHCHAP authentication attributes is stored under hosts/, and 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       | 2 ++
 nvmet/test_nvmet.py | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/nvmet/nvme.py b/nvmet/nvme.py
index faf1eb2..a9b78df 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)
@@ -1034,6 +1035,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/nvmet/test_nvmet.py b/nvmet/test_nvmet.py
index 13e2f6c..1d1c592 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('dhchap','dhgroup','ffdhe2048')
 
         s = nvme.Subsystem(nqn='testnqn', mode='create')
         s.add_allowed_host(nqn='hostnqn')
@@ -475,6 +476,8 @@ 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



             reply	other threads:[~2026-07-15  9:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  9:07 Hannes Reinecke [this message]
2026-07-15 11:21 ` [PATCHv3] nvmetcli: store DHCHAP attributes Daniel Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260715090733.94695-1-hare@kernel.org \
    --to=hare@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-nvme@lists.infradead.org \
    --cc=wagi@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox