mirror of
https://github.com/mii443/qemu.git
synced 2025-08-25 16:39:37 +00:00
COLO: Remove colo_state migration struct
We need to know if migration is going into COLO state for incoming side before start normal migration. Instead by using the VMStateDescription to send colo_state from source side to destination side, we use MIG_CMD_ENABLE_COLO to indicate whether COLO is enabled or not. Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com> Signed-off-by: Zhang Chen <zhangckid@gmail.com> Signed-off-by: Zhang Chen <chen.zhang@intel.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
@ -296,6 +296,22 @@ int migrate_send_rp_req_pages(MigrationIncomingState *mis, const char *rbname,
|
||||
return migrate_send_rp_message(mis, msg_type, msglen, bufc);
|
||||
}
|
||||
|
||||
static bool migration_colo_enabled;
|
||||
bool migration_incoming_colo_enabled(void)
|
||||
{
|
||||
return migration_colo_enabled;
|
||||
}
|
||||
|
||||
void migration_incoming_disable_colo(void)
|
||||
{
|
||||
migration_colo_enabled = false;
|
||||
}
|
||||
|
||||
void migration_incoming_enable_colo(void)
|
||||
{
|
||||
migration_colo_enabled = true;
|
||||
}
|
||||
|
||||
void qemu_start_incoming_migration(const char *uri, Error **errp)
|
||||
{
|
||||
const char *p;
|
||||
@ -418,7 +434,7 @@ static void process_incoming_migration_co(void *opaque)
|
||||
}
|
||||
|
||||
/* we get COLO info, and know if we are in COLO mode */
|
||||
if (!ret && migration_incoming_enable_colo()) {
|
||||
if (!ret && migration_incoming_colo_enabled()) {
|
||||
/* Make sure all file formats flush their mutable metadata */
|
||||
bdrv_invalidate_cache_all(&local_err);
|
||||
if (local_err) {
|
||||
@ -3025,6 +3041,11 @@ static void *migration_thread(void *opaque)
|
||||
qemu_savevm_send_postcopy_advise(s->to_dst_file);
|
||||
}
|
||||
|
||||
if (migrate_colo_enabled()) {
|
||||
/* Notify migration destination that we enable COLO */
|
||||
qemu_savevm_send_colo_enable(s->to_dst_file);
|
||||
}
|
||||
|
||||
qemu_savevm_state_setup(s->to_dst_file);
|
||||
|
||||
s->setup_time = qemu_clock_get_ms(QEMU_CLOCK_HOST) - setup_start;
|
||||
|
Reference in New Issue
Block a user