|
|
712866 |
From 19bb8937ed492afdbde7076b74010e1fb2f3a7c4 Mon Sep 17 00:00:00 2001
|
|
|
712866 |
From: Harald Hoyer <harald@redhat.com>
|
|
|
712866 |
Date: Fri, 1 Aug 2014 13:16:29 +0200
|
|
|
712866 |
Subject: [PATCH] fixed bridge setup
|
|
|
712866 |
|
|
|
712866 |
renamed "ethnames" in bridge.info to "bridgeslaves"
|
|
|
712866 |
|
|
|
712866 |
fixed ifcfg generation
|
|
|
712866 |
|
|
|
712866 |
(cherry picked from commit 2db6d7111870c5d16d812d9cddc23558f3f4a202)
|
|
|
712866 |
---
|
|
|
712866 |
modules.d/40network/ifup.sh | 4 ++--
|
|
|
712866 |
modules.d/40network/net-genrules.sh | 2 +-
|
|
|
712866 |
modules.d/40network/parse-bridge.sh | 18 ++++++++--------
|
|
|
712866 |
modules.d/45ifcfg/write-ifcfg.sh | 42 +++++++++----------------------------
|
|
|
712866 |
4 files changed, 22 insertions(+), 44 deletions(-)
|
|
|
712866 |
|
|
|
712866 |
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
|
|
|
5c6c2a |
index 79127f24..43e84a2c 100755
|
|
|
712866 |
--- a/modules.d/40network/ifup.sh
|
|
|
712866 |
+++ b/modules.d/40network/ifup.sh
|
|
|
712866 |
@@ -60,7 +60,7 @@ fi
|
|
|
712866 |
# bridge this interface?
|
|
|
712866 |
if [ -e /tmp/bridge.info ]; then
|
|
|
712866 |
. /tmp/bridge.info
|
|
|
712866 |
- for ethname in $ethnames ; do
|
|
|
712866 |
+ for ethname in $bridgeslaves ; do
|
|
|
712866 |
if [ "$netif" = "$ethname" ]; then
|
|
|
712866 |
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
|
|
712866 |
: # We need to really setup bond (recursive call)
|
|
|
712866 |
@@ -236,7 +236,7 @@ if [ -e /tmp/bridge.info ]; then
|
|
|
712866 |
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
|
|
712866 |
brctl addbr $bridgename
|
|
|
712866 |
brctl setfd $bridgename 0
|
|
|
712866 |
- for ethname in $ethnames ; do
|
|
|
712866 |
+ for ethname in $bridgeslaves ; do
|
|
|
712866 |
if [ "$ethname" = "$bondname" ] ; then
|
|
|
712866 |
DO_BOND_SETUP=yes ifup $bondname -m
|
|
|
712866 |
elif [ "$ethname" = "$teammaster" ] ; then
|
|
|
712866 |
diff --git a/modules.d/40network/net-genrules.sh b/modules.d/40network/net-genrules.sh
|
|
|
5c6c2a |
index af2f09c1..a43e3df1 100755
|
|
|
712866 |
--- a/modules.d/40network/net-genrules.sh
|
|
|
712866 |
+++ b/modules.d/40network/net-genrules.sh
|
|
|
712866 |
@@ -16,7 +16,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
|
|
712866 |
# bridge: attempt only the defined interface
|
|
|
712866 |
if [ -e /tmp/bridge.info ]; then
|
|
|
712866 |
. /tmp/bridge.info
|
|
|
712866 |
- IFACES="$IFACES ${ethnames%% *}"
|
|
|
712866 |
+ IFACES="$IFACES ${bridgeslaves%% *}"
|
|
|
712866 |
MASTER_IFACES="$MASTER_IFACES $bridgename"
|
|
|
712866 |
fi
|
|
|
712866 |
|
|
|
712866 |
diff --git a/modules.d/40network/parse-bridge.sh b/modules.d/40network/parse-bridge.sh
|
|
|
5c6c2a |
index 8c305c0f..a9101094 100755
|
|
|
712866 |
--- a/modules.d/40network/parse-bridge.sh
|
|
|
712866 |
+++ b/modules.d/40network/parse-bridge.sh
|
|
|
712866 |
@@ -3,9 +3,9 @@
|
|
|
712866 |
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
|
712866 |
#
|
|
|
712866 |
# Format:
|
|
|
712866 |
-# bridge=<bridgename>:<ethnames>
|
|
|
712866 |
+# bridge=<bridgename>:<bridgeslaves>
|
|
|
712866 |
#
|
|
|
712866 |
-# <ethnames> is a comma-separated list of physical (ethernet) interfaces
|
|
|
712866 |
+# <bridgeslaves> is a comma-separated list of physical (ethernet) interfaces
|
|
|
712866 |
# bridge without parameters assumes bridge=br0:eth0
|
|
|
712866 |
#
|
|
|
712866 |
|
|
|
712866 |
@@ -25,20 +25,20 @@ parsebridge() {
|
|
|
712866 |
v=${v#*:}
|
|
|
712866 |
done
|
|
|
712866 |
|
|
|
712866 |
- unset bridgename ethnames
|
|
|
712866 |
+ unset bridgename bridgeslaves
|
|
|
712866 |
case $# in
|
|
|
712866 |
- 0) bridgename=br0; ethnames=$iface ;;
|
|
|
712866 |
+ 0) bridgename=br0; bridgeslaves=$iface ;;
|
|
|
712866 |
1) die "bridge= requires two parameters" ;;
|
|
|
712866 |
- 2) bridgename=$1; ethnames=$(str_replace "$2" "," " ") ;;
|
|
|
712866 |
+ 2) bridgename=$1; bridgeslaves=$(str_replace "$2" "," " ") ;;
|
|
|
712866 |
*) die "bridge= requires two parameters" ;;
|
|
|
712866 |
esac
|
|
|
712866 |
}
|
|
|
712866 |
|
|
|
712866 |
-unset bridgename ethnames
|
|
|
712866 |
+unset bridgename bridgeslaves
|
|
|
712866 |
|
|
|
712866 |
iface=eth0
|
|
|
712866 |
|
|
|
712866 |
-# Parse bridge for bridgename and ethnames
|
|
|
712866 |
+# Parse bridge for bridgename and bridgeslaves
|
|
|
712866 |
if bridge="$(getarg bridge)"; then
|
|
|
712866 |
# Read bridge= parameters if they exist
|
|
|
712866 |
if [ -n "$bridge" ]; then
|
|
|
712866 |
@@ -47,9 +47,9 @@ if bridge="$(getarg bridge)"; then
|
|
|
712866 |
# Simple default bridge
|
|
|
712866 |
if [ -z "$bridgename" ]; then
|
|
|
712866 |
bridgename=br0
|
|
|
712866 |
- ethnames=$iface
|
|
|
712866 |
+ bridgeslaves=$iface
|
|
|
712866 |
fi
|
|
|
712866 |
echo "bridgename=$bridgename" > /tmp/bridge.info
|
|
|
712866 |
- echo "ethnames=\"$ethnames\"" >> /tmp/bridge.info
|
|
|
712866 |
+ echo "bridgeslaves=\"$bridgeslaves\"" >> /tmp/bridge.info
|
|
|
712866 |
return
|
|
|
712866 |
fi
|
|
|
712866 |
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
|
|
|
5c6c2a |
index 5e333e45..c1cd23c3 100755
|
|
|
712866 |
--- a/modules.d/45ifcfg/write-ifcfg.sh
|
|
|
712866 |
+++ b/modules.d/45ifcfg/write-ifcfg.sh
|
|
|
712866 |
@@ -214,6 +214,7 @@ for netup in /tmp/net.*.did-setup ; do
|
|
|
712866 |
echo "SLAVE=yes"
|
|
|
712866 |
echo "MASTER=\"$netif\""
|
|
|
712866 |
echo "NAME=\"$slave\""
|
|
|
712866 |
+ echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
|
|
712866 |
} >> /tmp/ifcfg/ifcfg-$slave
|
|
|
712866 |
done
|
|
|
712866 |
fi
|
|
|
712866 |
@@ -224,44 +225,21 @@ for netup in /tmp/net.*.did-setup ; do
|
|
|
712866 |
echo "TYPE=Bridge"
|
|
|
712866 |
echo "NAME=\"$netif\""
|
|
|
712866 |
} >> /tmp/ifcfg/ifcfg-$netif
|
|
|
712866 |
- if [ "$ethname" = "$bondname" ] ; then
|
|
|
712866 |
- {
|
|
|
712866 |
- echo "# Generated by dracut initrd"
|
|
|
712866 |
- echo "DEVICE=\"$bondname\""
|
|
|
712866 |
- echo "ONBOOT=yes"
|
|
|
712866 |
- echo "NETBOOT=yes"
|
|
|
712866 |
- # This variable is an indicator of a bond interface for initscripts
|
|
|
712866 |
- echo "BONDING_OPTS=\"$bondoptions\""
|
|
|
712866 |
- echo "BRIDGE=\"$netif\""
|
|
|
712866 |
- echo "NAME=\"$bondname\""
|
|
|
712866 |
- } >> /tmp/ifcfg/ifcfg-$bondname
|
|
|
712866 |
- for slave in $bondslaves ; do
|
|
|
712866 |
- # write separate ifcfg file for the raw eth interface
|
|
|
712866 |
- {
|
|
|
712866 |
- echo "# Generated by dracut initrd"
|
|
|
712866 |
- echo "DEVICE=\"$slave\""
|
|
|
712866 |
- echo "TYPE=Ethernet"
|
|
|
712866 |
- echo "ONBOOT=yes"
|
|
|
712866 |
- echo "NETBOOT=yes"
|
|
|
712866 |
- echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
|
|
712866 |
- echo "SLAVE=yes"
|
|
|
712866 |
- echo "MASTER=\"$bondname\""
|
|
|
712866 |
- echo "NAME=\"$slave\""
|
|
|
712866 |
- } >> /tmp/ifcfg/ifcfg-$slave
|
|
|
712866 |
- done
|
|
|
712866 |
- else
|
|
|
712866 |
+ for slave in $bridgeslaves ; do
|
|
|
712866 |
# write separate ifcfg file for the raw eth interface
|
|
|
712866 |
{
|
|
|
712866 |
echo "# Generated by dracut initrd"
|
|
|
712866 |
- echo "DEVICE=\"$ethname\""
|
|
|
712866 |
+ echo "DEVICE=\"$slave\""
|
|
|
712866 |
echo "TYPE=Ethernet"
|
|
|
712866 |
echo "ONBOOT=yes"
|
|
|
712866 |
echo "NETBOOT=yes"
|
|
|
712866 |
- echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\""
|
|
|
712866 |
- echo "BRIDGE=\"$netif\""
|
|
|
712866 |
- echo "NAME=\"$ethname\""
|
|
|
712866 |
- } >> /tmp/ifcfg/ifcfg-$ethname
|
|
|
712866 |
- fi
|
|
|
712866 |
+ echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
|
|
|
712866 |
+ echo "SLAVE=yes"
|
|
|
712866 |
+ echo "MASTER=\"$bridgename\""
|
|
|
712866 |
+ echo "NAME=\"$slave\""
|
|
|
712866 |
+ echo "UUID=\"$(cat /proc/sys/kernel/random/uuid)\""
|
|
|
712866 |
+ } >> /tmp/ifcfg/ifcfg-$slave
|
|
|
712866 |
+ done
|
|
|
712866 |
fi
|
|
|
712866 |
i=1
|
|
|
712866 |
for ns in $(getargs nameserver); do
|