From nobody Tue Nov 26 13:42:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1708000133; cv=none; d=zohomail.com; s=zohoarc; b=JSt100/UPSuwpxnY1mnaSyovoOlga1IpgfM3lvsKLBmzix4R7WMps8V8Bla5DNepdQCyDC+BFv03IS+aq9Z3sJIs13lth5d0XPpAtmsaEzihE/EPqBTohm+XLKvo5uw0ZudyXexM70zEC4Pigmel+W3kpV3jjrEqzVD9QYOlp6M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708000133; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=y3397fPl3A0A+RjLLlOS4AzJsjKSebty9NUioCBoNT8=; b=fNO1dWiVblEud34bGyjer0PFkQx9oZCrkARxY+P1h446hUiqAjRCbIUfTskwPoWIne7qvyjhHxpcsuPCZM5dQpjeubmv+Z9VBY+je5kMELmxeh0K/Wcy/qFFGxWcIQH2TfPwxKWdF91GE4S87m2jhlTb+IjNcuMX4i7gYss6qSM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708000133579212.92000063726812; Thu, 15 Feb 2024 04:28:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raaqe-0004p0-T2; Thu, 15 Feb 2024 07:28:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raaqb-0004o0-03 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 07:28:13 -0500 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raaqX-0007Zh-G7 for qemu-devel@nongnu.org; Thu, 15 Feb 2024 07:28:12 -0500 Received: from mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net [IPv6:2a02:6b8:c12:378d:0:640:d5c4:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 34AE960C88; Thu, 15 Feb 2024 15:28:06 +0300 (MSK) Received: from rkhapov-nux.yandex.net (unknown [2a02:6b8:82:604:e806:5ea2:b505:d402]) by mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 2Sofch4IeOs0-wRtuhIiP; Thu, 15 Feb 2024 15:28:04 +0300 Precedence: bulk X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1708000085; bh=y3397fPl3A0A+RjLLlOS4AzJsjKSebty9NUioCBoNT8=; h=Message-Id:Date:In-Reply-To:Cc:Subject:References:To:From; b=WjYFummQV0R+NxMute4nj1aEaJW/3CW10hCIy4X6WOdAHqVB9OvKidvRmsWa1rcS+ P4qE0th4Y9qJAY8wxT/AypxeonDQaPMHfJgZNzsNzM33ICtry4TBlji8BUjA4BqkBY K/plnL8E7D12QxPpIzXpxEgX4GrGsJOSqcn+unI0= Authentication-Results: mail-nwsmtp-smtp-corp-main-62.myt.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Roman Khapov To: qemu-devel@nongnu.org Cc: peterx@redhat.com, farosas@suse.de, eblake@redhat.com, armbru@redhat.com, yc-core@yandex-team.ru, Roman Khapov Subject: [PATCH v2 1/2] qapi/migration.json: add reason to MIGRATION event Date: Thu, 15 Feb 2024 17:27:58 +0500 Message-Id: <20240215122759.1438581-2-rkhapov@yandex-team.ru> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215122759.1438581-1-rkhapov@yandex-team.ru> References: <20240215122759.1438581-1-rkhapov@yandex-team.ru> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=178.154.239.136; envelope-from=rkhapov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @yandex-team.ru) X-ZM-MESSAGEID: 1708000135551100001 Content-Type: text/plain; charset="utf-8" This commit adds the optional field reason for the events, which contains the string, describing reason of status changing. For example: reason of migration fail. Function migrate_set_state now accepts 4th argument: the reason to pass to event. Every call of this function appended with NULL argument. Also migrate_set_state_err_reason was added to form reason from Error* Signed-off-by: Roman Khapov --- migration/colo.c | 6 +-- migration/migration.c | 86 ++++++++++++++++++++++++++----------------- migration/migration.h | 5 ++- migration/multifd.c | 6 +-- migration/savevm.c | 14 +++---- qapi/migration.json | 3 +- 6 files changed, 71 insertions(+), 49 deletions(-) diff --git a/migration/colo.c b/migration/colo.c index 315e31fe32..3c95291a83 100644 --- a/migration/colo.c +++ b/migration/colo.c @@ -102,7 +102,7 @@ static void secondary_vm_do_failover(void) } =20 migrate_set_state(&mis->state, MIGRATION_STATUS_COLO, - MIGRATION_STATUS_COMPLETED); + MIGRATION_STATUS_COMPLETED, NULL); =20 replication_stop_all(true, &local_err); if (local_err) { @@ -157,7 +157,7 @@ static void primary_vm_do_failover(void) Error *local_err =3D NULL; =20 migrate_set_state(&s->state, MIGRATION_STATUS_COLO, - MIGRATION_STATUS_COMPLETED); + MIGRATION_STATUS_COMPLETED, NULL); /* * kick COLO thread which might wait at * qemu_sem_wait(&s->colo_checkpoint_sem). @@ -823,7 +823,7 @@ static void *colo_process_incoming_thread(void *opaque) qemu_sem_init(&mis->colo_incoming_sem, 0); =20 migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_COLO); + MIGRATION_STATUS_COLO, NULL); =20 if (get_colo_mode() !=3D COLO_MODE_SECONDARY) { error_report("COLO mode must be COLO_MODE_SECONDARY"); diff --git a/migration/migration.c b/migration/migration.c index ab21de2cad..d28885a55b 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -354,10 +354,10 @@ void migration_incoming_state_destroy(void) yank_unregister_instance(MIGRATION_YANK_INSTANCE); } =20 -static void migrate_generate_event(int new_state) +static void migrate_generate_event(int new_state, const char *reason) { if (migrate_events()) { - qapi_event_send_migration(new_state); + qapi_event_send_migration(new_state, reason); } } =20 @@ -598,7 +598,7 @@ static void qemu_start_incoming_migration(const char *u= ri, bool has_channels, } =20 migrate_set_state(&mis->state, MIGRATION_STATUS_NONE, - MIGRATION_STATUS_SETUP); + MIGRATION_STATUS_SETUP, NULL); =20 if (addr->transport =3D=3D MIGRATION_ADDRESS_TYPE_SOCKET) { SocketAddress *saddr =3D &addr->u.socket; @@ -692,7 +692,7 @@ static void process_incoming_migration_bh(void *opaque) * it's ready to use. */ migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_COMPLETED); + MIGRATION_STATUS_COMPLETED, NULL); migration_incoming_state_destroy(); } =20 @@ -713,7 +713,7 @@ process_incoming_migration_co(void *opaque) mis->largest_page_size =3D qemu_ram_pagesize_largest(); postcopy_state_set(POSTCOPY_INCOMING_NONE); migrate_set_state(&mis->state, MIGRATION_STATUS_SETUP, - MIGRATION_STATUS_ACTIVE); + MIGRATION_STATUS_ACTIVE, NULL); =20 mis->loadvm_co =3D qemu_coroutine_self(); ret =3D qemu_loadvm_state(mis->from_src_file); @@ -762,7 +762,7 @@ process_incoming_migration_co(void *opaque) return; fail: migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); qemu_fclose(mis->from_src_file); =20 multifd_recv_cleanup(); @@ -808,7 +808,7 @@ static bool postcopy_try_recover(void) mis->to_src_file =3D qemu_file_get_return_path(mis->from_src_file); =20 migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_PAUSED, - MIGRATION_STATUS_POSTCOPY_RECOVER); + MIGRATION_STATUS_POSTCOPY_RECOVER, NULL); =20 /* * Here, we only wake up the main loading thread (while the @@ -1308,15 +1308,27 @@ void qmp_migrate_start_postcopy(Error **errp) =20 /* shared migration helpers */ =20 -void migrate_set_state(int *state, int old_state, int new_state) +void migrate_set_state(int *state, int old_state, + int new_state, const char *reason) { assert(new_state < MIGRATION_STATUS__MAX); if (qatomic_cmpxchg(state, old_state, new_state) =3D=3D old_state) { trace_migrate_set_state(MigrationStatus_str(new_state)); - migrate_generate_event(new_state); + migrate_generate_event(new_state, reason); } } =20 +void migrate_set_state_err_reason(int *state, int old_state, + int new_state, const Error *err) +{ + const char *reason =3D NULL; + if (likely(err !=3D NULL)) { + reason =3D error_get_pretty(err); + } + + migrate_set_state(state, old_state, new_state, reason); +} + static void migrate_fd_cleanup(MigrationState *s) { g_free(s->hostname); @@ -1360,7 +1372,7 @@ static void migrate_fd_cleanup(MigrationState *s) =20 if (s->state =3D=3D MIGRATION_STATUS_CANCELLING) { migrate_set_state(&s->state, MIGRATION_STATUS_CANCELLING, - MIGRATION_STATUS_CANCELLED); + MIGRATION_STATUS_CANCELLED, NULL); } =20 if (s->error) { @@ -1406,7 +1418,7 @@ static void migrate_fd_error(MigrationState *s, const= Error *error) trace_migrate_fd_error(error_get_pretty(error)); assert(s->to_dst_file =3D=3D NULL); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); migrate_set_error(s, error); } =20 @@ -1432,7 +1444,8 @@ static void migrate_fd_cancel(MigrationState *s) if (old_state =3D=3D MIGRATION_STATUS_PRE_SWITCHOVER) { qemu_sem_post(&s->pause_sem); } - migrate_set_state(&s->state, old_state, MIGRATION_STATUS_CANCELLIN= G); + migrate_set_state(&s->state, old_state, + MIGRATION_STATUS_CANCELLING, NULL); } while (s->state !=3D MIGRATION_STATUS_CANCELLING); =20 /* @@ -1612,7 +1625,8 @@ int migrate_init(MigrationState *s, Error **errp) s->error =3D NULL; s->vmdesc =3D NULL; =20 - migrate_set_state(&s->state, MIGRATION_STATUS_NONE, MIGRATION_STATUS_S= ETUP); + migrate_set_state(&s->state, MIGRATION_STATUS_NONE, + MIGRATION_STATUS_SETUP, NULL); =20 s->start_time =3D qemu_clock_get_ms(QEMU_CLOCK_REALTIME); s->total_time =3D 0; @@ -2024,7 +2038,7 @@ void qmp_migrate(const char *uri, bool has_channels, error_setg(&local_err, QERR_INVALID_PARAMETER_VALUE, "uri", "a valid migration protocol"); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); block_cleanup_parameters(); } =20 @@ -2145,7 +2159,7 @@ static bool migrate_handle_rp_resume_ack(MigrationSta= te *s, =20 /* Now both sides are active. */ migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_RECOVER, - MIGRATION_STATUS_POSTCOPY_ACTIVE); + MIGRATION_STATUS_POSTCOPY_ACTIVE, NULL); =20 /* Notify send thread that time to continue send pages */ migration_rp_kick(s); @@ -2422,14 +2436,15 @@ static int postcopy_start(MigrationState *ms, Error= **errp) if (migrate_postcopy_preempt()) { migration_wait_main_channel(ms); if (postcopy_preempt_establish_channel(ms)) { - migrate_set_state(&ms->state, ms->state, MIGRATION_STATUS_FAIL= ED); + migrate_set_state(&ms->state, ms->state, + MIGRATION_STATUS_FAILED, NULL); return -1; } } =20 if (!migrate_pause_before_switchover()) { migrate_set_state(&ms->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_POSTCOPY_ACTIVE); + MIGRATION_STATUS_POSTCOPY_ACTIVE, NULL); } =20 trace_postcopy_start(); @@ -2559,7 +2574,7 @@ static int postcopy_start(MigrationState *ms, Error *= *errp) if (ret) { error_setg(errp, "postcopy_start: Migration stream errored"); migrate_set_state(&ms->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); } =20 trace_postcopy_preempt_enabled(migrate_postcopy_preempt()); @@ -2570,7 +2585,7 @@ fail_closefb: qemu_fclose(fb); fail: migrate_set_state(&ms->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); if (restart_block) { /* A failure happened early enough that we know the destination ha= sn't * accessed block devices, so we're safe to recover. @@ -2618,10 +2633,10 @@ static int migration_maybe_pause(MigrationState *s, if (s->state !=3D MIGRATION_STATUS_CANCELLING) { bql_unlock(); migrate_set_state(&s->state, *current_active_state, - MIGRATION_STATUS_PRE_SWITCHOVER); + MIGRATION_STATUS_PRE_SWITCHOVER, NULL); qemu_sem_wait(&s->pause_sem); migrate_set_state(&s->state, MIGRATION_STATUS_PRE_SWITCHOVER, - new_state); + new_state, NULL); *current_active_state =3D new_state; bql_lock(); } @@ -2706,7 +2721,7 @@ static void migration_completion_failed(MigrationStat= e *s, } =20 migrate_set_state(&s->state, current_active_state, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); } =20 /** @@ -2744,10 +2759,10 @@ static void migration_completion(MigrationState *s) if (migrate_colo() && s->state =3D=3D MIGRATION_STATUS_ACTIVE) { /* COLO does not support postcopy */ migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_COLO); + MIGRATION_STATUS_COLO, NULL); } else { migrate_set_state(&s->state, current_active_state, - MIGRATION_STATUS_COMPLETED); + MIGRATION_STATUS_COMPLETED, NULL); } =20 return; @@ -2785,12 +2800,12 @@ static void bg_migration_completion(MigrationState = *s) } =20 migrate_set_state(&s->state, current_active_state, - MIGRATION_STATUS_COMPLETED); + MIGRATION_STATUS_COMPLETED, NULL); return; =20 fail: migrate_set_state(&s->state, current_active_state, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); } =20 typedef enum MigThrError { @@ -2901,7 +2916,7 @@ static MigThrError postcopy_pause(MigrationState *s) close_return_path_on_source(s); =20 migrate_set_state(&s->state, s->state, - MIGRATION_STATUS_POSTCOPY_PAUSED); + MIGRATION_STATUS_POSTCOPY_PAUSED, NULL); =20 error_report("Detected IO failure for postcopy. " "Migration paused."); @@ -2979,7 +2994,7 @@ static MigThrError migration_detect_error(MigrationSt= ate *s) * For precopy (or postcopy with error outside IO), we fail * with no time. */ - migrate_set_state(&s->state, state, MIGRATION_STATUS_FAILED); + migrate_set_state(&s->state, state, MIGRATION_STATUS_FAILED, NULL); trace_migration_thread_file_err(); =20 /* Time to stop the migration, now. */ @@ -3279,7 +3294,8 @@ static void qemu_savevm_wait_unplug(MigrationState *s= , int old_state, int new_state) { if (qemu_savevm_state_guest_unplug_pending()) { - migrate_set_state(&s->state, old_state, MIGRATION_STATUS_WAIT_UNPL= UG); + migrate_set_state(&s->state, old_state, + MIGRATION_STATUS_WAIT_UNPLUG, NULL); =20 while (s->state =3D=3D MIGRATION_STATUS_WAIT_UNPLUG && qemu_savevm_state_guest_unplug_pending()) { @@ -3302,9 +3318,10 @@ static void qemu_savevm_wait_unplug(MigrationState *= s, int old_state, } } =20 - migrate_set_state(&s->state, MIGRATION_STATUS_WAIT_UNPLUG, new_sta= te); + migrate_set_state(&s->state, MIGRATION_STATUS_WAIT_UNPLUG, + new_state, NULL); } else { - migrate_set_state(&s->state, old_state, new_state); + migrate_set_state(&s->state, old_state, new_state, NULL); } } =20 @@ -3549,7 +3566,7 @@ static void *bg_migration_thread(void *opaque) fail: if (early_fail) { migrate_set_state(&s->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); bql_unlock(); } =20 @@ -3615,7 +3632,8 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) if (migrate_postcopy_ram() || migrate_return_path()) { if (open_return_path_on_source(s)) { error_setg(&local_err, "Unable to open return-path for postcop= y"); - migrate_set_state(&s->state, s->state, MIGRATION_STATUS_FAILED= ); + migrate_set_state(&s->state, s->state, + MIGRATION_STATUS_FAILED, NULL); migrate_set_error(s, local_err); error_report_err(local_err); migrate_fd_cleanup(s); @@ -3635,7 +3653,7 @@ void migrate_fd_connect(MigrationState *s, Error *err= or_in) if (resume) { /* Wakeup the main migration thread to do the recovery */ migrate_set_state(&s->state, MIGRATION_STATUS_POSTCOPY_PAUSED, - MIGRATION_STATUS_POSTCOPY_RECOVER); + MIGRATION_STATUS_POSTCOPY_RECOVER, NULL); qemu_sem_post(&s->postcopy_pause_sem); return; } diff --git a/migration/migration.h b/migration/migration.h index f2c8b8f286..9150478654 100644 --- a/migration/migration.h +++ b/migration/migration.h @@ -468,7 +468,10 @@ struct MigrationState { bool rdma_migration; }; =20 -void migrate_set_state(int *state, int old_state, int new_state); +void migrate_set_state(int *state, int old_state, + int new_state, const char *reason); +void migrate_set_state_err_reason(int *state, int old_state, + int new_state, const Error *err); =20 void migration_fd_process_incoming(QEMUFile *f); void migration_ioc_process_incoming(QIOChannel *ioc, Error **errp); diff --git a/migration/multifd.c b/migration/multifd.c index adfe8c9a0a..da3d397642 100644 --- a/migration/multifd.c +++ b/migration/multifd.c @@ -595,7 +595,7 @@ static void multifd_send_set_error(Error *err) s->state =3D=3D MIGRATION_STATUS_DEVICE || s->state =3D=3D MIGRATION_STATUS_ACTIVE) { migrate_set_state(&s->state, s->state, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); } } } @@ -1056,7 +1056,7 @@ bool multifd_send_setup(void) migrate_set_error(s, local_err); error_report_err(local_err); migrate_set_state(&s->state, MIGRATION_STATUS_SETUP, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); return false; } =20 @@ -1087,7 +1087,7 @@ static void multifd_recv_terminate_threads(Error *err) if (s->state =3D=3D MIGRATION_STATUS_SETUP || s->state =3D=3D MIGRATION_STATUS_ACTIVE) { migrate_set_state(&s->state, s->state, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); } } =20 diff --git a/migration/savevm.c b/migration/savevm.c index d612c8a902..be6cce8a51 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -1744,7 +1744,7 @@ static int qemu_savevm_state(QEMUFile *f, Error **err= p) } else { status =3D MIGRATION_STATUS_COMPLETED; } - migrate_set_state(&ms->state, MIGRATION_STATUS_SETUP, status); + migrate_set_state(&ms->state, MIGRATION_STATUS_SETUP, status, NULL); =20 /* f is outer parameter, it should not stay in global migration state = after * this function finished */ @@ -1999,7 +1999,7 @@ static void *postcopy_ram_listen_thread(void *opaque) object_ref(OBJECT(migr)); =20 migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE, - MIGRATION_STATUS_POSTCOPY_ACTIVE); + MIGRATION_STATUS_POSTCOPY_ACTIVE, NULL); qemu_sem_post(&mis->thread_sync_sem); trace_postcopy_ram_listen_thread_start(); =20 @@ -2037,7 +2037,7 @@ static void *postcopy_ram_listen_thread(void *opaque) } else { error_report("%s: loadvm failed: %d", __func__, load_res); migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIV= E, - MIGRATION_STATUS_FAILED); + MIGRATION_STATUS_FAILED, NULL); } } if (load_res >=3D 0) { @@ -2062,7 +2062,7 @@ static void *postcopy_ram_listen_thread(void *opaque) } =20 migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, - MIGRATION_STATUS_COMPLETED); + MIGRATION_STATUS_COMPLETED, NULL); /* * If everything has worked fine, then the main thread has waited * for us to start, and we're the last use of the mis. @@ -2257,7 +2257,7 @@ static int loadvm_postcopy_handle_resume(MigrationInc= omingState *mis) * This means source VM is ready to resume the postcopy migration. */ migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_RECOVER, - MIGRATION_STATUS_POSTCOPY_ACTIVE); + MIGRATION_STATUS_POSTCOPY_ACTIVE, NULL); =20 trace_loadvm_postcopy_handle_resume(); =20 @@ -2818,8 +2818,8 @@ static bool postcopy_pause_incoming(MigrationIncoming= State *mis) } =20 /* Current state can be either ACTIVE or RECOVER */ - migrate_set_state(&mis->state, mis->state, - MIGRATION_STATUS_POSTCOPY_PAUSED); + migrate_set_state(&mis->state, MIGRATION_STATUS_POSTCOPY_ACTIVE, + MIGRATION_STATUS_POSTCOPY_PAUSED, NULL); =20 /* Notify the fault thread for the invalidated file handle */ postcopy_fault_thread_notify(mis); diff --git a/qapi/migration.json b/qapi/migration.json index 5a565d9b8d..33bb5b7f50 100644 --- a/qapi/migration.json +++ b/qapi/migration.json @@ -1392,6 +1392,7 @@ # Emitted when a migration event happens # # @status: @MigrationStatus describing the current migration status. +# @reason: Optional description of status changing reason. # # Since: 2.4 # @@ -1402,7 +1403,7 @@ # "data": {"status": "completed"} } ## { 'event': 'MIGRATION', - 'data': {'status': 'MigrationStatus'}} + 'data': {'status': 'MigrationStatus', '*reason': 'str'}} =20 ## # @MIGRATION_PASS: --=20 2.34.1