mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
Migration/colo.c: Make user obtain the last COLO mode info after failover
Add the last_colo_mode to save the status after failover. This patch can solve the issue that user want to get last colo mode use query_colo_status after failover. Signed-off-by: Zhang Chen <chen.zhang@intel.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
This commit is contained in:
parent
82cd368ccd
commit
5ed0deca41
2 changed files with 22 additions and 1 deletions
|
@ -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)
|
||||
|
@ -264,6 +267,7 @@ COLOStatus *qmp_query_colo_status(Error **errp)
|
|||
COLOStatus *s = g_new0(COLOStatus, 1);
|
||||
|
||||
s->mode = get_colo_mode();
|
||||
s->last_mode = last_colo_mode;
|
||||
|
||||
switch (failover_get_state()) {
|
||||
case FAILOVER_STATUS_NONE:
|
||||
|
@ -515,6 +519,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);
|
||||
|
@ -688,6 +698,12 @@ void *colo_process_incoming_thread(void *opaque)
|
|||
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;
|
||||
}
|
||||
|
||||
failover_init_state();
|
||||
|
||||
mis->to_src_file = qemu_file_get_return_path(mis->from_src_file);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue