nvmetcli: store DHCHAP attributes
PATCH v2 1/1 nvmetcli: store DHCHAP attributes
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 <[email protected]>
--- nvmet/nvme.py | 1 + nvmet/test_nvmet.py | 2 ++ 2 files changed, 3 insertions(+)
nvmet/nvme.py +1 -0
@@ -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)
nvmet/test_nvmet.py +2 -0
@@ -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')
Signature · 1 line
2.51.0
nvmet/test_nvmet.py class TestNvmet(unittest.TestCase): · line 429
Quoted 11 lines · 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.nvmet/test_nvmet.py +1
-0@@ -426,6 +426,7 @@ class TestNvmet(unittest.TestCase): root.clear_existing() h = nvme.Host(nqn='hostnqn', mode='create') + h.set_attr('dhgroup','ffdhe2048')
I suppose this should be
h.set_attr('dhchap', 'dhgroup','ffdhe2048')set_attr wants 3 arguments.