1
- From a21a3dec9f9b9d825a0229e2963e07862395bbba Mon Sep 17 00:00:00 2001
1
+ From 5d418847bf6fa86f049e18c1b57028c71e40a9c4 Mon Sep 17 00:00:00 2001
2
2
From: Pavel Shirshov <
[email protected] >
3
- Date: Fri, 14 Jun 2019 14:20:05 -0700
4
- Subject: [PATCH] [libteam]: Reimplement Warm-Reboot procedure
3
+ Date: Thu, 19 Sep 2019 14:49:17 -0700
4
+ Subject: [PATCH 1/1 ] [libteam]: Reimplement Warm-Reboot procedure
5
5
6
6
---
7
7
libteam/ifinfo.c | 6 +-
8
- teamd/teamd.c | 42 +++-
8
+ teamd/teamd.c | 57 + +++-
9
9
teamd/teamd.h | 6 +
10
10
teamd/teamd_events.c | 13 ++
11
11
teamd/teamd_runner_lacp.c | 474 +++++++++++++++++++++++++++++++++++---
12
- 5 files changed, 498 insertions(+), 43 deletions(-)
12
+ 5 files changed, 509 insertions(+), 47 deletions(-)
13
13
14
14
diff --git a/libteam/ifinfo.c b/libteam/ifinfo.c
15
- index 46d56a2..b86d34c 100644
15
+ index a15788b..e48193e 100644
16
16
--- a/libteam/ifinfo.c
17
17
+++ b/libteam/ifinfo.c
18
18
@@ -109,15 +109,13 @@ static void update_hwaddr(struct team_ifinfo *ifinfo, struct rtnl_link *link)
@@ -34,7 +34,7 @@ index 46d56a2..b86d34c 100644
34
34
}
35
35
}
36
36
diff --git a/teamd/teamd.c b/teamd/teamd.c
37
- index 9dc85b5..96794e8 100644
37
+ index 9dc85b5..679da49 100644
38
38
--- a/teamd/teamd.c
39
39
+++ b/teamd/teamd.c
40
40
@@ -117,7 +117,9 @@ static void print_help(const struct teamd_context *ctx) {
@@ -90,51 +90,66 @@ index 9dc85b5..96794e8 100644
90
90
if (optind < argc) {
91
91
fprintf(stderr, "Too many arguments\n");
92
92
return -1;
93
- @@ -390,8 +410,14 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
93
+ @@ -390,12 +410,21 @@ static int teamd_run_loop_run(struct teamd_context *ctx)
94
94
if (err != -1) {
95
95
switch(ctrl_byte) {
96
96
case 'q':
97
+ + case 'f':
97
98
+ case 'w':
98
99
if (quit_in_progress)
99
100
return -EBUSY;
100
- + if (ctrl_byte == 'w') {
101
+ - teamd_refresh_ports(ctx);
102
+ - err = teamd_flush_ports(ctx);
103
+ - if (err)
104
+ - return err;
105
+ + if (ctrl_byte == 'w' || ctrl_byte == 'f') {
101
106
+ ctx->keep_ports = true;
102
107
+ ctx->no_quit_destroy = true;
103
- + teamd_ports_flush_data(ctx);
108
+ + teamd_refresh_ports(ctx);
109
+ + if (ctrl_byte == 'w')
110
+ + teamd_ports_flush_data(ctx);
111
+ + } else {
112
+ + err = teamd_flush_ports(ctx);
113
+ + if (err)
114
+ + return err;
104
115
+ }
105
- teamd_refresh_ports(ctx) ;
106
- err = teamd_flush_ports(ctx) ;
107
- if (err)
108
- @@ -434,6 +460 ,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err)
116
+ quit_in_progress = true ;
117
+ continue ;
118
+ case 'r':
119
+ @@ -434,6 +463 ,12 @@ void teamd_run_loop_quit(struct teamd_context *ctx, int err)
109
120
teamd_run_loop_sent_ctrl_byte(ctx, 'q');
110
121
}
111
122
112
- + static void teamd_run_loop_quit_w_boot (struct teamd_context *ctx, int err)
123
+ + static void teamd_run_loop_quit_a_boot (struct teamd_context *ctx, char type , int err)
113
124
+ {
114
125
+ ctx->run_loop.err = err;
115
- + teamd_run_loop_sent_ctrl_byte(ctx, 'w' );
126
+ + teamd_run_loop_sent_ctrl_byte(ctx, type );
116
127
+ }
117
128
+
118
129
void teamd_run_loop_restart(struct teamd_context *ctx)
119
130
{
120
131
teamd_run_loop_sent_ctrl_byte(ctx, 'r');
121
- @@ -700,6 +732,10 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events,
132
+ @@ -700,6 +735,14 @@ static int callback_daemon_signal(struct teamd_context *ctx, int events,
122
133
teamd_log_warn("Got SIGINT, SIGQUIT or SIGTERM.");
123
134
teamd_run_loop_quit(ctx, 0);
124
135
break;
125
136
+ case SIGUSR1:
126
137
+ teamd_log_warn("Got SIGUSR1.");
127
- + teamd_run_loop_quit_w_boot(ctx, 0);
138
+ + teamd_run_loop_quit_a_boot(ctx, 'w', 0);
139
+ + break;
140
+ + case SIGUSR2:
141
+ + teamd_log_warn("Got SIGUSR2.");
142
+ + teamd_run_loop_quit_a_boot(ctx, 'f', 0);
128
143
+ break;
129
144
}
130
145
return 0;
131
146
}
132
- @@ -1531,7 +1567 ,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret)
147
+ @@ -1531,7 +1574 ,7 @@ static int teamd_start(struct teamd_context *ctx, enum teamd_exit_code *p_ret)
133
148
return -errno;
134
149
}
135
150
136
151
- if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, 0) < 0) {
137
- + if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, SIGUSR1, 0) < 0) {
152
+ + if (daemon_signal_init(SIGINT, SIGTERM, SIGQUIT, SIGHUP, SIGUSR1, SIGUSR2, 0) < 0) {
138
153
teamd_log_err("Could not register signal handlers.");
139
154
daemon_retval_send(errno);
140
155
err = -errno;
0 commit comments