infra: shutdown bricks in parallel

This commit is contained in:
Thomas Schoebel-Theuer 2017-01-08 08:49:30 +01:00 committed by Thomas Schoebel-Theuer
parent 9438c99647
commit afe2513c21
1 changed files with 15 additions and 8 deletions

View File

@ -1471,7 +1471,7 @@ int mars_kill_brick(struct mars_brick *brick)
// start shutdown // start shutdown
set_button_wait((void*)brick, false, true, 0); set_button_wait((void*)brick, false, true, 0);
if (likely(brick->power.led_off)) { if (brick->power.led_off) {
int max_inputs = 0; int max_inputs = 0;
bool failed = false; bool failed = false;
int i; int i;
@ -1517,7 +1517,9 @@ int mars_kill_brick(struct mars_brick *brick)
} }
status = 0; status = 0;
} else { } else {
MARS_ERR("brick '%s' '%s' is not off\n", SAFE_STR(brick->brick_name), SAFE_STR(brick->brick_path)); /* This may happen regularly when bricks are shut down in parallel */
MARS_INF("brick '%s' '%s' is not off\n",
SAFE_STR(brick->brick_name), SAFE_STR(brick->brick_path));
status = -EUCLEAN; status = -EUCLEAN;
} }
@ -1608,19 +1610,24 @@ restart:
continue; continue;
} }
list_del_init(tmp); /* start shutdown */
mars_power_button(brick, false, true);
/* wait until actually off */
if (!brick->power.led_off)
continue;
if (global) { if (global) {
up_write(&global->brick_mutex); up_write(&global->brick_mutex);
} }
MARS_DBG("KILLING '%s'\n", brick->brick_name); MARS_DBG("KILLING '%s' '%s'\n",
brick->brick_path, brick->brick_name);
status = mars_kill_brick(brick); status = mars_kill_brick(brick);
if (status >= 0) { if (status >= 0)
return_status++; return_status++;
} else {
return status;
}
/* The list may have changed during the open lock /* The list may have changed during the open lock
* in unpredictable ways. * in unpredictable ways.
*/ */