[PATCH 03/20] qemu: Add function to check capability in migration params

Jim Fehlig via Devel posted 20 patches 3 months, 2 weeks ago
[PATCH 03/20] qemu: Add function to check capability in migration params
Posted by Jim Fehlig via Devel 3 months, 2 weeks ago
Add new function qemuMigrationParamsCapEnabled() to check if a
capability is set in the caller-provided migration parameters.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
---
 src/qemu/qemu_migration_params.c | 16 ++++++++++++++++
 src/qemu/qemu_migration_params.h |  4 ++++
 2 files changed, 20 insertions(+)

diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 98822012cc..c3c9120c22 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -1303,6 +1303,22 @@ qemuMigrationParamsGetULL(qemuMigrationParams *migParams,
 }
 
 
+/**
+ * Returns true if @cap is enabled in @migParams, false otherwise.
+ */
+bool
+qemuMigrationParamsCapEnabled(qemuMigrationParams *migParams,
+                              qemuMigrationCapability cap)
+{
+    bool enabled = false;
+
+    if (migParams)
+        ignore_value(virBitmapGetBit(migParams->caps, cap, &enabled));
+
+    return enabled;
+}
+
+
 /**
  * qemuMigrationParamsCheck:
  *
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index df67f1fb92..020071e8ef 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -136,6 +136,10 @@ qemuMigrationParamsGetULL(qemuMigrationParams *migParams,
                           qemuMigrationParam param,
                           unsigned long long *value);
 
+bool
+qemuMigrationParamsCapEnabled(qemuMigrationParams *migParams,
+                              qemuMigrationCapability cap);
+
 void
 qemuMigrationParamsSetBlockDirtyBitmapMapping(qemuMigrationParams *migParams,
                                               virJSONValue **params);
-- 
2.35.3
Re: [PATCH 03/20] qemu: Add function to check capability in migration params
Posted by Daniel P. Berrangé 1 month, 2 weeks ago
On Thu, Aug 08, 2024 at 05:37:56PM -0600, Jim Fehlig via Devel wrote:
> Add new function qemuMigrationParamsCapEnabled() to check if a
> capability is set in the caller-provided migration parameters.
> 
> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
> ---
>  src/qemu/qemu_migration_params.c | 16 ++++++++++++++++
>  src/qemu/qemu_migration_params.h |  4 ++++
>  2 files changed, 20 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|