Re: [PATCH blktests v2 10/12] nvme/rc: Add helper for adding/removing to allow list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Aug 10, 2023 / 13:13, Daniel Wagner wrote:
> Add two helpers to add or remove the host from the allow list of the
> subsystem.
> 
> Signed-off-by: Daniel Wagner <dwagner@xxxxxxx>
> ---
>  tests/nvme/rc | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/nvme/rc b/tests/nvme/rc
> index 7f5829a2e58d..706f95d74a4b 100644
> --- a/tests/nvme/rc
> +++ b/tests/nvme/rc
> @@ -612,6 +612,23 @@ _create_nvmet_subsystem() {
>  	_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
>  }
>  
> +_add_nvmet_allow_hosts() {
> +	local nvmet_subsystem="$1"
> +	local nvmet_hostnqn="$2"
> +	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
> +	local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
> +
> +	ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}"
> +}
> +
> +_remove_nvmet_allow_hosts() {
> +	local nvmet_subsystem="$1"
> +	local nvmet_hostnqn="$2"
> +	local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
> +
> +	rm "${cfs_path}/allowed_hosts/${nvmet_hostnqn}"
> +}
> +
>  _create_nvmet_host() {
>  	local nvmet_subsystem="$1"
>  	local nvmet_hostnqn="$2"
> @@ -621,8 +638,7 @@ _create_nvmet_host() {
>  	local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}"
>  
>  	mkdir "${host_path}"
> -	echo 0 > "${cfs_path}/attr_allow_any_host"
> -	ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}"
> +	_add_nvmet_allow_hosts "${nvmet_subsystem}" "${nvmet_hostnqn}"

Nit: with this change, local variable cfs_path is no longer required in
_create_nvmet_host(). I suggest to remove it in this patch.

>  	if [[ "${nvmet_hostkey}" ]] ; then
>  		echo "${nvmet_hostkey}" > "${host_path}/dhchap_key"
>  	fi
> -- 
> 2.41.0
> 



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux