@@ -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,24 @@ 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
+
169
189
void RebootThread::reboot_thread (void ) {
170
190
SWSS_LOG_ENTER ();
171
191
@@ -187,6 +207,15 @@ bool RebootThread::check_start_preconditions(const RebootRequest &request,
187
207
request.method () != RebootMethod::WARM) {
188
208
response.json_string = " RebootThread: Start rx'd unsupported method" ;
189
209
response.status = swss::StatusCode::SWSS_RC_INVALID_PARAM;
210
+ } else if (request.method () == RebootMethod::WARM) {
211
+ if (m_status.get_last_reboot_status () ==
212
+ RebootStatus_Status::RebootStatus_Status_STATUS_FAILURE) {
213
+ // If the last reboot failed with a non-retriable failure, don't retry.
214
+ // But, we will allow a cold boot to recover.
215
+ response.json_string =
216
+ " RebootThread: last WARM reboot failed with non-retriable failure" ;
217
+ response.status = swss::StatusCode::SWSS_RC_FAILED_PRECONDITION;
218
+ }
190
219
} else if (request.delay () != 0 ) {
191
220
response.json_string = " RebootThread: delayed start not supported" ;
192
221
response.status = swss::StatusCode::SWSS_RC_INVALID_PARAM;
0 commit comments