mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-08 16:54:49 +00:00
qemu: Generalize qemuMigrationParamsGetDowntimeLimit
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
9d7321bde9
commit
3ba68865f3
@ -13535,6 +13535,7 @@ qemuDomainMigrateGetMaxDowntime(virDomainPtr dom,
|
||||
virDomainObjPtr vm;
|
||||
qemuMigrationParamsPtr migParams = NULL;
|
||||
int ret = -1;
|
||||
int rc;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
|
||||
@ -13557,7 +13558,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"));
|
||||
|
@ -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,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,8 @@ qemuMigrationParamsSetString(qemuMigrationParamsPtr migParams,
|
||||
const char *value);
|
||||
|
||||
int
|
||||
qemuMigrationParamsGetDowntimeLimit(qemuMigrationParamsPtr migParams,
|
||||
qemuMigrationParamsGetULL(qemuMigrationParamsPtr migParams,
|
||||
qemuMigrationParam param,
|
||||
unsigned long long *value);
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user