diff options
author | Juan Quintela <quintela@redhat.com> | 2018-02-19 19:01:15 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2018-05-15 20:24:27 +0200 |
commit | 7a169d745c854bb722a978c63d1f9edb05f04cd6 (patch) | |
tree | 67cfc7906447e4c9102fbb7b2e52ade69b0a7ac6 /migration | |
parent | cdf338152f64616d4c1f880861fec7cf0df306ae (diff) | |
download | qemu-7a169d745c854bb722a978c63d1f9edb05f04cd6.zip |
migration: Set error state in case of error
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/ram.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/migration/ram.c b/migration/ram.c index da0b567003..4d8be30676 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -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]; |