Compare commits
10 Commits
25adb0abaf
...
88ad52940e
Author | SHA1 | Date |
---|---|---|
Xin Long | 88ad52940e | |
Xin Long | 4803b1ed2f | |
Xin Long | bfca2586bc | |
Xin Long | f705e8645d | |
Hangbin Liu | 82e623b614 | |
Hangbin Liu | 260f1f5ad8 | |
Xin Long | 906ee3b76f | |
Hangbin Liu | c7caea31ca | |
Mohan Boddu | 29fad0f8b6 | |
Hangbin Liu | ca94379df6 |
|
@ -0,0 +1 @@
|
|||
338f2bae08e143bc3f7a84317ddc3053cff2691d libteam-1.31.tar.gz
|
|
@ -0,0 +1,79 @@
|
|||
From ad9cf008dfed4918e3d1e521647e5f44f46bfc91 Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <haliu@redhat.com>
|
||||
Date: Wed, 21 Jul 2021 14:23:55 +0800
|
||||
Subject: [PATCH 3/4] utils/team2bond: add cautions for the script
|
||||
|
||||
Split the exec-cmd to Dangerous groups and add cautions to let customer
|
||||
know they need to remove old team device. Also fix a typo.
|
||||
|
||||
Add parameter "actual" when dump team config.
|
||||
|
||||
Signed-off-by: Hangbin Liu <haliu@redhat.com>
|
||||
---
|
||||
utils/team2bond | 19 +++++++++++++------
|
||||
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/utils/team2bond b/utils/team2bond
|
||||
index 265bc79..118f38b 100755
|
||||
--- a/utils/team2bond
|
||||
+++ b/utils/team2bond
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/env python3
|
||||
# vim: sts=4 ts=4 sw=4 expandtab :
|
||||
|
||||
-from optparse import OptionParser
|
||||
+from optparse import OptionParser, OptionGroup
|
||||
import subprocess
|
||||
import json
|
||||
import sys
|
||||
@@ -11,7 +11,7 @@ def handle_cmd_line():
|
||||
parser.add_option('--config', dest='config', default = '',
|
||||
help = "convert the team JSON format configuration file " \
|
||||
+ "to NetworkManager connection profile, please use " \
|
||||
- + "'teamdctl TEAM config dump' to dump the config file." \
|
||||
+ + "'teamdctl TEAM config dump [actual]' to dump the config file." \
|
||||
+ " Note the script only convert config file. IP " \
|
||||
+ "address configurations still need to be set manually.")
|
||||
parser.add_option('--rename', dest='rename', default = '',
|
||||
@@ -19,11 +19,17 @@ def handle_cmd_line():
|
||||
+ " Careful: firewall rules, aliases interfaces, etc., " \
|
||||
+ "will break after the renaming because the tool " \
|
||||
+ "will only change the config file, nothing else.")
|
||||
- parser.add_option('--exec-cmd', dest='exec_cmd', action='store_true', default = False,
|
||||
+
|
||||
+ group = OptionGroup(parser, 'Dangerous Options',
|
||||
+ "Caution: You need to dump the team configuration " \
|
||||
+ "file first and then delete old team device to avoid " \
|
||||
+ "device name conflicts.")
|
||||
+ group.add_option('--exec-cmd', dest='exec_cmd', action='store_true', default = False,
|
||||
help = "exec nmcli and add the connections directly " \
|
||||
+ "instead of printing the nmcli cmd to screen. " \
|
||||
- + "This parameter is NOT recommend, it would be good " \
|
||||
+ + "This parameter is NOT recommended, it would be good " \
|
||||
+ "to double check the cmd before apply.")
|
||||
+ parser.add_option_group(group)
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
@@ -302,7 +308,8 @@ def main():
|
||||
|
||||
if not options.exec_cmd:
|
||||
print("### These are the commands to configure a bond interface " +
|
||||
- "similar to this team config:")
|
||||
+ "similar to this team config (remember to remove the old team " +
|
||||
+ "device before exec the following cmds):")
|
||||
|
||||
if options.rename:
|
||||
bond_name = options.rename
|
||||
@@ -313,7 +320,7 @@ def main():
|
||||
setup_ports(bond_name, team_opts, options.exec_cmd)
|
||||
|
||||
if not options.exec_cmd:
|
||||
- print("### After this, IP addresses, routes and so need to be reconfigured.")
|
||||
+ print("### After this, IP addresses, routes, and so on, need to be configured.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
From ff20b5982cf674e8a0a7267645963a79d2e46729 Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <haliu@redhat.com>
|
||||
Date: Wed, 21 Jul 2021 17:31:59 +0800
|
||||
Subject: [PATCH 4/4] man: add team2bond man doc
|
||||
|
||||
Signed-off-by: Hangbin Liu <haliu@redhat.com>
|
||||
---
|
||||
man/Makefile.am | 2 +-
|
||||
man/team2bond.1 | 69 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 70 insertions(+), 1 deletion(-)
|
||||
create mode 100644 man/team2bond.1
|
||||
|
||||
diff --git a/man/Makefile.am b/man/Makefile.am
|
||||
index 4c63629..52f0fb9 100644
|
||||
--- a/man/Makefile.am
|
||||
+++ b/man/Makefile.am
|
||||
@@ -1,3 +1,3 @@
|
||||
dist_man8_MANS = teamd.8 teamdctl.8 teamnl.8
|
||||
dist_man5_MANS = teamd.conf.5
|
||||
-dist_man1_MANS = bond2team.1
|
||||
+dist_man1_MANS = bond2team.1 team2bond.1
|
||||
diff --git a/man/team2bond.1 b/man/team2bond.1
|
||||
new file mode 100644
|
||||
index 0000000..f47aba4
|
||||
--- /dev/null
|
||||
+++ b/man/team2bond.1
|
||||
@@ -0,0 +1,69 @@
|
||||
+.TH TEAM2BOND 1 "2021-07-20" "libteam" "Team to Bonding conversion tool"
|
||||
+.SH NAME
|
||||
+team2bond \(em Converts a team configuration to a NetworkManager bond configuration
|
||||
+.SH SYNOPSIS
|
||||
+.B team2bond
|
||||
+.RB [options]
|
||||
+.SH DESCRIPTION
|
||||
+.PP
|
||||
+team2bond is a tool to convert team options to bonding options. During the conversion, team2bond tries to create a bond configuration that has the same or similar functionality as the team.
|
||||
+.PP
|
||||
+This tool converts a team JSON format configuration file to NetworkManager nmcli commands that you can use to set up a network bonding device. After verifying the commands and deleting the corresponding team device, run the nmcli commands manually or with parameter
|
||||
+.B \-\-exec
|
||||
+to create the NetworkManager connection profile.
|
||||
+.PP
|
||||
+.B Important:
|
||||
+Note that deleting the team device makes this connection unavailable until you recreated the bond.
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+.B "\-\-config <team json config file>"
|
||||
+Specifies the team JSON format configuration file to convert. Use the 'teamdctl <TEAMNAME> config dump [actual]' command to create the JSON file.
|
||||
+.TP
|
||||
+.B "\-\-rename <interface>"
|
||||
+This is a convenient option to replace the original interface name with the specified name. For example, use \-\-rename bond0 to change the interface name to bond0. Note, firewall rules, alias interfaces, and so on, that are tied to the original interface name can break after the renaming an interface because the tool only changes the NetworkManager profile.
|
||||
+.TP
|
||||
+.B "\-\-help"
|
||||
+Print a help text to console and exit.
|
||||
+.SH DANGEROUS OPTION
|
||||
+.TP
|
||||
+.B "\-\-exec"
|
||||
+Executes the generated nmcli commands and adds the connections directly instead of printing then to the screen. This parameter is NOT recommended. Double-check the generated commands before you apply them.
|
||||
+.SH EXAMPLE STEPS
|
||||
+.TP
|
||||
+1. Save the current 'team0' ip addresses, firewall rules, alias, etc.
|
||||
+.TP
|
||||
+2. Dump the current 'team0' configuration to a JSON file. Using the 'actual' option, team2bond dumps the actual config instead of the initial config:
|
||||
+.TP
|
||||
+.RS 1
|
||||
+# teamdctl team0 config dump actual > team0.json
|
||||
+.RE
|
||||
+.TP
|
||||
+3. Run the team2bond utility in dry-run mode to display nmcli commands that set up a network bond with similar settings as the team device:
|
||||
+.TP
|
||||
+.RS 1
|
||||
+# team2bond \%--config team0.json
|
||||
+.RE
|
||||
+.TP
|
||||
+To convert the current 'team0' configuration to bonding connection profile and rename the interface name to 'bond0':
|
||||
+.TP
|
||||
+.RS 1
|
||||
+# team2bond \%--config team0.json \%--rename bond0
|
||||
+.RE
|
||||
+.TP
|
||||
+4. Examine these generated nmcli commands, and make sure all parameters are correct.
|
||||
+.TP
|
||||
+5. Delete the team0 device by using the teamd or nmcli utility to avoid a device conflict. Then execute the commands the team2bond utility displayed in the previous step manually or use the \-\-exec option:
|
||||
+.TP
|
||||
+.RS 1
|
||||
+# team2bond \%--config team0.json \%--rename bond0 \%--exec
|
||||
+.RE
|
||||
+.SH CAVEATS
|
||||
+.PP
|
||||
+The tool will not convert any other configuration which might be tied to the current setup. For instance, IP addresses, firewall rules, alias interfaces, bridges, and so on.
|
||||
+.SH AUTHOR
|
||||
+.PP
|
||||
+Hangbin Liu <haliu@redhat.com>
|
||||
+.SH SEE ALSO
|
||||
+.BR nmcli (1),
|
||||
+.BR teamdctl (8),
|
||||
+.BR teamd.conf (5).
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
From 61efd6de2fbb8ee077863ee5a355ac3dfd9365b9 Mon Sep 17 00:00:00 2001
|
||||
From: Xin Long <lucien.xin@gmail.com>
|
||||
Date: Tue, 1 Sep 2020 13:59:27 +0800
|
||||
Subject: [PATCH] Revert "teamd: Disregard current state when considering port
|
||||
enablement"
|
||||
|
||||
This reverts commit deadb5b715227429a1879b187f5906b39151eca9.
|
||||
|
||||
As Patrick noticed, with that commit, teamd_port_check_enable()
|
||||
would set the team port to the new state unconditionally, which
|
||||
triggers another change message from kernel to userspace, then
|
||||
teamd_port_check_enable() is called again to set the team port
|
||||
to the new state.
|
||||
|
||||
This would go around and around to update the team port state,
|
||||
and even cause teamd to consume 100% cpu.
|
||||
|
||||
As the issue caused by that commit is serious, it has to be
|
||||
reverted. As for the issued fixed by that commit, I would
|
||||
propose a new fix later.
|
||||
|
||||
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
|
||||
---
|
||||
teamd/teamd_per_port.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c
|
||||
index 166da57..d429753 100644
|
||||
--- a/teamd/teamd_per_port.c
|
||||
+++ b/teamd/teamd_per_port.c
|
||||
@@ -442,14 +442,18 @@ int teamd_port_check_enable(struct teamd_context *ctx,
|
||||
bool should_enable, bool should_disable)
|
||||
{
|
||||
bool new_enabled_state;
|
||||
+ bool curr_enabled_state;
|
||||
int err;
|
||||
|
||||
if (!teamd_port_present(ctx, tdport))
|
||||
return 0;
|
||||
+ err = teamd_port_enabled(ctx, tdport, &curr_enabled_state);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
|
||||
- if (should_enable)
|
||||
+ if (!curr_enabled_state && should_enable)
|
||||
new_enabled_state = true;
|
||||
- else if (should_disable)
|
||||
+ else if (curr_enabled_state && should_disable)
|
||||
new_enabled_state = false;
|
||||
else
|
||||
return 0;
|
||||
--
|
||||
2.27.0
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
From 5616af4387302e9e6ec07dd5466f4a0e93c50a59 Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <haliu@redhat.com>
|
||||
Date: Mon, 7 Mar 2022 14:39:25 +0800
|
||||
Subject: [PATCH 6/6] utils/team2bond: do not add miimon if already exist
|
||||
|
||||
Signed-off-by: Hangbin Liu <haliu@redhat.com>
|
||||
---
|
||||
utils/team2bond | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/utils/team2bond b/utils/team2bond
|
||||
index 118f38b..b5555c1 100755
|
||||
--- a/utils/team2bond
|
||||
+++ b/utils/team2bond
|
||||
@@ -117,7 +117,8 @@ def convert_link_watch(link_watch_opts, arp_target, exist_opts):
|
||||
sys.exit(1)
|
||||
|
||||
if link_watch_opts['name'] == 'ethtool':
|
||||
- bond_opts += ",miimon=100"
|
||||
+ if exist_opts.find("miimon") == -1:
|
||||
+ bond_opts += ",miimon=100"
|
||||
if 'delay_up' in link_watch_opts:
|
||||
bond_opts += ",updelay=" + str(link_watch_opts['delay_up'])
|
||||
if 'delay_down' in link_watch_opts:
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
From de84fb3debdf55080bafbf015d76989c17276d01 Mon Sep 17 00:00:00 2001
|
||||
From: Hangbin Liu <haliu@redhat.com>
|
||||
Date: Mon, 16 May 2022 15:40:35 +0800
|
||||
Subject: [PATCH 7/1] utils/team2bond: do not add updelay/downdelay if already exist
|
||||
|
||||
Also check if miimon/arp_interval already set.
|
||||
|
||||
Signed-off-by: Hangbin Liu <haliu@redhat.com>
|
||||
---
|
||||
utils/team2bond | 32 +++++++++++++++++++++++++-------
|
||||
1 file changed, 25 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/utils/team2bond b/utils/team2bond
|
||||
index b5555c1..111b83b 100755
|
||||
--- a/utils/team2bond
|
||||
+++ b/utils/team2bond
|
||||
@@ -117,34 +117,52 @@ def convert_link_watch(link_watch_opts, arp_target, exist_opts):
|
||||
sys.exit(1)
|
||||
|
||||
if link_watch_opts['name'] == 'ethtool':
|
||||
- if exist_opts.find("miimon") == -1:
|
||||
+ if exist_opts.find("arp_interval") >= 0:
|
||||
+ print("# Warn: detecte miimon(ethtool) setting, but arp_interval(arp_ping) already set, will ignore.")
|
||||
+ return bond_opts
|
||||
+
|
||||
+ if exist_opts.find("miimon") >= 0:
|
||||
+ print("# Warn: duplicated miimon detected, bonding supports only one.")
|
||||
+ else:
|
||||
bond_opts += ",miimon=100"
|
||||
+
|
||||
if 'delay_up' in link_watch_opts:
|
||||
- bond_opts += ",updelay=" + str(link_watch_opts['delay_up'])
|
||||
+ if exist_opts.find('updelay') >= 0:
|
||||
+ print("# Warn: duplicated updelay detected, bonding supports only one.")
|
||||
+ else:
|
||||
+ bond_opts += ",updelay=" + str(link_watch_opts['delay_up'])
|
||||
if 'delay_down' in link_watch_opts:
|
||||
- bond_opts += ",downdelay=" + str(link_watch_opts['delay_down'])
|
||||
+ if exist_opts.find('downdelay') >= 0:
|
||||
+ print("# Warn: duplicated downdelay detected, bonding supports only one.")
|
||||
+ else:
|
||||
+ bond_opts += ",downdelay=" + str(link_watch_opts['delay_down'])
|
||||
elif link_watch_opts['name'] == 'arp_ping':
|
||||
+ if exist_opts.find("miimon") >= 0:
|
||||
+ print("# Warn: detecte arp_interval(arp_ping) setting, but miimon(ethtool) already set, will ignore.")
|
||||
+ return bond_opts
|
||||
+
|
||||
if 'interval' in link_watch_opts:
|
||||
- if exist_opts.find('arp_interval') > 0:
|
||||
+ if exist_opts.find('arp_interval') >= 0:
|
||||
print("# Warn: duplicated arp_interval detected, bonding supports only one.")
|
||||
else:
|
||||
bond_opts += ",arp_interval=" + str(link_watch_opts['interval'])
|
||||
+
|
||||
if 'target_host' in link_watch_opts:
|
||||
arp_target.append(link_watch_opts['target_host'])
|
||||
|
||||
if 'validate_active' in link_watch_opts and link_watch_opts['validate_active'] and \
|
||||
'validate_inactive' in link_watch_opts and link_watch_opts['validate_inactive']:
|
||||
- if exist_opts.find('arp_validate') > 0:
|
||||
+ if exist_opts.find('arp_validate') >= 0:
|
||||
print("# Warn: duplicated arp_validate detected, bonding supports only one.")
|
||||
else:
|
||||
bond_opts += ",arp_validate=all"
|
||||
elif 'validate_active' in link_watch_opts and link_watch_opts['validate_active']:
|
||||
- if exist_opts.find('arp_validate') > 0:
|
||||
+ if exist_opts.find('arp_validate') >= 0:
|
||||
print("# Warn: duplicated arp_validate detected, bonding supports only one.")
|
||||
else:
|
||||
bond_opts += ",arp_validate=active"
|
||||
elif 'validate_inactive' in link_watch_opts and link_watch_opts['validate_inactive']:
|
||||
- if exist_opts.find('arp_validate') > 0:
|
||||
+ if exist_opts.find('arp_validate') >= 0:
|
||||
print("# Warn: duplicated arp_validate detected, bonding supports only one.")
|
||||
else:
|
||||
bond_opts += ",arp_validate=backup"
|
||||
--
|
||||
2.35.1
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
From dbb2cfca35d2cd15125eb84e8f3940f8cc3ea860 Mon Sep 17 00:00:00 2001
|
||||
From: Lubomir Rintel <lkundrak@v3.sk>
|
||||
Date: Mon, 10 Oct 2022 18:33:53 +0200
|
||||
Subject: [PATCH] teamd: do no remove the ports on shutdown with -N
|
||||
|
||||
With -N, teamd currently leaves the team device in place on shutdown,
|
||||
as it's supposed to, but it removes all the ports. This severely limits
|
||||
usefullness of the option, because it's still impossible to replace
|
||||
the daemon with another one without disrupting connectivity.
|
||||
|
||||
One use case where this is important is the handover from initrd to real
|
||||
root, when a team device was used to provide connectivity to a network
|
||||
root filesystem:
|
||||
|
||||
Systemd's isolation of switch-root.target stops NetworkManager.service and
|
||||
then terminates its kids, including teamd. The real NetworkManager.service
|
||||
would eventually catch up and restart it, but there's a short period when
|
||||
team ports are removed which is not great if we're booting off that device.
|
||||
Also, it may be that ports come up in different order, causing team to get
|
||||
a different MAC address, which will invalidate the DHCP lease we got
|
||||
beforehands and screwing up L3 addressing.
|
||||
|
||||
Let's not flush the ports when -N is used.
|
||||
|
||||
Suggested-by: Jiri Pirko <jiri@resnulli.us>
|
||||
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
|
||||
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
|
||||
---
|
||||
teamd/teamd_per_port.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c
|
||||
index d429753..9689df4 100644
|
||||
--- a/teamd/teamd_per_port.c
|
||||
+++ b/teamd/teamd_per_port.c
|
||||
@@ -217,7 +217,6 @@ static void port_obj_remove(struct teamd_context *ctx,
|
||||
struct teamd_port *tdport = _port(port_obj);
|
||||
|
||||
teamd_event_port_removed(ctx, tdport);
|
||||
- teamd_port_remove(ctx, tdport);
|
||||
port_obj_destroy(ctx, port_obj);
|
||||
port_obj_free(port_obj);
|
||||
}
|
||||
--
|
||||
2.31.1
|
||||
|
|
@ -0,0 +1,105 @@
|
|||
From ffc6a52bd285a476b547312012078af69220574b Mon Sep 17 00:00:00 2001
|
||||
From: Lubomir Rintel <lkundrak@v3.sk>
|
||||
Date: Mon, 10 Oct 2022 18:37:31 +0200
|
||||
Subject: [PATCH] teamd: stop iterating callbacks when a loop restart is
|
||||
requested
|
||||
|
||||
A crash was observed:
|
||||
|
||||
Added loop callback: dbus_watch, 0x560d279e4530
|
||||
Added loop callback: dbus_watch, 0x560d279e4580
|
||||
...
|
||||
Removed loop callback: dbus_watch, 0x560d279e4580
|
||||
Removed loop callback: dbus_watch, 0x560d279e4530
|
||||
Aug 31 11:54:11 holaprdel kernel: traps: teamd[557] general protection fault ip:560d26469a55 sp:7ffd43ca9650 error:0 in teamd[560d26463000+16000]
|
||||
|
||||
Traceback (from a different run than above):
|
||||
|
||||
Core was generated by `/usr/bin/teamd -o -n -U -D -N -t team0 -gg'.
|
||||
Program terminated with signal SIGSEGV, Segmentation fault.
|
||||
#0 0x00005600ac090a55 in teamd_run_loop_do_callbacks (ctx=0x5600ad9bac70, fds=0x7fff40861250, lcb_list=0x5600ad9bad58) at /usr/src/debug/libteam-1.31-14.el9.x86_64/teamd/teamd.c:321
|
||||
321 list_for_each_node_entry_safe(lcb, tmp, lcb_list, list) {
|
||||
(gdb) bt
|
||||
#0 0x00005600ac090a55 in teamd_run_loop_do_callbacks (ctx=0x5600ad9bac70, fds=0x7fff40861250, lcb_list=0x5600ad9bad58) at /usr/src/debug/libteam-1.31-14.el9.x86_64/teamd/teamd.c:321
|
||||
#1 teamd_run_loop_run (ctx=0x5600ad9bac70) at /usr/src/debug/libteam-1.31-14.el9.x86_64/teamd/teamd.c:415
|
||||
#2 0x00005600ac08d8cb in teamd_start (p_ret=<synthetic pointer>, ctx=<optimized out>) at /usr/src/debug/libteam-1.31-14.el9.x86_64/teamd/teamd.c:1557
|
||||
#3 main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/libteam-1.31-14.el9.x86_64/teamd/teamd.c:1876
|
||||
(gdb) print *lcb
|
||||
Cannot access memory at address 0x9dd29944fb7e97fc
|
||||
(gdb) print *tmp
|
||||
Cannot access memory at address 0x9dd29944fb7e9804
|
||||
(gdb)
|
||||
|
||||
What has happened is that libdbus called the remove_watch callback twice
|
||||
in a single go, causing two callbacks being destroyed in one iteration
|
||||
of teamd_run_loop_do_callbacks()'s list_for_each_node_entry_safe().
|
||||
|
||||
This basically turns the _safe() variant of the macro unhelpful, as tmp
|
||||
points to stale data anyway.
|
||||
|
||||
Let's use the unsafe variant then, and terminate the loop once
|
||||
teamd_loop_callback_del() asks for main loop's attention via
|
||||
teamd_run_loop_restart(). If there are other callbacks pending an action,
|
||||
they will get their turn in the next main loop iteration.
|
||||
|
||||
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
|
||||
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
|
||||
---
|
||||
teamd/teamd.c | 26 ++++++++++++++++++++++++--
|
||||
1 file changed, 24 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/teamd/teamd.c b/teamd/teamd.c
|
||||
index b310140..a89b702 100644
|
||||
--- a/teamd/teamd.c
|
||||
+++ b/teamd/teamd.c
|
||||
@@ -309,16 +309,28 @@ static void teamd_run_loop_set_fds(struct list_item *lcb_list,
|
||||
}
|
||||
}
|
||||
|
||||
+static int teamd_check_ctrl(struct teamd_context *ctx)
|
||||
+{
|
||||
+ int ctrl_fd = ctx->run_loop.ctrl_pipe_r;
|
||||
+ struct timeval tv;
|
||||
+ fd_set rfds;
|
||||
+
|
||||
+ FD_ZERO(&rfds);
|
||||
+ FD_SET(ctrl_fd, &rfds);
|
||||
+ tv.tv_sec = tv.tv_usec = 0;
|
||||
+
|
||||
+ return select(ctrl_fd + 1, &rfds, NULL, NULL, &tv);
|
||||
+}
|
||||
+
|
||||
static int teamd_run_loop_do_callbacks(struct list_item *lcb_list, fd_set *fds,
|
||||
struct teamd_context *ctx)
|
||||
{
|
||||
struct teamd_loop_callback *lcb;
|
||||
- struct teamd_loop_callback *tmp;
|
||||
int i;
|
||||
int events;
|
||||
int err;
|
||||
|
||||
- list_for_each_node_entry_safe(lcb, tmp, lcb_list, list) {
|
||||
+ list_for_each_node_entry(lcb, lcb_list, list) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (!(lcb->fd_event & (1 << i)))
|
||||
continue;
|
||||
@@ -339,6 +351,16 @@ static int teamd_run_loop_do_callbacks(struct list_item *lcb_list, fd_set *fds,
|
||||
teamd_log_dbg(ctx, "Failed loop callback: %s, %p",
|
||||
lcb->name, lcb->priv);
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * If there's a control byte ready, it's possible that
|
||||
+ * one or more entries have been removed from the
|
||||
+ * callback list and restart has been requested. In any
|
||||
+ * case, let the main loop deal with it first so that
|
||||
+ * we know we're safe to proceed.
|
||||
+ */
|
||||
+ if (teamd_check_ctrl(ctx))
|
||||
+ return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
--
|
||||
2.31.1
|
||||
|
60
libteam.spec
60
libteam.spec
|
@ -1,6 +1,6 @@
|
|||
Name: libteam
|
||||
Version: 1.31
|
||||
Release: 7%{?dist}
|
||||
Release: 16%{?dist}
|
||||
Summary: Library for controlling team network device
|
||||
License: LGPLv2+
|
||||
URL: http://www.libteam.org
|
||||
|
@ -8,6 +8,13 @@ Source: http://www.libteam.org/files/libteam-%{version}.tar.gz
|
|||
|
||||
Patch1: 0001-team-add-a-tool-for-team-to-bonding-config-migration.patch
|
||||
Patch2: 0002-team2bond-fix-min_ports-format-and-add-lacp_key.patch
|
||||
Patch3: 0003-utils-team2bond-add-cautions-for-the-script.patch
|
||||
Patch4: 0004-man-add-team2bond-man-doc.patch
|
||||
Patch5: 0005-Revert-teamd-Disregard-current-state-when-considerin.patch
|
||||
Patch6: 0006-utils-team2bond-do-not-add-miimon-if-already-exist.patch
|
||||
Patch7: 0007-utils-team2bond-do-not-add-updelay-downdelay-if-alre.patch
|
||||
Patch8: 0008-teamd-do-no-remove-the-ports-on-shutdown-with-N.patch
|
||||
Patch9: 0009-teamd-stop-iterating-callbacks-when-a-loop-restart-i.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: jansson-devel
|
||||
|
@ -18,6 +25,9 @@ BuildRequires: systemd
|
|||
BuildRequires: swig
|
||||
BuildRequires: doxygen
|
||||
BuildRequires: make
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: libtool
|
||||
|
||||
%description
|
||||
This package contains a library which is a user-space
|
||||
|
@ -26,27 +36,27 @@ to control team network devices.
|
|||
|
||||
%package devel
|
||||
Summary: Libraries and header files for libteam development
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: libteam = %{version}-%{release}
|
||||
|
||||
%package doc
|
||||
Summary: API documentation for libteam and libteamd
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: libteam = %{version}-%{release}
|
||||
|
||||
%description doc
|
||||
This package contains libteam and libteamd API documentation
|
||||
|
||||
%package -n teamd
|
||||
Summary: Team network device control daemon
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: libteam = %{version}-%{release}
|
||||
|
||||
%package -n teamd-devel
|
||||
Summary: Libraries and header files for teamd development
|
||||
Requires: %{name}%{?_isa} = %{version}-%{release}
|
||||
Requires: teamd = %{version}-%{release}
|
||||
|
||||
%package -n network-scripts-teamd
|
||||
Summary: teamd legacy network service support
|
||||
Requires: network-scripts
|
||||
Supplements: (%{name} and network-scripts)
|
||||
Supplements: (teamd and network-scripts)
|
||||
|
||||
%description devel
|
||||
The libteam-devel package contains the header files and libraries
|
||||
|
@ -62,10 +72,10 @@ necessary for developing programs using libteamdctl.
|
|||
%description -n network-scripts-teamd
|
||||
This provides the ifup and ifdown scripts for use with the legacy network
|
||||
service.
|
||||
service.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%autosetup -p1
|
||||
autoreconf --force --install -I m4
|
||||
|
||||
# prepare example dir for -devel
|
||||
mkdir -p _tmpdoc1/examples
|
||||
|
@ -91,6 +101,7 @@ install -p -m 755 teamd/redhat/initscripts_systemd/network-scripts/ifdown-Team $
|
|||
install -p -m 755 teamd/redhat/initscripts_systemd/network-scripts/ifup-TeamPort $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/network-scripts
|
||||
install -p -m 755 teamd/redhat/initscripts_systemd/network-scripts/ifdown-TeamPort $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/network-scripts
|
||||
install -p -m 755 utils/bond2team $RPM_BUILD_ROOT%{_bindir}/bond2team
|
||||
install -p -m 755 utils/team2bond $RPM_BUILD_ROOT%{_bindir}/team2bond
|
||||
|
||||
%ldconfig_scriptlets
|
||||
|
||||
|
@ -117,10 +128,12 @@ install -p -m 755 utils/bond2team $RPM_BUILD_ROOT%{_bindir}/bond2team
|
|||
%{_bindir}/teamd
|
||||
%{_bindir}/teamdctl
|
||||
%{_bindir}/bond2team
|
||||
%{_bindir}/team2bond
|
||||
%{_mandir}/man8/teamd.8*
|
||||
%{_mandir}/man8/teamdctl.8*
|
||||
%{_mandir}/man5/teamd.conf.5*
|
||||
%{_mandir}/man1/bond2team.1*
|
||||
%{_mandir}/man1/team2bond.1*
|
||||
|
||||
%files -n teamd-devel
|
||||
%{_includedir}/teamdctl.h
|
||||
|
@ -134,6 +147,37 @@ install -p -m 755 utils/bond2team $RPM_BUILD_ROOT%{_bindir}/bond2team
|
|||
%{_sysconfdir}/sysconfig/network-scripts/ifdown-TeamPort
|
||||
|
||||
%changelog
|
||||
* Tue Dec 06 2022 Long Xin <lxin@redhat.com> - 1.31-16
|
||||
- fix the Requires package name for teamd-devel
|
||||
- teamd: stop iterating callbacks when a loop restart is requested (rhbz#2148852)
|
||||
|
||||
* Mon Dec 05 2022 Long Xin <lxin@redhat.com> - 1.31-15
|
||||
- teamd: do no remove the ports on shutdown with -N (rhbz#2148854)
|
||||
|
||||
* Mon Jun 13 2022 Long Xin <lxin@redhat.com> - 1.31-14
|
||||
- Rebuilt with a new version to pass the fixed gating test (rhbz#2060445)
|
||||
|
||||
* Mon May 16 2022 Hangbin Liu <haliu@redhat.com> - 1.31-13
|
||||
- utils/team2bond: do not add updelay/downdelay if already exist (rhbz#2060445)
|
||||
|
||||
* Mon Mar 7 2022 Hangbin Liu <haliu@redhat.com> - 1.31-12
|
||||
- utils/team2bond: do not add miimon if already exist (rhbz#2060445)
|
||||
|
||||
* Mon Nov 15 2021 Xin Long <lxin@redhat.com> - 1.31-11
|
||||
- Revert "teamd: Disregard current state when considering port enablement" [1894546]
|
||||
|
||||
* Mon Aug 16 2021 Hangbin Liu <haliu@redhat.com> - 1.31-10
|
||||
- Remove an extra line in spec file
|
||||
|
||||
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 1.31-9
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
|
||||
* Wed Jul 28 2021 Hangbin Liu <haliu@redhat.com> - 1.31-8
|
||||
- Build util team2bond in teamd rpm [1986788]
|
||||
- Add some cautions to util team2bond [1986788]
|
||||
- Add team2bond man doc [1986788]
|
||||
|
||||
* Thu Jun 17 2021 Xin Long <lxin@redhat.com> - 1.31-7
|
||||
- gating: fix the wrong link of openvswitch for RHEL-9 [1970175]
|
||||
|
||||
|
|
|
@ -66,9 +66,10 @@ libteam_start_ovs()
|
|||
{
|
||||
local url=http://download-node-02.eng.bos.redhat.com/brewroot/packages
|
||||
|
||||
rpm -qa | grep openvswitch >> libteam.log || \
|
||||
yum install -y $url/openvswitch2.15/2.15.0/16.el9fdp/x86_64/openvswitch2.15-2.15.0-16.el9fdp.x86_64.rpm \
|
||||
$url/openvswitch-selinux-extra-policy/1.0/29.el9fdp/noarch/openvswitch-selinux-extra-policy-1.0-29.el9fdp.noarch.rpm
|
||||
ver=`curl -s $url/openvswitch2.15/2.15.0/ | grep -o "[0-9]*.el9fdp" |tail -1`
|
||||
pver=`curl -s $url/openvswitch-selinux-extra-policy/1.0/ |grep -o "[0-9]*.el9fdp" |tail -1`
|
||||
yum install -y $url/openvswitch2.15/2.15.0/$ver/x86_64/openvswitch2.15-2.15.0-$ver.x86_64.rpm \
|
||||
$url/openvswitch-selinux-extra-policy/1.0/$pver/noarch/openvswitch-selinux-extra-policy-1.0-$pver.noarch.rpm
|
||||
|
||||
systemctl start openvswitch
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue