#include "io/channel-buffer.h"
#include "trace.h"
#include "qemu/error-report.h"
+#include "qemu/main-loop.h"
+#include "qemu/rcu.h"
#include "migration/failover.h"
#ifdef CONFIG_REPLICATION
#include "replication.h"
#include "qapi/qapi-events-migration.h"
#include "qapi/qmp/qerror.h"
#include "sysemu/cpus.h"
+#include "sysemu/runstate.h"
#include "net/filter.h"
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)
}
}
-void colo_do_failover(MigrationState *s)
+void colo_do_failover(void)
{
/* Make sure VM stopped while failover happened. */
if (!colo_runstate_is_stopped()) {
void qmp_xen_colo_do_checkpoint(Error **errp)
{
replication_do_checkpoint_all(errp);
+ /* Notify all filters of all NIC to do checkpoint */
+ colo_notify_filters_event(COLO_EVENT_CHECKPOINT, errp);
}
#endif
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:
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);
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);