Skip to content

Commit 975fb1c

Browse files
pavel-shirshovyxieca
authored andcommitted
[libteam]: Keep member ports parts of a team when teamd quits in FR and WR (#3544)
1 parent 37b7882 commit 975fb1c

File tree

1 file changed

+28
-16
lines changed

1 file changed

+28
-16
lines changed

src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch

+28-16
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1-
From 5d418847bf6fa86f049e18c1b57028c71e40a9c4 Mon Sep 17 00:00:00 2001
1+
From 113d482704198685fba09cd2597fd93ca9d297c5 Mon Sep 17 00:00:00 2001
22
From: Pavel Shirshov <[email protected]>
3-
Date: Thu, 19 Sep 2019 14:49:17 -0700
3+
Date: Tue, 1 Oct 2019 09:23:23 -0700
44
Subject: [PATCH 1/1] [libteam]: Reimplement Warm-Reboot procedure
55

66
---
77
libteam/ifinfo.c | 6 +-
8-
teamd/teamd.c | 57 ++++-
8+
teamd/teamd.c | 51 +++-
99
teamd/teamd.h | 6 +
1010
teamd/teamd_events.c | 13 ++
11+
teamd/teamd_per_port.c | 6 +
1112
teamd/teamd_runner_lacp.c | 474 +++++++++++++++++++++++++++++++++++---
12-
5 files changed, 509 insertions(+), 47 deletions(-)
13+
6 files changed, 512 insertions(+), 44 deletions(-)
1314

1415
diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
15-
index a15788b..e48193e 100644
16+
index 46d56a2..b86d34c 100644
1617
--- a/libteam/ifinfo.c
1718
+++ b/libteam/ifinfo.c
1819
@@ -109,15 +109,13 @@ static void update_hwaddr(struct team_ifinfo *ifinfo, struct rtnl_link *link)
@@ -34,7 +35,7 @@ index a15788b..e48193e 100644
3435
}
3536
}
3637
diff --git a/teamd/teamd.c b/teamd/teamd.c
37-
index 9dc85b5..679da49 100644
38+
index 9dc85b5..17221a9 100644
3839
--- a/teamd/teamd.c
3940
+++ b/teamd/teamd.c
4041
@@ -117,7 +117,9 @@ static void print_help(const struct teamd_context *ctx) {
@@ -90,7 +91,7 @@ index 9dc85b5..679da49 100644
9091
if (optind < argc) {
9192
fprintf(stderr, "Too many arguments\n");
9293
return -1;
93-
@@ -390,12 +410,21 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
94+
@@ -390,9 +410,18 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
9495
if (err != -1) {
9596
switch(ctrl_byte) {
9697
case 'q':
@@ -99,9 +100,6 @@ index 9dc85b5..679da49 100644
99100
if (quit_in_progress)
100101
return -EBUSY;
101102
- teamd_refresh_ports(ctx);
102-
- err = teamd_flush_ports(ctx);
103-
- if (err)
104-
- return err;
105103
+ if (ctrl_byte == 'w' || ctrl_byte == 'f') {
106104
+ ctx->keep_ports = true;
107105
+ ctx->no_quit_destroy = true;
@@ -110,12 +108,9 @@ index 9dc85b5..679da49 100644
110108
+ teamd_ports_flush_data(ctx);
111109
+ }
112110
+
113-
+ err = teamd_flush_ports(ctx);
114-
+ if (err)
115-
+ return err;
116-
quit_in_progress = true;
117-
continue;
118-
case 'r':
111+
err = teamd_flush_ports(ctx);
112+
if (err)
113+
return err;
119114
@@ -434,6 +463,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err)
120115
teamd_run_loop_sent_ctrl_byte(ctx, 'q');
121116
}
@@ -207,6 +202,23 @@ index 221803e..bd4dcc1 100644
207202
int teamd_event_port_added(struct teamd_context *ctx,
208203
struct teamd_port *tdport)
209204
{
205+
diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c
206+
index f98a90d..a87e809 100644
207+
--- a/teamd/teamd_per_port.c
208+
+++ b/teamd/teamd_per_port.c
209+
@@ -350,6 +350,12 @@ static int teamd_port_remove(struct teamd_context *ctx,
210+
{
211+
int err;
212+
213+
+ if (ctx->keep_ports) {
214+
+ teamd_log_dbg("%s: Keeping port (found ifindex \"%d\").",
215+
+ tdport->ifname, tdport->ifindex);
216+
+ return 0;
217+
+ }
218+
+
219+
teamd_log_dbg("%s: Removing port (found ifindex \"%d\").",
220+
tdport->ifname, tdport->ifindex);
221+
err = team_port_remove(ctx->th, tdport->ifindex);
210222
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
211223
index 4016b15..81be5b7 100644
212224
--- a/teamd/teamd_runner_lacp.c

0 commit comments

Comments
 (0)