*/
#include "qemu/osdep.h"
-#include "qemu/timer.h"
#include "sysemu/sysemu.h"
#include "qemu-file-channel.h"
-#include "migration/migration.h"
-#include "migration/qemu-file.h"
+#include "migration.h"
+#include "qemu-file.h"
+#include "savevm.h"
#include "migration/colo.h"
-#include "migration/block.h"
+#include "block.h"
#include "io/channel-buffer.h"
#include "trace.h"
#include "qemu/error-report.h"
-#include "qapi/error.h"
#include "migration/failover.h"
#include "replication.h"
#include "qmp-commands.h"
#define COLO_BUFFER_BASE_SIZE (4 * 1024 * 1024)
-bool colo_supported(void)
-{
- return true;
-}
-
bool migration_in_colo_state(void)
{
MigrationState *s = migrate_get_current();
FAILOVER_STATUS_RELAUNCH);
if (old_state != FAILOVER_STATUS_ACTIVE) {
error_report("Unknown error while do failover for secondary VM,"
- "old_state: %s", FailoverStatus_lookup[old_state]);
+ "old_state: %s", FailoverStatus_str(old_state));
}
return;
}
FAILOVER_STATUS_COMPLETED);
if (old_state != FAILOVER_STATUS_ACTIVE) {
error_report("Incorrect state (%s) while doing failover for "
- "secondary VM", FailoverStatus_lookup[old_state]);
+ "secondary VM", FailoverStatus_str(old_state));
return;
}
/* Notify COLO incoming thread that failover work is finished */
FAILOVER_STATUS_COMPLETED);
if (old_state != FAILOVER_STATUS_ACTIVE) {
error_report("Incorrect state (%s) while doing failover for Primary VM",
- FailoverStatus_lookup[old_state]);
+ FailoverStatus_str(old_state));
return;
}
/* Notify COLO thread that failover work is finished */
if (ret < 0) {
error_setg_errno(errp, -ret, "Can't send COLO message");
}
- trace_colo_send_message(COLOMessage_lookup[msg]);
+ trace_colo_send_message(COLOMessage_str(msg));
}
static void colo_send_message_value(QEMUFile *f, COLOMessage msg,
ret = qemu_file_get_error(f);
if (ret < 0) {
error_setg_errno(errp, -ret, "Failed to send value for message:%s",
- COLOMessage_lookup[msg]);
+ COLOMessage_str(msg));
}
}
error_setg(errp, "%s: Invalid message", __func__);
return msg;
}
- trace_colo_receive_message(COLOMessage_lookup[msg]);
+ trace_colo_receive_message(COLOMessage_str(msg));
return msg;
}
ret = qemu_file_get_error(f);
if (ret < 0) {
error_setg_errno(errp, -ret, "Failed to get value for COLO message: %s",
- COLOMessage_lookup[expect_msg]);
+ COLOMessage_str(expect_msg));
}
return value;
}
/* Disable block migration */
migrate_set_block_enabled(false, &local_err);
qemu_savevm_state_header(fb);
- qemu_savevm_state_begin(fb);
+ qemu_savevm_state_setup(fb);
qemu_mutex_lock_iothread();
- qemu_savevm_state_complete_precopy(fb, false);
+ qemu_savevm_state_complete_precopy(fb, false, false);
qemu_mutex_unlock_iothread();
qemu_fflush(fb);
}
qemu_mutex_lock_iothread();
- qemu_system_reset(VMRESET_SILENT);
+ qemu_system_reset(SHUTDOWN_CAUSE_NONE);
vmstate_loading = true;
if (qemu_loadvm_state(fb) < 0) {
error_report("COLO: loadvm failed");