fix(nvmf): shellcheck for modules.d/95nvmf
parent
d15441cef4
commit
c305877c58
|
@ -29,7 +29,7 @@ check() {
|
|||
pushd . > /dev/null
|
||||
for_each_host_dev_and_slaves is_nvmf
|
||||
local _is_nvmf=$?
|
||||
popd > /dev/null
|
||||
popd > /dev/null || exit
|
||||
[[ $_is_nvmf == 0 ]] || return 255
|
||||
if [ ! -f /sys/class/fc/fc_udev_device/nvme_discovery ]; then
|
||||
if [ ! -f /etc/nvme/discovery.conf ]; then
|
||||
|
@ -76,7 +76,7 @@ cmdline() {
|
|||
done
|
||||
|
||||
[ -z "$trtype" ] && return 0
|
||||
nvme list-subsys ${PWD##*/} | while read x dev trtype traddr host_traddr state ana; do
|
||||
nvme list-subsys "${PWD##*/}" | while read -r _ _ trtype traddr host_traddr _; do
|
||||
[ "$trtype" != "${trtype#NQN}" ] && continue
|
||||
echo -n " nvmf.discover=$trtype,${traddr#traddr=},${host_traddr#host_traddr=}"
|
||||
done
|
||||
|
@ -94,14 +94,15 @@ cmdline() {
|
|||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
pushd . > /dev/null
|
||||
for_each_host_dev_and_slaves gen_nvmf_cmdline
|
||||
popd > /dev/null
|
||||
popd > /dev/null || exit
|
||||
}
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
if [[ $hostonly_cmdline == "yes" ]]; then
|
||||
local _nvmf_args=$(cmdline)
|
||||
local _nvmf_args
|
||||
_nvmf_args=$(cmdline)
|
||||
[[ "$_nvmf_args" ]] && printf "%s" "$_nvmf_args" >> "${initdir}/etc/cmdline.d/95nvmf-args.conf"
|
||||
fi
|
||||
inst_simple "/etc/nvme/hostnqn"
|
||||
|
|
|
@ -32,7 +32,7 @@ validate_ip_conn() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
local_address=$(ip -o route get to $traddr | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
|
||||
local_address=$(ip -o route get to "$traddr" | sed -n 's/.*src \([0-9a-f.:]*\).*/\1/p')
|
||||
|
||||
# confirm we got a local IP address
|
||||
if ! is_ip "$local_address"; then
|
||||
|
@ -40,7 +40,7 @@ validate_ip_conn() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
ifname=$(ip -o route get to $local_address | sed -n 's/.*dev \([^ ]*\).*/\1/p')
|
||||
ifname=$(ip -o route get to "$local_address" | sed -n 's/.*dev \([^ ]*\).*/\1/p')
|
||||
|
||||
if ip l show "$ifname" > /dev/null 2>&1; then
|
||||
warn "invalid network interface $ifname"
|
||||
|
@ -61,7 +61,8 @@ parse_nvmf_discover() {
|
|||
trsvcid=4420
|
||||
OLDIFS="$IFS"
|
||||
IFS=,
|
||||
set $1
|
||||
# shellcheck disable=SC2086
|
||||
set -- $1
|
||||
IFS="$OLDIFS"
|
||||
|
||||
case $# in
|
||||
|
@ -133,7 +134,7 @@ done
|
|||
if [ -f "/etc/nvme/discovery.conf" ]; then
|
||||
/sbin/initqueue --settled --onetime --unique --name nvme-discover /usr/sbin/nvme connect-all
|
||||
if [ "$trtype" = "tcp" ]; then
|
||||
> /tmp/net.$ifname.did-setup
|
||||
: > /tmp/net."$ifname".did-setup
|
||||
fi
|
||||
else
|
||||
# No nvme command line arguments present, try autodiscovery
|
||||
|
|
Loading…
Reference in New Issue