@@ -117,6 +117,8 @@ void RebootThread::do_reboot(void) {
117
117
118
118
if (m_request.method () == RebootMethod::COLD) {
119
119
do_cold_reboot (s);
120
+ } else if (m_request.method () == RebootMethod::WARM) {
121
+ do_warm_reboot (s);
120
122
} else {
121
123
// This shouldn't be possible. Reference check_start_preconditions()
122
124
SWSS_LOG_ERROR (" Received unrecognized method type = %s" ,
@@ -166,6 +168,25 @@ void RebootThread::do_cold_reboot(swss::Select &s) {
166
168
return ;
167
169
}
168
170
171
+ void RebootThread::do_warm_reboot (swss::Select &s) {
172
+ SWSS_LOG_ENTER ();
173
+ SWSS_LOG_NOTICE (" Sending warm reboot request to platform" );
174
+ if (send_dbus_reboot_request () == Progress::EXIT_EARLY) {
175
+ return ;
176
+ }
177
+
178
+ // Wait for warm reboot. If we return, reboot failed.
179
+ if (wait_for_platform_reboot (s) == Progress::EXIT_EARLY) {
180
+ return ;
181
+ }
182
+
183
+ // We shouldn't be here. Platform reboot should've killed us.
184
+ log_error_and_set_non_retry_failure (" failed to warm reboot" );
185
+
186
+ return ;
187
+ }
188
+
189
+
169
190
void RebootThread::reboot_thread (void ) {
170
191
SWSS_LOG_ENTER ();
171
192
@@ -187,6 +208,15 @@ bool RebootThread::check_start_preconditions(const RebootRequest &request,
187
208
request.method () != RebootMethod::WARM) {
188
209
response.json_string = " RebootThread: Start rx'd unsupported method" ;
189
210
response.status = swss::StatusCode::SWSS_RC_INVALID_PARAM;
211
+ } else if (request.method () == RebootMethod::WARM) {
212
+ if (m_status.get_last_reboot_status () ==
213
+ RebootStatus_Status::RebootStatus_Status_STATUS_FAILURE) {
214
+ // If the last reboot failed with a non-retriable failure, don't retry.
215
+ // But, we will allow a cold boot to recover.
216
+ response.json_string =
217
+ " RebootThread: last WARM reboot failed with non-retriable failure" ;
218
+ response.status = swss::StatusCode::SWSS_RC_FAILED_PRECONDITION;
219
+ }
190
220
} else if (request.delay () != 0 ) {
191
221
response.json_string = " RebootThread: delayed start not supported" ;
192
222
response.status = swss::StatusCode::SWSS_RC_INVALID_PARAM;
0 commit comments