Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 21 ++++++++++++++++++---
src/qemu/qemu_migration.h | 1 +
src/qemu/qemu_migration_params.c | 6 ++++++
src/qemu/qemu_migration_params.h | 1 +
4 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3ba0aa502b..09445354a9 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -2611,6 +2611,13 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
return NULL;
}
+ if (flags & VIR_MIGRATE_POSTCOPY_PREEMPT &&
+ !(flags & VIR_MIGRATE_POSTCOPY)) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("post-copy preemption can only be enabled for post-copy
migration"));
+ return NULL;
+ }
+
if (flags & VIR_MIGRATE_OFFLINE) {
if (flags & (VIR_MIGRATE_NON_SHARED_DISK |
VIR_MIGRATE_NON_SHARED_INC)) {
@@ -3605,6 +3612,13 @@ qemuMigrationDstPrepareAny(virQEMUDriver *driver,
return -1;
}
+ if (flags & VIR_MIGRATE_POSTCOPY_PREEMPT &&
+ !(flags & VIR_MIGRATE_POSTCOPY)) {
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
+ _("post-copy preemption can only be enabled for post-copy
migration"));
+ return -1;
+ }
+
if (cfg->migrateTLSForce &&
!(flags & VIR_MIGRATE_TUNNELLED) &&
!(flags & VIR_MIGRATE_TLS)) {
@@ -5210,10 +5224,11 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver,
spec.dest.socket.path = uribits->path;
} else {
- /* RDMA and multi-fd migration requires QEMU to connect to the destination
- * itself.
+ /* RDMA, multi-fd, and postcopy-preempt migration requires QEMU to
+ * connect to the destination itself.
*/
- if (STREQ(uribits->scheme, "rdma") || (flags &
VIR_MIGRATE_PARALLEL))
+ if (STREQ(uribits->scheme, "rdma") ||
+ flags & (VIR_MIGRATE_PARALLEL | VIR_MIGRATE_POSTCOPY_PREEMPT))
spec.destType = MIGRATION_DEST_HOST;
else
spec.destType = MIGRATION_DEST_CONNECT_HOST;
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index ed62fd4a91..27fb783359 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -62,6 +62,7 @@
VIR_MIGRATE_NON_SHARED_SYNCHRONOUS_WRITES | \
VIR_MIGRATE_POSTCOPY_RESUME | \
VIR_MIGRATE_ZEROCOPY | \
+ VIR_MIGRATE_POSTCOPY_PREEMPT | \
0)
/* All supported migration parameters and their types. */
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 79fe6e97c8..35eafd8f0d 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -99,6 +99,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability,
"dirty-bitmaps",
"return-path",
"zero-copy-send",
+ "postcopy-preempt",
);
@@ -194,6 +195,11 @@ static const qemuMigrationParamsFlagMapItem
qemuMigrationParamsFlagMap[] = {
VIR_MIGRATE_ZEROCOPY,
QEMU_MIGRATION_CAP_ZERO_COPY_SEND,
QEMU_MIGRATION_SOURCE},
+
+ {QEMU_MIGRATION_FLAG_REQUIRED,
+ VIR_MIGRATE_POSTCOPY_PREEMPT,
+ QEMU_MIGRATION_CAP_POSTCOPY_PREEMPT,
+ QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
};
/* Translation from VIR_MIGRATE_PARAM_* typed parameters to
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 5857673227..74f1680e9e 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -40,6 +40,7 @@ typedef enum {
QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS,
QEMU_MIGRATION_CAP_RETURN_PATH,
QEMU_MIGRATION_CAP_ZERO_COPY_SEND,
+ QEMU_MIGRATION_CAP_POSTCOPY_PREEMPT,
QEMU_MIGRATION_CAP_LAST
} qemuMigrationCapability;
--
2.43.0