[PATCH 3/9] nvme/rc: add functions for in-band authentication
Hannes Reinecke
hare at suse.de
Sun Nov 21 23:55:18 PST 2021
Add functions to enable in-band authentication.
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
tests/nvme/rc | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/tests/nvme/rc b/tests/nvme/rc
index aa223df..7d05e4a 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -247,6 +247,17 @@ _create_nvmet_subsystem() {
_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
}
+_create_nvmet_host() {
+ local nvmet_subsystem="$1"
+ local nvmet_hostnqn="$2"
+ local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
+
+ mkdir "${NVMET_CFS}/hosts/${nvmet_hostnqn}"
+ echo 0 > "${cfs_path}/attr_allow_any_host"
+ ln -s "${NVMET_CFS}/hosts/${nvmet_hostnqn}" \
+ "${cfs_path}/allowed_hosts/${nvmet_hostnqn}"
+}
+
_remove_nvmet_ns() {
local nvmet_subsystem="$1"
local nsid=$2
@@ -266,6 +277,13 @@ _remove_nvmet_subsystem() {
rmdir "${subsys_path}"
}
+_remove_nvmet_host() {
+ local nvmet_host="$1"
+ local host_path="${NVMET_CFS}/hosts/${nvmet_host}"
+
+ rmdir "${host_path}"
+}
+
_create_nvmet_passthru() {
local nvmet_subsystem="$1"
local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
@@ -302,6 +320,42 @@ _remove_nvmet_subsystem_from_port() {
rm "${NVMET_CFS}/ports/${port}/subsystems/${nvmet_subsystem}"
}
+_set_nvmet_hostkey() {
+ local nvmet_hostnqn="$1"
+ local nvmet_hostkey="$2"
+ local cfs_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
+
+ echo "${nvmet_hostkey}" > \
+ "${cfs_path}/dhchap_key"
+}
+
+_set_nvmet_ctrlkey() {
+ local nvmet_hostnqn="$1"
+ local nvmet_ctrlkey="$2"
+ local cfs_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
+
+ echo "${nvmet_ctrlkey}" > \
+ "${cfs_path}/dhchap_ctrl_key"
+}
+
+_set_nvmet_hash() {
+ local nvmet_hostnqn="$1"
+ local nvmet_hash="$2"
+ local cfs_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
+
+ echo "${nvmet_hash}" > \
+ "${cfs_path}/dhchap_hash"
+}
+
+_set_nvmet_dhgroup() {
+ local nvmet_hostnqn="$1"
+ local nvmet_dhgroup="$2"
+ local cfs_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
+
+ echo "${nvmet_dhgroup}" > \
+ "${cfs_path}/dhchap_dhgroup"
+}
+
_find_nvme_dev() {
local subsys=$1
local subsysnqn
--
2.26.2
More information about the Linux-nvme
mailing list