@@ -155,7 +155,7 @@ public void handleHostReport(HostReport report, boolean isBoot) {
155
155
rhost .getLoad (), new Timestamp (rhost .getBootTime () * 1000l ),
156
156
rhost .getAttributesMap ().get ("SP_OS" ));
157
157
158
- changeHardwareState (host , report .getHost ().getState ());
158
+ changeHardwareState (host , report .getHost ().getState (), isBoot );
159
159
changeNimbyState (host , report .getHost ());
160
160
161
161
/**
@@ -304,46 +304,45 @@ else if (!dispatchSupport.isCueBookable(host)) {
304
304
*
305
305
* If a host pings in with a different hardware state than what
306
306
* is currently in the DB, the state is updated. If the hardware
307
- * state is Rebooting RebootWhenIdle, then state can only be
307
+ * state is Rebooting or RebootWhenIdle, then state can only be
308
308
* updated with a boot report. If the state is Repair, then state is
309
309
* never updated via RQD.
310
310
*
311
311
* @param host
312
312
* @param reportState
313
+ * @param isBoot
313
314
*/
314
315
private void changeHardwareState (DispatchHost host ,
315
- HardwareState reportState ) {
316
+ HardwareState reportState , boolean isBoot ) {
316
317
317
- /*
318
- * If the states are the same there is no reason
319
- * to do this update.
320
- */
318
+
319
+ // If the states are the same there is no reason to do this update.
321
320
if (host .hardwareState .equals (reportState )) {
322
321
return ;
323
322
}
324
323
325
- /*
326
- * Do not change the state of the host if its in a
327
- * repair state. Removing the repair state must
328
- * be done manually.
329
- */
330
- if (host .hardwareState .equals (HardwareState .REPAIR )) {
331
- return ;
332
- }
324
+ switch (host .hardwareState ) {
325
+ case DOWN :
326
+ hostManager .setHostState (host , HardwareState .UP );
327
+ host .hardwareState = HardwareState .UP ;
328
+ break ;
329
+ case REBOOTING :
330
+ case REBOOT_WHEN_IDLE :
331
+ // Rebooting hosts only change to UP when processing a boot report
332
+ if (isBoot ) {
333
+ hostManager .setHostState (host , HardwareState .UP );
334
+ host .hardwareState = HardwareState .UP ;
335
+ }
336
+ break ;
337
+ case REPAIR :
338
+ // Do not change the state of the host if its in a repair state.
339
+ break ;
340
+ default :
341
+ hostManager .setHostState (host , reportState );
342
+ host .hardwareState = reportState ;
343
+ break ;
333
344
334
- /*
335
- * Hosts in these states always change to Up.
336
- */
337
- if (reportState .equals (HardwareState .UP ) && EnumSet .of (HardwareState .DOWN ,
338
- HardwareState .REBOOTING ,
339
- HardwareState .REBOOT_WHEN_IDLE ).contains (host .hardwareState )) {
340
- hostManager .setHostState (host , HardwareState .UP );
341
345
}
342
- else {
343
- hostManager .setHostState (host , reportState );
344
- }
345
-
346
- host .hardwareState = reportState ;
347
346
}
348
347
349
348
/**
0 commit comments