From 0e2ef80993858992f6219b5162289568937a1fac Mon Sep 17 00:00:00 2001 From: Hannes Reinecke Date: Mon, 28 Sep 2020 13:39:07 +0200 Subject: [PATCH] 95nvmf: add nvmf-autoconnect script Add a script to run FC autoconnect. Signed-off-by: Hannes Reinecke --- modules.d/95nvmf/module-setup.sh | 2 ++ modules.d/95nvmf/nvmf-autoconnect.sh | 5 +++++ modules.d/95nvmf/parse-nvmf-boot-connections.sh | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/modules.d/95nvmf/module-setup.sh b/modules.d/95nvmf/module-setup.sh index 501ba8dd..268f1a2c 100755 --- a/modules.d/95nvmf/module-setup.sh +++ b/modules.d/95nvmf/module-setup.sh @@ -109,6 +109,8 @@ install() { inst_multiple ip sed + inst_script "${moddir}/nvmf-autoconnect.sh" /sbin/nvmf-autoconnect.sh + inst_multiple nvme inst_hook cmdline 99 "$moddir/parse-nvmf-boot-connections.sh" inst_simple "/etc/nvme/discovery.conf" diff --git a/modules.d/95nvmf/nvmf-autoconnect.sh b/modules.d/95nvmf/nvmf-autoconnect.sh new file mode 100644 index 00000000..c8f676a7 --- /dev/null +++ b/modules.d/95nvmf/nvmf-autoconnect.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +[ -f /sys/class/fc/fc_udev_device/nvme_discovery ] || exit 1 +echo add > /sys/class/fc/fc_udev_device/nvme_discovery +exit 0 diff --git a/modules.d/95nvmf/parse-nvmf-boot-connections.sh b/modules.d/95nvmf/parse-nvmf-boot-connections.sh index 3ff731f1..5a19c84e 100755 --- a/modules.d/95nvmf/parse-nvmf-boot-connections.sh +++ b/modules.d/95nvmf/parse-nvmf-boot-connections.sh @@ -132,6 +132,6 @@ if [ -f "/etc/nvme/discovery.conf" ] ; then else # No nvme command line arguments present, try autodiscovery if [ "$trtype" = "fc" ] ; then - /sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect echo 1 > /sys/class/fc/fc_udev_device/nvme_discovery + /sbin/initqueue --finished --onetime --unique --name nvme-fc-autoconnect /sbin/nvmf-autoconnect.sh fi fi