|
|
712866 |
From f501c955e86eb3043ab5e3c5f2648ed4c8bb58a3 Mon Sep 17 00:00:00 2001
|
|
|
712866 |
From: Hannes Reinecke <hare@suse.de>
|
|
|
712866 |
Date: Thu, 11 Dec 2014 15:46:22 +0100
|
|
|
712866 |
Subject: [PATCH] 95fcoe: Store current configuration in dracut cmdline
|
|
|
712866 |
|
|
|
712866 |
When running with --hostonly-cmdline we should be storing
|
|
|
712866 |
the current configuration in /etc/cmdline.d so that dracut
|
|
|
712866 |
will be configure the system automatically.
|
|
|
712866 |
|
|
|
712866 |
References: bnc#877288
|
|
|
712866 |
|
|
|
712866 |
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
|
|
712866 |
Signed-off-by: Thomas Renninger <trenn@suse.de>
|
|
|
712866 |
(cherry picked from commit 8b257fcc86f9a470613c1a5719641144a688acf7)
|
|
|
712866 |
---
|
|
|
712866 |
modules.d/95fcoe/module-setup.sh | 45 ++++++++++++++++++++++++++++++++++++++++
|
|
|
712866 |
1 file changed, 45 insertions(+)
|
|
|
712866 |
|
|
|
712866 |
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
|
|
|
5c6c2a |
index c000b3be..af2798dc 100755
|
|
|
712866 |
--- a/modules.d/95fcoe/module-setup.sh
|
|
|
712866 |
+++ b/modules.d/95fcoe/module-setup.sh
|
|
|
712866 |
@@ -13,6 +13,7 @@ check() {
|
|
|
712866 |
}
|
|
|
712866 |
|
|
|
712866 |
require_binaries dcbtool fipvlan lldpad ip readlink fcoemon fcoeadm || return 1
|
|
|
712866 |
+
|
|
|
712866 |
return 0
|
|
|
712866 |
}
|
|
|
712866 |
|
|
|
712866 |
@@ -25,6 +26,46 @@ installkernel() {
|
|
|
712866 |
instmods fcoe 8021q edd
|
|
|
712866 |
}
|
|
|
712866 |
|
|
|
712866 |
+get_vlan_parent() {
|
|
|
712866 |
+ local link=$1
|
|
|
712866 |
+
|
|
|
712866 |
+ [ -d $link ] || return
|
|
|
712866 |
+ read iflink < $link/iflink
|
|
|
712866 |
+ for if in /sys/class/net/* ; do
|
|
|
712866 |
+ read idx < $if/ifindex
|
|
|
712866 |
+ if [ $idx -eq $iflink ] ; then
|
|
|
712866 |
+ echo ${if##*/}
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ done
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+# called by dracut
|
|
|
712866 |
+cmdline() {
|
|
|
712866 |
+
|
|
|
712866 |
+ for c in /sys/bus/fcoe/devices/ctlr_* ; do
|
|
|
712866 |
+ [ -L $c ] || continue
|
|
|
712866 |
+ read enabled < $c/enabled
|
|
|
712866 |
+ [ $enabled -eq 0 ] && continue
|
|
|
712866 |
+ d=$(cd -P $c; echo $PWD)
|
|
|
712866 |
+ i=${d%/*}
|
|
|
712866 |
+ read mac < ${i}/address
|
|
|
712866 |
+ s=$(dcbtool gc ${i##*/} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
|
|
|
712866 |
+ if [ -z "$s" ] ; then
|
|
|
712866 |
+ p=$(get_vlan_parent ${i})
|
|
|
712866 |
+ if [ "$p" ] ; then
|
|
|
712866 |
+ s=$(dcbtool gc ${p} dcb | sed -n 's/^DCB State:\t*\(.*\)/\1/p')
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ if [ "$s" = "on" ] ; then
|
|
|
712866 |
+ dcb="dcb"
|
|
|
712866 |
+ else
|
|
|
712866 |
+ dcb="nodcb"
|
|
|
712866 |
+ fi
|
|
|
712866 |
+ echo "fcoe=${mac}:${dcb}"
|
|
|
712866 |
+ done
|
|
|
712866 |
+}
|
|
|
712866 |
+
|
|
|
712866 |
+# called by dracut
|
|
|
712866 |
install() {
|
|
|
712866 |
inst_multiple ip dcbtool fipvlan lldpad readlink lldptool fcoemon fcoeadm
|
|
|
712866 |
inst_libdir_file 'libhbalinux.so*'
|
|
|
712866 |
@@ -33,6 +74,10 @@ install() {
|
|
|
712866 |
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
|
|
|
712866 |
mkdir -m 0755 -p "$initdir/etc/fcoe"
|
|
|
712866 |
|
|
|
712866 |
+ if [[ $hostonly_cmdline == "yes" ]] ; then
|
|
|
712866 |
+ local _fcoeconf=$(cmdline)
|
|
|
712866 |
+ [[ $_fcoeconf ]] && printf "%s\n" "$_fcoeconf" >> "${initdir}/etc/cmdline.d/95fcoe.conf"
|
|
|
712866 |
+ fi
|
|
|
712866 |
inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
|
|
|
712866 |
inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
|
|
|
712866 |
inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
|