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]: Add Fast-Reboot mode for teamd #3490

Merged
merged 22 commits into from
Sep 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ee4613c
Update sonic-quagga submodule
pavel-shirshov Jun 8, 2019
b12e064
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Jun 10, 2019
b562508
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Jun 14, 2019
11c2f0c
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Jun 15, 2019
5995a0d
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Jun 26, 2019
2357684
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Jul 11, 2019
ece7357
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Jul 17, 2019
771a990
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Jul 18, 2019
ab8698c
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Jul 22, 2019
082c6ce
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Aug 8, 2019
a393817
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Aug 16, 2019
1b36f6e
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Aug 26, 2019
bc41589
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Aug 28, 2019
09b7ba7
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Sep 5, 2019
75eb558
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Sep 10, 2019
3324a6d
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Sep 10, 2019
160e4dc
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Sep 11, 2019
e28f2ff
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Sep 18, 2019
b8ce490
Merge branch 'master' of https://github.com/Azure/sonic-buildimage
pavel-shirshov Sep 19, 2019
6b98a46
[libteam]: add special Fast-Reboot teamd stop mode
pavel-shirshov Sep 19, 2019
9cb524b
Fix last packet sending
pavel-shirshov Sep 19, 2019
aea5d35
Update sonic-utilities module
pavel-shirshov Sep 20, 2019
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
55 changes: 35 additions & 20 deletions src/libteam/patch/0008-libteam-Add-warm_reboot-mode.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From a21a3dec9f9b9d825a0229e2963e07862395bbba Mon Sep 17 00:00:00 2001
From 5d418847bf6fa86f049e18c1b57028c71e40a9c4 Mon Sep 17 00:00:00 2001
From: Pavel Shirshov <pavelsh@microsoft.com>
Date: Fri, 14 Jun 2019 14:20:05 -0700
Subject: [PATCH] [libteam]: Reimplement Warm-Reboot procedure
Date: Thu, 19 Sep 2019 14:49:17 -0700
Subject: [PATCH 1/1] [libteam]: Reimplement Warm-Reboot procedure

---
libteam/ifinfo.c | 6 +-
teamd/teamd.c | 42 +++-
teamd/teamd.c | 57 ++++-
teamd/teamd.h | 6 +
teamd/teamd_events.c | 13 ++
teamd/teamd_runner_lacp.c | 474 +++++++++++++++++++++++++++++++++++---
5 files changed, 498 insertions(+), 43 deletions(-)
5 files changed, 509 insertions(+), 47 deletions(-)

diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
index 46d56a2..b86d34c 100644
index a15788b..e48193e 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 +34,7 @@ index 46d56a2..b86d34c 100644
}
}
diff --git a/teamd/teamd.c b/teamd/teamd.c
index 9dc85b5..96794e8 100644
index 9dc85b5..679da49 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,51 +90,66 @@ index 9dc85b5..96794e8 100644
if (optind < argc) {
fprintf(stderr, "Too many arguments\n");
return -1;
@@ -390,8 +410,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
@@ -390,12 +410,21 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
if (err != -1) {
switch(ctrl_byte) {
case 'q':
+ case 'f':
+ case 'w':
if (quit_in_progress)
return -EBUSY;
+ if (ctrl_byte == 'w') {
- 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;
+ teamd_ports_flush_data(ctx);
+ teamd_refresh_ports(ctx);
+ if (ctrl_byte == 'w')
+ teamd_ports_flush_data(ctx);
+ } else {
+ err = teamd_flush_ports(ctx);
+ if (err)
+ return err;
+ }
teamd_refresh_ports(ctx);
err = teamd_flush_ports(ctx);
if (err)
@@ -434,6 +460,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err)
quit_in_progress = true;
continue;
case 'r':
@@ -434,6 +463,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err)
teamd_run_loop_sent_ctrl_byte(ctx, 'q');
}

+static void teamd_run_loop_quit_w_boot(struct teamd_context *ctx, int err)
+static void teamd_run_loop_quit_a_boot(struct teamd_context *ctx, char type, int err)
+{
+ ctx->run_loop.err = err;
+ teamd_run_loop_sent_ctrl_byte(ctx, 'w');
+ teamd_run_loop_sent_ctrl_byte(ctx, type);
+}
+
void teamd_run_loop_restart(struct teamd_context *ctx)
{
teamd_run_loop_sent_ctrl_byte(ctx, 'r');
@@ -700,6 +732,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events,
@@ -700,6 +735,14 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events,
teamd_log_warn("Got SIGINT, SIGQUIT or SIGTERM.");
teamd_run_loop_quit(ctx, 0);
break;
+ case SIGUSR1:
+ teamd_log_warn("Got SIGUSR1.");
+ teamd_run_loop_quit_w_boot(ctx, 0);
+ teamd_run_loop_quit_a_boot(ctx, 'w', 0);
+ break;
+ case SIGUSR2:
+ teamd_log_warn("Got SIGUSR2.");
+ teamd_run_loop_quit_a_boot(ctx, 'f', 0);
+ break;
}
return 0;
}
@@ -1531,7 +1567,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret)
@@ -1531,7 +1574,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret)
return -errno;
}

- if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, 0) < 0) {
+ if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, SIGUSR1, 0) < 0) {
+ if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, SIGUSR1, SIGUSR2, 0) < 0) {
teamd_log_err("Could not register signal handlers.");
daemon_retval_send(errno);
err = -errno;
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-utilities