On Mon, Jan 08, 2024 at 18:06:40 +0100, Jiri Denemark wrote:
We enable various migration capabilities according to the flags
passed
to a migration API. Missing support for such capabilities results in an
error because they are required by the corresponding flag. This patch
adds support for additional optional capability we may want to enable
for a given API flag in case it is supported. This is useful for
capabilities which are not critical for the flags to be supported, but
they can make things work better in some way.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 8 ++---
src/qemu/qemu_migration_params.c | 57 +++++++++++++++++++++++++++++---
src/qemu/qemu_migration_params.h | 1 +
3 files changed, 57 insertions(+), 9 deletions(-)
[...]
@@ -1303,16 +1324,42 @@ qemuMigrationParamsCheck(virDomainObj *vm,
party = QEMU_MIGRATION_DESTINATION;
for (cap = 0; cap < QEMU_MIGRATION_CAP_LAST; cap++) {
- bool state = false;
-
- ignore_value(virBitmapGetBit(migParams->caps, cap, &state));
-
- if (state && !qemuMigrationCapsGet(vm, cap)) {
+ bool enable = false;
+ bool optional = false;
+ bool remoteOpt = false;
+ bool remote = false;
+ bool qemu = qemuMigrationCapsGet(vm, cap);
+
+ ignore_value(virBitmapGetBit(migParams->caps, cap, &enable));
+ ignore_value(virBitmapGetBit(migParams->optional, cap, &optional));
+ ignore_value(virBitmapGetBit(migParams->remoteOptional, cap,
&remoteOpt));
+ ignore_value(virBitmapGetBit(remoteSupported, cap, &remote));
+
+ if (enable && !qemu) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
_("Migration option '%1$s' is not supported by
QEMU binary"),
qemuMigrationCapabilityTypeToString(cap));
return -1;
}
+
+ if (optional) {
+ if (!qemu) {
+ VIR_DEBUG("Optional migration capability '%s' not supported
by QEMU",
+ qemuMigrationCapabilityTypeToString(cap));
+ optional = false;
+ } else if (remoteOpt && ! remote) {
s/! r/!r/
+ VIR_DEBUG("Optional migration capability
'%s' not supported "
+ "by the other side of migration",
+ qemuMigrationCapabilityTypeToString(cap));
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>