]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Configure the runner for team interfaces
authorRumbaut Thomas <Thomas.Rumbaut@digipolis.gent>
Fri, 23 Oct 2020 10:38:04 +0000 (12:38 +0200)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 26 Oct 2020 11:52:24 +0000 (12:52 +0100)
https://bugzilla.redhat.com/show_bug.cgi?id=1881463

dracut.cmdline.7.asc
modules.d/35network-legacy/parse-team.sh

index 7ce7df2cea2657d107b3ce8c840330c86c7c2cc0..3524adfd92a3f8cbf69b0f0b4facf14fc2e72129 100644 (file)
@@ -667,9 +667,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
index a6eef18efe0e5d37428f83839c897c7bdd0df2d4..03fbcf20d7644cae9102d2396cacf1d1e4cae052 100755 (executable)
@@ -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