migration: Set error state in case of error

Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
Juan Quintela 2018-02-19 19:01:15 +01:00
parent cdf338152f
commit 7a169d745c

View File

@ -448,10 +448,22 @@ struct {
int count;
} *multifd_send_state;
static void terminate_multifd_send_threads(Error *errp)
static void terminate_multifd_send_threads(Error *err)
{
int i;
if (err) {
MigrationState *s = migrate_get_current();
migrate_set_error(s, err);
if (s->state == MIGRATION_STATUS_SETUP ||
s->state == MIGRATION_STATUS_PRE_SWITCHOVER ||
s->state == MIGRATION_STATUS_DEVICE ||
s->state == MIGRATION_STATUS_ACTIVE) {
migrate_set_state(&s->state, s->state,
MIGRATION_STATUS_FAILED);
}
}
for (i = 0; i < multifd_send_state->count; i++) {
MultiFDSendParams *p = &multifd_send_state->params[i];
@ -548,10 +560,20 @@ struct {
int count;
} *multifd_recv_state;
static void terminate_multifd_recv_threads(Error *errp)
static void terminate_multifd_recv_threads(Error *err)
{
int i;
if (err) {
MigrationState *s = migrate_get_current();
migrate_set_error(s, err);
if (s->state == MIGRATION_STATUS_SETUP ||
s->state == MIGRATION_STATUS_ACTIVE) {
migrate_set_state(&s->state, s->state,
MIGRATION_STATUS_FAILED);
}
}
for (i = 0; i < multifd_recv_state->count; i++) {
MultiFDRecvParams *p = &multifd_recv_state->params[i];