Blame 0063-95fcoe-start-lldpad-separately.patch

Harald Hoyer b94732
From 22e837b6458d5d17d1cb6a9b09b7515746d4e098 Mon Sep 17 00:00:00 2001
Harald Hoyer b94732
From: Hannes Reinecke <hare@suse.de>
Harald Hoyer b94732
Date: Thu, 11 Dec 2014 15:46:24 +0100
Harald Hoyer b94732
Subject: [PATCH] 95fcoe: start lldpad separately
Harald Hoyer b94732
Harald Hoyer b94732
lldpad is a system-wide process, which must be started only once.
Harald Hoyer b94732
So we should be separate it from fcoe-up, as it might be called
Harald Hoyer b94732
several times.
Harald Hoyer b94732
Harald Hoyer b94732
Signed-off-by: Hannes Reinecke <hare@suse.de>
Harald Hoyer b94732
Signed-off-by: Thomas Renninger <trenn@suse.de>
Harald Hoyer b94732
---
Harald Hoyer b94732
 modules.d/95fcoe/fcoe-up.sh      |  8 --------
Harald Hoyer b94732
 modules.d/95fcoe/lldpad.sh       | 14 ++++++++++++++
Harald Hoyer b94732
 modules.d/95fcoe/module-setup.sh |  1 +
Harald Hoyer b94732
 3 files changed, 15 insertions(+), 8 deletions(-)
Harald Hoyer b94732
 create mode 100644 modules.d/95fcoe/lldpad.sh
Harald Hoyer b94732
Harald Hoyer b94732
diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh
Harald Hoyer b94732
index 7f6eb1b..43a0ad5 100755
Harald Hoyer b94732
--- a/modules.d/95fcoe/fcoe-up.sh
Harald Hoyer b94732
+++ b/modules.d/95fcoe/fcoe-up.sh
Harald Hoyer b94732
@@ -30,10 +30,6 @@ netdriver=$(readlink -f /sys/class/net/$netif/device/driver)
Harald Hoyer b94732
 netdriver=${netdriver##*/}
Harald Hoyer b94732
 
Harald Hoyer b94732
 if [ "$dcb" = "dcb" ]; then
Harald Hoyer b94732
-    # Note lldpad will stay running after switchroot, the system initscripts
Harald Hoyer b94732
-    # are to kill it and start a new lldpad to take over. Data is transfered
Harald Hoyer b94732
-    # between the 2 using a shm segment
Harald Hoyer b94732
-    lldpad -d
Harald Hoyer b94732
     # wait for lldpad to be ready
Harald Hoyer b94732
     i=0
Harald Hoyer b94732
     while [ $i -lt 60 ]; do
Harald Hoyer b94732
@@ -43,10 +39,6 @@ if [ "$dcb" = "dcb" ]; then
Harald Hoyer b94732
         i=$(($i+1))
Harald Hoyer b94732
     done
Harald Hoyer b94732
 
Harald Hoyer b94732
-    # on some systems lldpad needs some time
Harald Hoyer b94732
-    # sleep until we find a better solution
Harald Hoyer b94732
-    sleep 30
Harald Hoyer b94732
-
Harald Hoyer b94732
     while [ $i -lt 60 ]; do
Harald Hoyer b94732
         dcbtool sc "$netif" dcb on && break
Harald Hoyer b94732
         info "Retrying to turn dcb on"
Harald Hoyer b94732
diff --git a/modules.d/95fcoe/lldpad.sh b/modules.d/95fcoe/lldpad.sh
Harald Hoyer b94732
new file mode 100644
Harald Hoyer b94732
index 0000000..d06a3bd
Harald Hoyer b94732
--- /dev/null
Harald Hoyer b94732
+++ b/modules.d/95fcoe/lldpad.sh
Harald Hoyer b94732
@@ -0,0 +1,14 @@
Harald Hoyer b94732
+#!/bin/bash
Harald Hoyer b94732
+
Harald Hoyer b94732
+# Note lldpad will stay running after switchroot, the system initscripts
Harald Hoyer b94732
+# are to kill it and start a new lldpad to take over. Data is transfered
Harald Hoyer b94732
+# between the 2 using a shm segment
Harald Hoyer b94732
+lldpad -d
Harald Hoyer b94732
+# wait for lldpad to be ready
Harald Hoyer b94732
+i=0
Harald Hoyer b94732
+while [ $i -lt 60 ]; do
Harald Hoyer b94732
+    lldptool -p && break
Harald Hoyer b94732
+    info "Waiting for lldpad to be ready"
Harald Hoyer b94732
+    sleep 1
Harald Hoyer b94732
+    i=$(($i+1))
Harald Hoyer b94732
+done
Harald Hoyer b94732
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
Harald Hoyer b94732
index 174745a..9c67f17 100755
Harald Hoyer b94732
--- a/modules.d/95fcoe/module-setup.sh
Harald Hoyer b94732
+++ b/modules.d/95fcoe/module-setup.sh
Harald Hoyer b94732
@@ -78,6 +78,7 @@ install() {
Harald Hoyer b94732
     inst "$moddir/fcoe-up.sh" "/sbin/fcoe-up"
Harald Hoyer b94732
     inst "$moddir/fcoe-edd.sh" "/sbin/fcoe-edd"
Harald Hoyer b94732
     inst "$moddir/fcoe-genrules.sh" "/sbin/fcoe-genrules.sh"
Harald Hoyer b94732
+    inst_hook pre-trigger 03 "$moddir/lldpad.sh"
Harald Hoyer b94732
     inst_hook cmdline 99 "$moddir/parse-fcoe.sh"
Harald Hoyer b94732
     dracut_need_initqueue
Harald Hoyer b94732
 }