Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libteam]: Keep member ports parts of a team when teamd quits in FR a… #3544

Merged
merged 1 commit into from
Oct 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 28 additions & 16 deletions src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
From 5d418847bf6fa86f049e18c1b57028c71e40a9c4 Mon Sep 17 00:00:00 2001
From 113d482704198685fba09cd2597fd93ca9d297c5 Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Thu, 19 Sep 2019 14:49:17 -0700
Date: Tue, 1 Oct 2019 09:23:23 -0700
Subject: [PATCH 1/1] [libteam]: Reimplement Warm-Reboot procedure

---
libteam/ifinfo.c | 6 +-
teamd/teamd.c | 57 ++++-
teamd/teamd.c | 51 +++-
teamd/teamd.h | 6 +
teamd/teamd_events.c | 13 ++
teamd/teamd_per_port.c | 6 +
teamd/teamd_runner_lacp.c | 474 +++++++++++++++++++++++++++++++++++---
5 files changed, 509 insertions(+), 47 deletions(-)
6 files changed, 512 insertions(+), 44 deletions(-)

diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
index a15788b..e48193e 100644
index 46d56a2..b86d34c 100644
--- a/libteam/ifinfo.c
+++ b/libteam/ifinfo.c
@@ -109,15 +109,13 @@ static void update_hwaddr(struct team_ifinfo *ifinfo, struct rtnl_link *link)
Expand All @@ -34,7 +35,7 @@ index a15788b..e48193e 100644
}
}
diff --git a/teamd/teamd.c b/teamd/teamd.c
index 9dc85b5..679da49 100644
index 9dc85b5..17221a9 100644
--- a/teamd/teamd.c
+++ b/teamd/teamd.c
@@ -117,7 +117,9 @@ static void print_help(const struct teamd_context *ctx) {
Expand Down Expand Up @@ -90,7 +91,7 @@ index 9dc85b5..679da49 100644
if (optind < argc) {
fprintf(stderr, "Too many arguments\n");
return -1;
@@ -390,12 +410,21 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
@@ -390,9 +410,18 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
if (err != -1) {
switch(ctrl_byte) {
case 'q':
Expand All @@ -99,9 +100,6 @@ index 9dc85b5..679da49 100644
if (quit_in_progress)
return -EBUSY;
- teamd_refresh_ports(ctx);
- err = teamd_flush_ports(ctx);
- if (err)
- return err;
+ if (ctrl_byte == 'w' || ctrl_byte == 'f') {
+ ctx->keep_ports = true;
+ ctx->no_quit_destroy = true;
Expand All @@ -110,12 +108,9 @@ index 9dc85b5..679da49 100644
+ teamd_ports_flush_data(ctx);
+ }
+
+ err = teamd_flush_ports(ctx);
+ if (err)
+ return err;
quit_in_progress = true;
continue;
case 'r':
err = teamd_flush_ports(ctx);
if (err)
return err;
@@ -434,6 +463,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err)
teamd_run_loop_sent_ctrl_byte(ctx, 'q');
}
Expand Down Expand Up @@ -207,6 +202,23 @@ index 221803e..bd4dcc1 100644
int teamd_event_port_added(struct teamd_context *ctx,
struct teamd_port *tdport)
{
diff --git a/teamd/teamd_per_port.c b/teamd/teamd_per_port.c
index f98a90d..a87e809 100644
--- a/teamd/teamd_per_port.c
+++ b/teamd/teamd_per_port.c
@@ -350,6 +350,12 @@ static int teamd_port_remove(struct teamd_context *ctx,
{
int err;

+ if (ctx->keep_ports) {
+ teamd_log_dbg("%s: Keeping port (found ifindex \"%d\").",
+ tdport->ifname, tdport->ifindex);
+ return 0;
+ }
+
teamd_log_dbg("%s: Removing port (found ifindex \"%d\").",
tdport->ifname, tdport->ifindex);
err = team_port_remove(ctx->th, tdport->ifindex);
diff --git a/teamd/teamd_runner_lacp.c b/teamd/teamd_runner_lacp.c
index 4016b15..81be5b7 100644
--- a/teamd/teamd_runner_lacp.c
Expand Down