dracut/0163.patch
2020-10-06 10:41:54 +02:00

88 lines
2.9 KiB
Diff

From 251b424727492955041178766ce7e17ae4fc91ff Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.com>
Date: Mon, 28 Sep 2020 14:02:28 +0200
Subject: [PATCH] 95nvmf: Implement 'fc,auto' commandline syntax
Add a 'fc,auto' commandline syntax for nvmf.discover to force
nvmf autodiscovery on FC-NVMe.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
dracut.cmdline.7.asc | 2 ++
modules.d/95nvmf/parse-nvmf-boot-connections.sh | 16 +++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index f7f34d05..7ce7df2c 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -874,6 +874,8 @@ NVMf
_<traddr>_ and the optionally _<host_traddr>_ or _<trsvcid>_.
The first argument specifies the transport to use; currently only
'rdma', 'fc', or 'tcp' are supported.
+ The _<traddr>_ parameter can be set to 'auto' to select
+ autodiscovery; in that case all other parameters are ignored.
This parameter can be specified multiple times.
NBD
diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh
index 5a19c84e..eb10dc97 100755
--- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh
+++ b/modules.d/95nvmf/parse-nvmf-boot-connections.sh
@@ -11,6 +11,7 @@
# nvmf.discover=tcp,192.168.1.3,,4420
# nvmf.discover=tcp,192.168.1.3
# nvmf.discover=fc,nn-0x200400a098d85236:pn-0x201400a098d85236,nn-0x200000109b7db455:pn-0x100000109b7db455
+# nvmf.discover=fc,auto
#
# Note: FC does autodiscovery, so typically there is no need to
# specify any discover parameters for FC.
@@ -81,21 +82,25 @@ parse_nvmf_discover() {
;;
*)
warn "Invalid arguments for nvmf.discover=$1"
- return 1
+ return 0
;;
esac
if [ "$traddr" = "none" ] ; then
warn "traddr is mandatory for $trtype"
- return 1;
+ return 0;
fi
if [ "$trtype" = "fc" ] ; then
+ if [ "$traddr" = "auto" ] ; then
+ rm /etc/nvme/discovery.conf
+ return 1
+ fi
if [ "$hosttraddr" = "none" ] ; then
warn "host traddr is mandatory for fc"
- return 1
+ return 0
fi
elif [ "$trtype" != "rdma" ] && [ "$trtype" != "tcp" ] ; then
warn "unsupported transport $trtype"
- return 1
+ return 0
fi
if [ "$trtype" = "tcp" ]; then
validate_ip_conn
@@ -105,6 +110,7 @@ parse_nvmf_discover() {
else
echo "--transport=$trtype --traddr=$traddr --host-traddr=$hosttraddr --trsvcid=$trsvcid" >> /etc/nvme/discovery.conf
fi
+ return 0
}
nvmf_hostnqn=$(getarg nvmf.hostnqn=)
@@ -117,7 +123,7 @@ if [ -n "$nvmf_hostid" ] ; then
fi
for d in $(getargs nvmf.discover=); do
- parse_nvmf_discover "$d"
+ parse_nvmf_discover "$d" || break
done
# Host NQN and host id are mandatory for NVMe-oF