* [PATCH] nvmetcli: support 'dhchap' attribute group
@ 2022-03-23 7:33 Hannes Reinecke
2022-06-27 15:08 ` Sagi Grimberg
0 siblings, 1 reply; 3+ messages in thread
From: Hannes Reinecke @ 2022-03-23 7:33 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke
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@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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmetcli: support 'dhchap' attribute group
2022-03-23 7:33 [PATCH] nvmetcli: support 'dhchap' attribute group Hannes Reinecke
@ 2022-06-27 15:08 ` Sagi Grimberg
2022-06-27 15:13 ` Hannes Reinecke
0 siblings, 1 reply; 3+ messages in thread
From: Sagi Grimberg @ 2022-06-27 15:08 UTC (permalink / raw)
To: Hannes Reinecke, Christoph Hellwig; +Cc: Keith Busch, linux-nvme
> 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@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)
We shouldn't have a UI to the secrets themselves I think, we probably
should do this instead:
diff --git a/nvmetcli b/nvmetcli
index 8da379bde9db..b06039b2338d 100755
--- a/nvmetcli
+++ b/nvmetcli
@@ -663,7 +663,14 @@ class UIHostNode(UINode):
def summary(self):
info = []
- info.append("key=" + self.cfnode.get_attr("dhchap", "key"))
+ if self.cfnode.get_attr("dhchap", "key"):
+ info.append("hostkey=set")
+ else:
+ info.append("hostkey=unset")
+ if self.cfnode.get_attr("dhchap", "ctrl_key"):
+ info.append("ctrlkey=set")
+ else:
+ info.append("ctrlkey=unset")
return (", ".join(info), True)
def usage():
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvmetcli: support 'dhchap' attribute group
2022-06-27 15:08 ` Sagi Grimberg
@ 2022-06-27 15:13 ` Hannes Reinecke
0 siblings, 0 replies; 3+ messages in thread
From: Hannes Reinecke @ 2022-06-27 15:13 UTC (permalink / raw)
To: Sagi Grimberg, Christoph Hellwig; +Cc: Keith Busch, linux-nvme
On 6/27/22 17:08, Sagi Grimberg wrote:
>
>> 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@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)
>
>
> We shouldn't have a UI to the secrets themselves I think, we probably
> should do this instead:
> diff --git a/nvmetcli b/nvmetcli
> index 8da379bde9db..b06039b2338d 100755
> --- a/nvmetcli
> +++ b/nvmetcli
> @@ -663,7 +663,14 @@ class UIHostNode(UINode):
>
> def summary(self):
> info = []
> - info.append("key=" + self.cfnode.get_attr("dhchap", "key"))
> + if self.cfnode.get_attr("dhchap", "key"):
> + info.append("hostkey=set")
> + else:
> + info.append("hostkey=unset")
> + if self.cfnode.get_attr("dhchap", "ctrl_key"):
> + info.append("ctrlkey=set")
> + else:
> + info.append("ctrlkey=unset")
> return (", ".join(info), True)
>
> def usage():
Or just append 'hostkey' and/or 'ctrlkey' if set, and register nothing
if the keys are unset.
Good point, though. I'll be sending a new patch.
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-27 15:13 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23 7:33 [PATCH] nvmetcli: support 'dhchap' attribute group Hannes Reinecke
2022-06-27 15:08 ` Sagi Grimberg
2022-06-27 15:13 ` Hannes Reinecke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.