Use this internal structure only in qemu_migration_params.c and change
other non-test users to use the high level qemuMigrationParams struct.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 26 +++++++++++---------------
src/qemu/qemu_migration_params.c | 16 ++++++++++++++++
src/qemu/qemu_migration_params.h | 4 ++++
3 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8e880280ec..761f84ee7f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13555,8 +13555,7 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom,
{
virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm;
- qemuDomainObjPrivatePtr priv;
- qemuMonitorMigrationParams migparams = { 0 };
+ qemuMigrationParamsPtr migParams = NULL;
int ret = -1;
virCheckFlags(0, -1);
@@ -13576,27 +13575,24 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom,
goto endjob;
}
- priv = vm->privateData;
- qemuDomainObjEnterMonitor(driver, vm);
+ if (qemuMigrationParamsFetch(driver, vm, QEMU_ASYNC_JOB_NONE,
+ &migParams) < 0)
+ goto endjob;
- if (qemuMonitorGetMigrationParams(priv->mon, &migparams) == 0) {
- if (migparams.downtimeLimit_set) {
- *downtime = migparams.downtimeLimit;
- ret = 0;
- } else {
- virReportError(VIR_ERR_OPERATION_INVALID, "%s",
- _("Querying migration downtime is not supported by
"
- "QEMU binary"));
- }
+ if (qemuMigrationParamsGetDowntimeLimit(migParams, downtime) == 1) {
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+ _("Querying migration downtime is not supported by "
+ "QEMU binary"));
+ goto endjob;
}
- if (qemuDomainObjExitMonitor(driver, vm) < 0)
- ret = -1;
+ ret = 0;
endjob:
qemuDomainObjEndJob(driver, vm);
cleanup:
+ qemuMigrationParamsFree(migParams);
virDomainObjEndAPI(&vm);
return ret;
}
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 642e4f314c..fd93d9cb39 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -550,6 +550,22 @@ qemuMigrationParamsFetch(virQEMUDriverPtr driver,
}
+/**
+ * Returns 0 on success,
+ * 1 if the parameter is not supported by QEMU.
+ */
+int
+qemuMigrationParamsGetDowntimeLimit(qemuMigrationParamsPtr migParams,
+ unsigned long long *value)
+{
+ if (!migParams->params.downtimeLimit_set)
+ return 1;
+
+ *value = migParams->params.downtimeLimit;
+ return 0;
+}
+
+
/**
* qemuMigrationParamsCheck:
*
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index cabf4cebe6..9fcd9825c8 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -79,6 +79,10 @@ qemuMigrationParamsFetch(virQEMUDriverPtr driver,
int asyncJob,
qemuMigrationParamsPtr *migParams);
+int
+qemuMigrationParamsGetDowntimeLimit(qemuMigrationParamsPtr migParams,
+ unsigned long long *value);
+
int
qemuMigrationParamsCheck(virQEMUDriverPtr driver,
virDomainObjPtr vm,
--
2.17.0