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 761f84ee7f..93dec7c2ce 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 50f69ee571..82e8aeedc6 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -856,17 +856,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 c354c35d29..1540d72acb 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -100,8 +100,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