Add the migration capability flag and the propagation of the
corresponding mapping configuration. The mapping will be produced from
the bitmaps on disk depending on both sides of the migration and the
necessity to perform merges.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_migration_params.c | 24 ++++++++++++++++++++++++
src/qemu/qemu_migration_params.h | 5 +++++
2 files changed, 29 insertions(+)
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 510dad783a..8f491e0ed2 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -63,6 +63,7 @@ struct _qemuMigrationParams {
unsigned long long compMethods; /* bit-wise OR of qemuMigrationCompressMethod */
virBitmapPtr caps;
qemuMigrationParamValue params[QEMU_MIGRATION_PARAM_LAST];
+ virJSONValuePtr blockDirtyBitmapMapping;
};
typedef enum {
@@ -89,6 +90,7 @@ VIR_ENUM_IMPL(qemuMigrationCapability,
"pause-before-switchover",
"late-block-activate",
"multifd",
+ "dirty-bitmaps",
);
@@ -265,6 +267,7 @@ qemuMigrationParamsFree(qemuMigrationParamsPtr migParams)
}
virBitmapFree(migParams->caps);
+ virJSONValueFree(migParams->blockDirtyBitmapMapping);
g_free(migParams);
}
@@ -524,6 +527,20 @@ qemuMigrationParamsSetCompression(virTypedParameterPtr params,
}
+void
+qemuMigrationParamsSetBlockDirtyBitmapMapping(qemuMigrationParamsPtr migParams,
+ virJSONValuePtr *params)
+{
+ virJSONValueFree(migParams->blockDirtyBitmapMapping);
+ migParams->blockDirtyBitmapMapping = g_steal_pointer(params);
+
+ if (migParams->blockDirtyBitmapMapping)
+ ignore_value(virBitmapSetBit(migParams->caps,
QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS));
+ else
+ ignore_value(virBitmapClearBit(migParams->caps,
QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS));
+}
+
+
qemuMigrationParamsPtr
qemuMigrationParamsFromFlags(virTypedParameterPtr params,
int nparams,
@@ -747,6 +764,12 @@ qemuMigrationParamsToJSON(qemuMigrationParamsPtr migParams)
return NULL;
}
+ if (migParams->blockDirtyBitmapMapping &&
+ virJSONValueObjectAppend(params, "block-bitmap-mapping",
+ migParams->blockDirtyBitmapMapping) < 0)
+ return NULL;
+ migParams->blockDirtyBitmapMapping = NULL;
+
return g_steal_pointer(¶ms);
}
@@ -1202,6 +1225,7 @@ qemuMigrationParamsReset(virQEMUDriverPtr driver,
goto cleanup;
qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
+ /* We don't reset 'block-bitmap-mapping' as it can't be unset */
cleanup:
virErrorRestore(&err);
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index 9876101bfc..f1db42ce94 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -39,6 +39,7 @@ typedef enum {
QEMU_MIGRATION_CAP_PAUSE_BEFORE_SWITCHOVER,
QEMU_MIGRATION_CAP_LATE_BLOCK_ACTIVATE,
QEMU_MIGRATION_CAP_MULTIFD,
+ QEMU_MIGRATION_CAP_BLOCK_DIRTY_BITMAPS,
QEMU_MIGRATION_CAP_LAST
} qemuMigrationCapability;
@@ -132,6 +133,10 @@ qemuMigrationParamsGetULL(qemuMigrationParamsPtr migParams,
qemuMigrationParam param,
unsigned long long *value);
+void
+qemuMigrationParamsSetBlockDirtyBitmapMapping(qemuMigrationParamsPtr migParams,
+ virJSONValuePtr *params);
+
int
qemuMigrationParamsCheck(virQEMUDriverPtr driver,
virDomainObjPtr vm,
--
2.29.2