Migration/colo.c: Fix upstream bugs when occur failover
cover Migration/colo.c: Fix upstream bugs when occur failover
From: Zhang Chen <[email protected]>
Fix three bugs after COLO failover.
Zhang Chen (3):
Migration/colo.c: Fix double close bug when occur COLO failover Migration/colo.c: Fix COLO failover status error Migration/colo.c: Make COLO node running after failover
migration/colo.c | 9 +++++---- migration/migration.c | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-)
Signature · 1 line
2.17.GIT
PATCH 1/3 Migration/colo.c: Fix double close bug when occur COLO failover
From: Zhang Chen <[email protected]>
In migration_incoming_state_destroy(void) will check the mis->to_src_file to double close the mis->to_src_file when occur COLO failover.
--- migration/colo.c | 1 + 1 file changed, 1 insertion(+)
migration/colo.c +1 -0
@@ -872,6 +872,7 @@ out:/* Must be called after failover BH is completed */ if (mis->to_src_file) {qemu_fclose (mis->to_src_file); + mis->to_src_file =NULL ; }migration_incoming_disable_colo ();
Signature · 1 line
2.17.GIT
Re: [Qemu-devel] [PATCH 1/3] Migration/colo.c: Fix double close bug when occur COLO failover
Quoted 6 lines · * Zhang Chen ([email protected]) wrote:
From: Zhang Chen <[email protected]>
In
migration_incoming_state_destroy(void)will check themis->to_src_fileto double close themis->to_src_filewhen occur COLO failover.Signed-off-by Zhang Chen <[email protected]>
Quoted 19 lines
--- migration/colo.c | 1 + 1 file changed, 1 insertion(+)migration/colo.c +1
-0@@ -872,6 +872,7 @@ out:/* Must be called after failover BH is completed */ if (mis->to_src_file) {qemu_fclose (mis->to_src_file); + mis->to_src_file =NULL ; }migration_incoming_disable_colo ();Signature · 1 line
2.17.GIT
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
PATCH 2/3 Migration/colo.c: Fix COLO failover status error
In reply to Zhang ChenFrom: Zhang Chen <[email protected]>
When finished COLO failover, the status is FAILOVER_STATUS_COMPLETED. The origin codes misunderstand the FAILOVER_STATUS_REQUIRE.
--- migration/colo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
migration/colo.c +4 -3
@@ -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 ;
Signature · 1 line
2.17.GIT
Re: [Qemu-devel] [PATCH 2/3] Migration/colo.c: Fix COLO failover status error
Quoted 6 lines · * Zhang Chen ([email protected]) wrote:
From: Zhang Chen <[email protected]>
When finished COLO failover, the status is
FAILOVER_STATUS_COMPLETED. The origin codes misunderstand theFAILOVER_STATUS_REQUIRE.Signed-off-by Zhang Chen <[email protected]>
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?
Dave
Quoted 46 lines
--- migration/colo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)migration/colo.c +4
-3@@ -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 ;Signature · 1 line
2.17.GIT
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] [PATCH 2/3] Migration/colo.c: Fix COLO failover status error
-----Original Message-----
From: Dr. David Alan Gilbert [mailto:[email protected]]
Sent: Tuesday, February 26, 2019 6:55 PM
To: Zhang, Chen <[email protected]>
Cc: Li Zhijian <[email protected]>; Zhang Chen <[email protected]>; Juan Quintela <[email protected]>; zhanghailiang <[email protected]>; qemu-dev <[email protected]>
Subject: Re: [PATCH 2/3] Migration/colo.c: Fix COLO failover status error
Quoted 6 lines · * Zhang Chen ([email protected]) wrote:
From: Zhang Chen <[email protected]>
When finished COLO failover, the status is
FAILOVER_STATUS_COMPLETED. The origin codes misunderstand theFAILOVER_STATUS_REQUIRE.Signed-off-by Zhang Chen <[email protected]>
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.
Thanks
Zhang Chen
Dave
Quoted 44 lines
--- migration/colo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)migration/colo.c index renamed from migration/colo.c +0
-0
a916dc178c..a13acac192100644migration/colo.c +4
-4@@ -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 ; --
Quoted 2 lines
2.17.GIT
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] [PATCH 2/3] Migration/colo.c: Fix COLO failover status error
Quoted 11 lines · * Zhang, Chen ([email protected]) wrote:
-----Original Message-----
From: Dr. David Alan Gilbert [mailto:[email protected]]
Sent: Tuesday, February 26, 2019 6:55 PM
To: Zhang, Chen <[email protected]>
Cc: Li Zhijian <[email protected]>; Zhang Chen <[email protected]>; Juan Quintela <[email protected]>; zhanghailiang <[email protected]>; qemu-dev <[email protected]>
Subject: Re: [PATCH 2/3]Migration/colo.c: Fix COLO failover status errorQuoted 2 lines · * Zhang Chen ([email protected]) wrote:
From: Zhang Chen <[email protected]>
Quoted 8 lines
Quoted 6 lines
When finished COLO failover, the status is
FAILOVER_STATUS_COMPLETED. The origin codes misunderstand theFAILOVER_STATUS_REQUIRE.Signed-off-by Zhang Chen <[email protected]>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?
Dave
Quoted 46 lines
Thanks
Zhang ChenDave
Quoted 40 lines
--- migration/colo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)migration/colo.c index renamed from migration/colo.c +0
-0
a916dc178c..a13acac192100644migration/colo.c +4
-3@@ -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 :
Quoted 8 lines
Quoted 6 lines
migration/colo.c +0
-1qapi_event_send_colo_exit (COLO_MODE_SECONDARY ,COLO_EXIT_REASON_REQUEST );break ; --2.17.GIT
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
Re: [Qemu-devel] [PATCH 2/3] Migration/colo.c: Fix COLO failover status error
-----Original Message-----
From: Dr. David Alan Gilbert [mailto:[email protected]]
Sent: Thursday, February 28, 2019 9:03 PM
To: Zhang, Chen <[email protected]>
Cc: Li Zhijian <[email protected]>; Zhang Chen <[email protected]>; Juan Quintela <[email protected]>; zhanghailiang <[email protected]>; qemu-dev <[email protected]>
Subject: Re: [PATCH 2/3] Migration/colo.c: Fix COLO failover status error
Quoted 15 lines · * Zhang, Chen ([email protected]) wrote:
-----Original Message-----
From: Dr. David Alan Gilbert [mailto:[email protected]]
Sent: Tuesday, February 26, 2019 6:55 PM
To: Zhang, Chen <[email protected]>
Cc: Li Zhijian <[email protected]>; Zhang Chen <[email protected]>; Juan Quintela <[email protected]>; zhanghailiang <[email protected]>; qemu-dev <[email protected]>
Subject: Re: [PATCH 2/3]Migration/colo.c: Fix COLO failover status errorQuoted 2 lines · * Zhang Chen ([email protected]) wrote:
From: Zhang Chen <[email protected]>
Quoted 8 lines
Quoted 6 lines
When finished COLO failover, the status is
FAILOVER_STATUS_COMPLETED. The origin codes misunderstand theFAILOVER_STATUS_REQUIRE.Signed-off-by Zhang Chen <[email protected]>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
Quoted 46 lines
Thanks
Zhang ChenDave
Quoted 40 lines
--- migration/colo.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)migration/colo.c index renamed from migration/colo.c +0
-0
a916dc178c..a13acac192100644migration/colo.c +4
-3@@ -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 :
Quoted 8 lines
Quoted 6 lines
migration/colo.c +0
-1qapi_event_send_colo_exit (COLO_MODE_SECONDARY ,COLO_EXIT_REASON_REQUEST );break ; --2.17.GIT
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK
PATCH 3/3 Migration/colo.c: Make COLO node running after failover
In reply to Zhang ChenFrom: Zhang Chen <[email protected]>
Delay to close COLO for auto start VM after failover.
--- migration/colo.c | 1 - migration/migration.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
migration/colo.c +0 -1
@@ -875,7 +875,6 @@ out:qemu_fclose (mis->to_src_file); mis->to_src_file =NULL ; } -migration_incoming_disable_colo ();rcu_unregister_thread ();return NULL ;
migration/migration.c +3 -0
@@ -383,6 +383,9 @@ static void process_incoming_migration_bh(void *opaque) }else {runstate_set (RUN_STATE_PAUSED ); } + }else if (migration_incoming_colo_enabled ()) { +migration_incoming_disable_colo (); +vm_start (); }else {runstate_set (global_state_get_runstate ()); }
Signature · 1 line
2.17.GIT
Re: [Qemu-devel] [PATCH 3/3] Migration/colo.c: Make COLO node running after failover
Quoted 5 lines · * Zhang Chen ([email protected]) wrote:
From: Zhang Chen <[email protected]>
Delay to close COLO for auto start VM after failover.
Signed-off-by Zhang Chen <[email protected]>
Yes, I guess the state sent over the global state is probably RUN_STATE_COLO so it doesn't autostart on new machine types, and this looks like it would fix it.
Quoted 34 lines
--- migration/colo.c | 1 - migration/migration.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)migration/colo.c +0
-1@@ -875,7 +875,6 @@ out:qemu_fclose (mis->to_src_file); mis->to_src_file =NULL ; } -migration_incoming_disable_colo ();rcu_unregister_thread ();return NULL ;migration/migration.c +3
-0@@ -383,6 +383,9 @@ static void process_incoming_migration_bh(void *opaque) }else {runstate_set (RUN_STATE_PAUSED ); } + }else if (migration_incoming_colo_enabled ()) { +migration_incoming_disable_colo (); +vm_start (); }else {runstate_set (global_state_get_runstate ()); }Signature · 1 line
2.17.GIT
--
Dr. David Alan Gilbert / [email protected] / Manchester, UK