The VIR_MIGRATE_PARALLEL flag is implemented using QEMU's multifd
migration capability and the corresponding multifd-channels migration
parameter.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
QEMU still uses the x- prefix for multifd capability and multifd-channels,
but Juan already sent a series of patches to make multifd migration fully
supported by dropping the experimental prefix.
src/qemu/qemu_migration.c | 9 ++++++---
src/qemu/qemu_migration.h | 5 ++++-
src/qemu/qemu_migration_params.c | 18 ++++++++++++++++++
src/qemu/qemu_migration_params.h | 2 ++
4 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3107a279dd..22f31680c9 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3822,10 +3822,13 @@ qemuMigrationSrcPerformNative(virQEMUDriverPtr driver,
}
}
- if (STRNEQ(uribits->scheme, "rdma"))
- spec.destType = MIGRATION_DEST_CONNECT_HOST;
- else
+ /* RDMA and multi-fd migration requires QEMU to connect to the destination
+ * itself.
+ */
+ if (STREQ(uribits->scheme, "rdma") || (flags &
VIR_MIGRATE_PARALLEL))
spec.destType = MIGRATION_DEST_HOST;
+ else
+ spec.destType = MIGRATION_DEST_CONNECT_HOST;
spec.dest.host.protocol = uribits->scheme;
spec.dest.host.name = uribits->server;
spec.dest.host.port = uribits->port;
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index ca73d3e467..fea5000a4d 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -57,7 +57,9 @@
VIR_MIGRATE_AUTO_CONVERGE | \
VIR_MIGRATE_RDMA_PIN_ALL | \
VIR_MIGRATE_POSTCOPY | \
- VIR_MIGRATE_TLS)
+ VIR_MIGRATE_TLS | \
+ VIR_MIGRATE_PARALLEL | \
+ 0)
/* All supported migration parameters and their types. */
# define QEMU_MIGRATION_PARAMETERS \
@@ -80,6 +82,7 @@
VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL, VIR_TYPED_PARAM_INT, \
VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT, VIR_TYPED_PARAM_INT, \
VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY, VIR_TYPED_PARAM_ULLONG, \
+ VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS, VIR_TYPED_PARAM_INT, \
NULL
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 28f2c75ea1..82416667a6 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -86,6 +86,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability, QEMU_MIGRATION_CAP_LAST,
"compress",
"pause-before-switchover",
"late-block-activate",
+ "multifd",
);
@@ -103,6 +104,7 @@ VIR_ENUM_IMPL(qemuMigrationParam, QEMU_MIGRATION_PARAM_LAST,
"block-incremental",
"xbzrle-cache-size",
"max-postcopy-bandwidth",
+ "multifd-channels",
);
typedef struct _qemuMigrationParamsAlwaysOnItem qemuMigrationParamsAlwaysOnItem;
@@ -151,6 +153,10 @@ static const qemuMigrationParamsFlagMapItem
qemuMigrationParamsFlagMap[] = {
{VIR_MIGRATE_POSTCOPY,
QEMU_MIGRATION_CAP_POSTCOPY,
QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
+
+ {VIR_MIGRATE_PARALLEL,
+ QEMU_MIGRATION_CAP_MULTIFD,
+ QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
};
/* Translation from VIR_MIGRATE_PARAM_* typed parameters to
@@ -184,6 +190,10 @@ static const qemuMigrationParamsTPMapItem qemuMigrationParamsTPMap[]
= {
.unit = 1024 * 1024, /* MiB/s */
.param = QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH,
.party = QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
+
+ {.typedParam = VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS,
+ .param = QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS,
+ .party = QEMU_MIGRATION_SOURCE | QEMU_MIGRATION_DESTINATION},
};
static const qemuMigrationParamType qemuMigrationParamTypes[] = {
@@ -199,6 +209,7 @@ static const qemuMigrationParamType qemuMigrationParamTypes[] = {
[QEMU_MIGRATION_PARAM_BLOCK_INCREMENTAL] = QEMU_MIGRATION_PARAM_TYPE_BOOL,
[QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE] = QEMU_MIGRATION_PARAM_TYPE_ULL,
[QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = QEMU_MIGRATION_PARAM_TYPE_ULL,
+ [QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = QEMU_MIGRATION_PARAM_TYPE_INT,
};
verify(ARRAY_CARDINALITY(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LAST);
@@ -535,6 +546,13 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
goto error;
}
+ if (migParams->params[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS].set &&
+ !(flags & VIR_MIGRATE_PARALLEL)) {
+ virReportError(VIR_ERR_INVALID_ARG, "%s",
+ _("Turn parallel migration on to tune it"));
+ goto error;
+ }
+
if (qemuMigrationParamsSetCompression(params, nparams, flags, migParams) < 0)
goto error;
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 233ebe772b..0515339d91 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -38,6 +38,7 @@ typedef enum {
QEMU_MIGRATION_CAP_COMPRESS,
QEMU_MIGRATION_CAP_PAUSE_BEFORE_SWITCHOVER,
QEMU_MIGRATION_CAP_LATE_BLOCK_ACTIVATE,
+ QEMU_MIGRATION_CAP_MULTIFD,
QEMU_MIGRATION_CAP_LAST
} qemuMigrationCapability;
@@ -56,6 +57,7 @@ typedef enum {
QEMU_MIGRATION_PARAM_BLOCK_INCREMENTAL,
QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE,
QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH,
+ QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS,
QEMU_MIGRATION_PARAM_LAST
} qemuMigrationParam;
--
2.20.1