-----Original Message-----
From: Dr. David Alan Gilbert [mailto:dgilb...@redhat.com]
Sent: Thursday, February 28, 2019 9:03 PM
To: Zhang, Chen <chen.zh...@intel.com>
Cc: Li Zhijian <lizhij...@cn.fujitsu.com>; Zhang Chen <zhangc...@gmail.com>;
Juan Quintela <quint...@redhat.com>; zhanghailiang
<zhang.zhanghaili...@huawei.com>; qemu-dev <qemu-devel@nongnu.org>
Subject: Re: [PATCH 2/3] Migration/colo.c: Fix COLO failover status error
* Zhang, Chen (chen.zh...@intel.com) wrote:
>
> -----Original Message-----
> From: Dr. David Alan Gilbert [mailto:dgilb...@redhat.com]
> Sent: Tuesday, February 26, 2019 6:55 PM
> To: Zhang, Chen <chen.zh...@intel.com>
> Cc: Li Zhijian <lizhij...@cn.fujitsu.com>; Zhang Chen
> <zhangc...@gmail.com>; Juan Quintela <quint...@redhat.com>;
> zhanghailiang <zhang.zhanghaili...@huawei.com>; qemu-dev
> <qemu-devel@nongnu.org>
> Subject: Re: [PATCH 2/3] Migration/colo.c: Fix COLO failover status
> error
>
> * Zhang Chen (chen.zh...@intel.com) wrote:
> > From: Zhang Chen <chen.zh...@intel.com>
> >
> > When finished COLO failover, the status is FAILOVER_STATUS_COMPLETED.
> > The origin codes misunderstand the FAILOVER_STATUS_REQUIRE.
> >
> > Signed-off-by: Zhang Chen <chen.zh...@intel.com>
>
> > Why do these 'case's have to only deal with COMPLETED - what stops the
> > REQUIRE/ACTIVE states appearing when these routines check the status; even
> > if those states only happen for a short amount of time?
>
> Yes, other status just marked the failover processing. We can see
> colo_failover_bh(), the REQUIRE/ACTIVE only exist for a very short time.
But those other states do exist - so don't these case statements have to do
something with them?
Yes, you are right.
I will add another one patch to handle other states in this series next version.
Thanks
Zhang Chen
Dave
>
> Thanks
> Zhang Chen
>
> Dave
>
> > ---
> > migration/colo.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/migration/colo.c b/migration/colo.c index
> > a916dc178c..a13acac192 100644
> > --- a/migration/colo.c
> > +++ b/migration/colo.c
> > @@ -121,6 +121,7 @@ static void secondary_vm_do_failover(void)
> > }
> > /* Notify COLO incoming thread that failover work is finished */
> > qemu_sem_post(&mis->colo_incoming_sem);
> > +
> > /* For Secondary VM, jump to incoming co */
> > if (mis->migration_incoming_co) {
> > qemu_coroutine_enter(mis->migration_incoming_co);
> > @@ -262,7 +263,7 @@ COLOStatus *qmp_query_colo_status(Error **errp)
> > case FAILOVER_STATUS_NONE:
> > s->reason = COLO_EXIT_REASON_NONE;
> > break;
> > - case FAILOVER_STATUS_REQUIRE:
> > + case FAILOVER_STATUS_COMPLETED:
> > s->reason = COLO_EXIT_REASON_REQUEST;
> > break;
> > default:
> > @@ -582,7 +583,7 @@ out:
> > qapi_event_send_colo_exit(COLO_MODE_PRIMARY,
> > COLO_EXIT_REASON_ERROR);
> > break;
> > - case FAILOVER_STATUS_REQUIRE:
> > + case FAILOVER_STATUS_COMPLETED:
> > qapi_event_send_colo_exit(COLO_MODE_PRIMARY,
> > COLO_EXIT_REASON_REQUEST);
> > break;
> > @@ -854,7 +855,7 @@ out:
> > qapi_event_send_colo_exit(COLO_MODE_SECONDARY,
> > COLO_EXIT_REASON_ERROR);
> > break;
> > - case FAILOVER_STATUS_REQUIRE:
> > + case FAILOVER_STATUS_COMPLETED:
> > qapi_event_send_colo_exit(COLO_MODE_SECONDARY,
> > COLO_EXIT_REASON_REQUEST);
> > break;
> > --
> > 2.17.GIT
> >
> --
> Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK