The API is renamed as qemuMigrationParamsGetULL and it can be used with
any migration parameter stored as unsigned long long.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 9 ++++++++-
src/qemu/qemu_migration_params.c | 15 ++++++++++-----
src/qemu/qemu_migration_params.h | 5 +++--
3 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0cf08759c6..8917beae35 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13557,6 +13557,7 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom,
virDomainObjPtr vm;
qemuMigrationParamsPtr migParams = NULL;
int ret = -1;
+ int rc;
virCheckFlags(0, -1);
@@ -13579,7 +13580,13 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom,
&migParams) < 0)
goto endjob;
- if (qemuMigrationParamsGetDowntimeLimit(migParams, downtime) == 1) {
+ if ((rc = qemuMigrationParamsGetULL(migParams,
+ QEMU_MIGRATION_PARAM_DOWNTIME_LIMIT,
+ downtime)) < 0) {
+ goto endjob;
+ }
+
+ if (rc == 1) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("Querying migration downtime is not supported by "
"QEMU binary"));
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 979610c3a8..3e131207a8 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -950,17 +950,22 @@ qemuMigrationParamsSetString(qemuMigrationParamsPtr migParams,
/**
- * Returns 0 on success,
+ * Returns -1 on error,
+ * 0 on success,
* 1 if the parameter is not supported by QEMU.
*/
int
-qemuMigrationParamsGetDowntimeLimit(qemuMigrationParamsPtr migParams,
- unsigned long long *value)
+qemuMigrationParamsGetULL(qemuMigrationParamsPtr migParams,
+ qemuMigrationParam param,
+ unsigned long long *value)
{
- if (!migParams->params[QEMU_MIGRATION_PARAM_DOWNTIME_LIMIT].set)
+ if (qemuMigrationParamsCheckType(param, QEMU_MIGRATION_PARAM_TYPE_ULL) < 0)
+ return -1;
+
+ if (!migParams->params[param].set)
return 1;
- *value = migParams->params[QEMU_MIGRATION_PARAM_DOWNTIME_LIMIT].value.ull;
+ *value = migParams->params[param].value.ull;
return 0;
}
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index eb4016806d..6950eca8ef 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -116,8 +116,9 @@ qemuMigrationParamsSetString(qemuMigrationParamsPtr migParams,
const char *value);
int
-qemuMigrationParamsGetDowntimeLimit(qemuMigrationParamsPtr migParams,
- unsigned long long *value);
+qemuMigrationParamsGetULL(qemuMigrationParamsPtr migParams,
+ qemuMigrationParam param,
+ unsigned long long *value);
int
qemuMigrationParamsCheck(virQEMUDriverPtr driver,
--
2.17.0