aboutsummaryrefslogtreecommitdiff
path: root/migration/migration.c
diff options
context:
space:
mode:
Diffstat (limited to 'migration/migration.c')
-rw-r--r--migration/migration.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 8d56d56930..b7d9854bda 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1629,6 +1629,25 @@ static bool migrate_prepare(MigrationState *s, bool blk, bool blk_inc,
"paused migration");
return false;
}
+
+ /*
+ * Postcopy recovery won't work well with release-ram
+ * capability since release-ram will drop the page buffer as
+ * long as the page is put into the send buffer. So if there
+ * is a network failure happened, any page buffers that have
+ * not yet reached the destination VM but have already been
+ * sent from the source VM will be lost forever. Let's refuse
+ * the client from resuming such a postcopy migration.
+ * Luckily release-ram was designed to only be used when src
+ * and destination VMs are on the same host, so it should be
+ * fine.
+ */
+ if (migrate_release_ram()) {
+ error_setg(errp, "Postcopy recovery cannot work "
+ "when release-ram capability is set");
+ return false;
+ }
+
/* This is a resume, skip init status */
return true;
}
@@ -2877,6 +2896,7 @@ static void migration_iteration_finish(MigrationState *s)
/* Fallthrough */
case MIGRATION_STATUS_FAILED:
case MIGRATION_STATUS_CANCELLED:
+ case MIGRATION_STATUS_CANCELLING:
if (s->vm_was_running) {
vm_start();
} else {
@@ -3032,8 +3052,6 @@ void migrate_fd_connect(MigrationState *s, Error *error_in)
} else {
/* This is a fresh new migration */
rate_limit = s->parameters.max_bandwidth / XFER_LIMIT_RATIO;
- s->expected_downtime = s->parameters.downtime_limit;
- s->cleanup_bh = qemu_bh_new(migrate_fd_cleanup, s);
/* Notify before starting migration thread */
notifier_list_notify(&migration_state_notifiers, s);