From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Zhang Chen <chen.zhang@intel.com>
Cc: Li Zhijian <lizhijian@cn.fujitsu.com>,
Zhang Chen <zhangckid@gmail.com>,
Juan Quintela <quintela@redhat.com>,
zhanghailiang <zhang.zhanghailiang@huawei.com>,
Markus Armbruster <armbru@redhat.com>,
Eric Blake <eblake@redhat.com>, qemu-dev <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH V3 7/7] Migration/colo.c: Make user obtain the COLO mode info after failover
Date: Fri, 8 Mar 2019 17:45:56 +0000 [thread overview]
Message-ID: <20190308174556.GH2834@work-vm> (raw)
In-Reply-To: <20190303145021.2962-8-chen.zhang@intel.com>
* Zhang Chen (chen.zhang@intel.com) wrote:
> From: Zhang Chen <chen.zhang@intel.com>
>
> Add the last_colo_mode to save the status after failover.
> This patch can solve the issue that user got nothing to call
> query_colo_status after failover.
I don't understand what this is doing; cna you show me an example
of the way the state looks before and after the patch?
Dave
> Signed-off-by: Zhang Chen <chen.zhang@intel.com>
> ---
> migration/colo.c | 28 +++++++++++++++++++++++-----
> 1 file changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/migration/colo.c b/migration/colo.c
> index d1ae2e6d11..6eba8e06f2 100644
> --- a/migration/colo.c
> +++ b/migration/colo.c
> @@ -38,6 +38,9 @@
> static bool vmstate_loading;
> static Notifier packets_compare_notifier;
>
> +/* User need to know colo mode after COLO failover */
> +static COLOMode last_colo_mode;
> +
> #define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024)
>
> bool migration_in_colo_state(void)
> @@ -197,7 +200,10 @@ void colo_do_failover(MigrationState *s)
> vm_stop_force_state(RUN_STATE_COLO);
> }
>
> - switch (get_colo_mode()) {
> + /* Update last_COLO_mode to avoid unexpectedly exit COLO status */
> + last_colo_mode = get_colo_mode();
> +
> + switch (last_colo_mode) {
> case COLO_MODE_PRIMARY:
> primary_vm_do_failover();
> break;
> @@ -263,7 +269,7 @@ COLOStatus *qmp_query_colo_status(Error **errp)
> {
> COLOStatus *s = g_new0(COLOStatus, 1);
>
> - s->mode = get_colo_mode();
> + s->mode = last_colo_mode;
>
> switch (failover_get_state()) {
> case FAILOVER_STATUS_NONE:
> @@ -515,6 +521,12 @@ static void colo_process_checkpoint(MigrationState *s)
> Error *local_err = NULL;
> int ret;
>
> + last_colo_mode = get_colo_mode();
> + if (last_colo_mode != COLO_MODE_PRIMARY) {
> + error_report("COLO mode must be COLO_MODE_PRIMARY");
> + return;
> + }
> +
> failover_init_state();
>
> s->rp_state.from_dst_file = qemu_file_get_return_path(s->to_dst_file);
> @@ -682,12 +694,18 @@ void *colo_process_incoming_thread(void *opaque)
> Error *local_err = NULL;
> int ret;
>
> - rcu_register_thread();
> - qemu_sem_init(&mis->colo_incoming_sem, 0);
> -
> migrate_set_state(&mis->state, MIGRATION_STATUS_ACTIVE,
> MIGRATION_STATUS_COLO);
>
> + last_colo_mode = get_colo_mode();
> + if (last_colo_mode != COLO_MODE_SECONDARY) {
> + error_report("COLO mode must be COLO_MODE_SECONDARY");
> + return NULL;
> + }
> +
> + rcu_register_thread();
> + qemu_sem_init(&mis->colo_incoming_sem, 0);
> +
> failover_init_state();
>
> mis->to_src_file = qemu_file_get_return_path(mis->from_src_file);
> --
> 2.17.GIT
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2019-03-08 17:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-03 14:50 [Qemu-devel] [PATCH V3 0/7] Migration/colo: Fix upstream bugs when occur failover Zhang Chen
2019-03-03 14:50 ` [Qemu-devel] [PATCH V3 1/7] Migration/colo.c: Fix double close bug when occur COLO failover Zhang Chen
2019-03-03 14:50 ` [Qemu-devel] [PATCH V3 2/7] Migration/colo.c: Fix COLO failover status error Zhang Chen
2019-03-08 17:32 ` Dr. David Alan Gilbert
2019-03-03 14:50 ` [Qemu-devel] [PATCH V3 3/7] Migration/colo.c: Make COLO node running after failover Zhang Chen
2019-03-03 14:50 ` [Qemu-devel] [PATCH V3 4/7] Migration/colo.c: Add new COLOExitReason to handle all failover state Zhang Chen
2019-03-08 17:39 ` Dr. David Alan Gilbert
2019-03-09 17:06 ` Markus Armbruster
2019-03-11 9:08 ` Zhang, Chen
2019-03-03 14:50 ` [Qemu-devel] [PATCH V3 5/7] qapi/migration.json: Remove a variable that doesn't exist in example Zhang Chen
2019-03-03 14:50 ` [Qemu-devel] [PATCH V3 6/7] Migration/colo.c: Add the necessary checks for colo_do_failover Zhang Chen
2019-03-08 17:41 ` Dr. David Alan Gilbert
2019-03-08 18:36 ` Zhang, Chen
2019-03-08 19:02 ` Dr. David Alan Gilbert
2019-03-03 14:50 ` [Qemu-devel] [PATCH V3 7/7] Migration/colo.c: Make user obtain the COLO mode info after failover Zhang Chen
2019-03-08 17:45 ` Dr. David Alan Gilbert [this message]
2019-03-08 18:47 ` Zhang, Chen
2019-03-05 15:22 ` [Qemu-devel] [PATCH V3 0/7] Migration/colo: Fix upstream bugs when occur failover Dr. David Alan Gilbert
2019-03-05 15:33 ` Zhang, Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190308174556.GH2834@work-vm \
--to=dgilbert@redhat.com \
--cc=armbru@redhat.com \
--cc=chen.zhang@intel.com \
--cc=eblake@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=zhang.zhanghailiang@huawei.com \
--cc=zhangckid@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).