From e7f4acb6f7f902715277048be7cdba49c61189dd Mon Sep 17 00:00:00 2001
From: Rumbaut Thomas <Thomas.Rumbaut@digipolis.gent>
Date: Fri, 23 Oct 2020 12:38:04 +0200
Subject: [PATCH] Configure the runner for team interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=1881463
(cherry picked from commit e4483e5917b59918260ff0f0345abbea4a537f12)
Resolves: #1881463
---
dracut.cmdline.7.asc | 6 +++++-
modules.d/35network-legacy/parse-team.sh | 18 +++++++++++++-----
2 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
index 9003c430..e220defb 100644
--- a/dracut.cmdline.7.asc
+++ b/dracut.cmdline.7.asc
@@ -593,9 +593,13 @@ interface name. Better name it "bootnet" or "bluesocket".
Bond without parameters assumes
bond=bond0:eth0,eth1:mode=balance-rr
-**team=**__<teammaster>__:__<teamslaves>__::
+**team=**__<teammaster>__:__<teamslaves>__[:__<teamrunner>__]::
Setup team device <teammaster> on top of <teamslaves>.
<teamslaves> is a comma-separated list of physical (ethernet) interfaces.
+ <teamrunner> is the runner type to be used (see *teamd.conf*(5)); defaults to
+ activebackup.
+ Team without parameters assumes
+ team=team0:eth0,eth1:activebackup
**bridge=**__<bridgename>__:__<ethnames>__::
Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated
diff --git a/modules.d/35network-legacy/parse-team.sh b/modules.d/35network-legacy/parse-team.sh
index a6eef18e..03fbcf20 100755
--- a/modules.d/35network-legacy/parse-team.sh
+++ b/modules.d/35network-legacy/parse-team.sh
@@ -1,9 +1,12 @@
#!/bin/sh
#
# Format:
-# team=<teammaster>:<teamslaves>
+# team=<teammaster>:<teamslaves>[:<teamrunner>]
#
# teamslaves is a comma-separated list of physical (ethernet) interfaces
+# teamrunner is the runner type to be used (see teamd.conf(5)); defaults to activebackup
+#
+# team without parameters assumes team=team0:eth0,eth1:activebackup
#
parseteam() {
@@ -15,8 +18,11 @@ parseteam() {
done
case $# in
- 2) teammaster=$1; teamslaves=$(str_replace "$2" "," " ") ;;
- *) die "team= requires two parameters" ;;
+ 0) teammaster=team0; teamslaves="eth0 eth1"; teamrunner="activebackup" ;;
+ 1) teammaster=$1; teamslaves="eth0 eth1"; teamrunner="activebackup" ;;
+ 2) teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner="activebackup" ;;
+ 3) teammaster=$1; teamslaves=$(str_replace "$2" "," " "); teamrunner=$3 ;;
+ *) die "team= requires zero to three parameters" ;;
esac
return 0
}
@@ -26,16 +32,18 @@ for team in $(getargs team); do
unset teammaster
unset teamslaves
+ unset teamrunner
parseteam "$team" || continue
echo "teammaster=$teammaster" > /tmp/team.${teammaster}.info
echo "teamslaves=\"$teamslaves\"" >> /tmp/team.${teammaster}.info
+ echo "teamrunner=\"$teamrunner\"" >> /tmp/team.${teammaster}.info
if ! [ -e /etc/teamd/${teammaster}.conf ]; then
- warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using activebackup."
+ warn "Team master $teammaster specified, but no /etc/teamd/$teammaster.conf present. Using $teamrunner."
mkdir -p /etc/teamd
- printf -- "%s" '{"runner": {"name": "activebackup"}, "link_watch": {"name": "ethtool"}}' > "/etc/teamd/${teammaster}.conf"
+ printf -- "%s" "{\"runner\": {\"name\": \"$teamrunner\"}, \"link_watch\": {\"name\": \"ethtool\"}}" > "/tmp/${teammaster}.conf"
fi
done