mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-09-21 09:44:54 +03:00
qemuMonitorSetMigrationCapabilities: Take double pointer for @caps
This allows simplification of the callers. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@@ -803,7 +803,6 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
|||||||
g_autoptr(virJSONValue) caps = NULL;
|
g_autoptr(virJSONValue) caps = NULL;
|
||||||
qemuMigrationParam xbzrle = QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE;
|
qemuMigrationParam xbzrle = QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int rc;
|
|
||||||
|
|
||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
@@ -819,12 +818,9 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
|||||||
if (!(caps = qemuMigrationCapsToJSON(priv->migrationCaps, migParams->caps)))
|
if (!(caps = qemuMigrationCapsToJSON(priv->migrationCaps, migParams->caps)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virJSONValueArraySize(caps) > 0) {
|
if (virJSONValueArraySize(caps) > 0 &&
|
||||||
rc = qemuMonitorSetMigrationCapabilities(priv->mon, caps);
|
qemuMonitorSetMigrationCapabilities(priv->mon, &caps) < 0)
|
||||||
caps = NULL;
|
goto cleanup;
|
||||||
if (rc < 0)
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If QEMU is too old to support xbzrle-cache-size migration parameter,
|
/* If QEMU is too old to support xbzrle-cache-size migration parameter,
|
||||||
@@ -1389,8 +1385,7 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver,
|
|||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
rc = qemuMonitorSetMigrationCapabilities(priv->mon, json);
|
rc = qemuMonitorSetMigrationCapabilities(priv->mon, &json);
|
||||||
json = NULL;
|
|
||||||
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
@@ -3879,22 +3879,17 @@ qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
|
|||||||
* @mon: Pointer to the monitor object.
|
* @mon: Pointer to the monitor object.
|
||||||
* @caps: Migration capabilities.
|
* @caps: Migration capabilities.
|
||||||
*
|
*
|
||||||
* The @caps object is consumed and should not be referenced by the caller
|
* The @caps object is consumed cleared on success and some errors.
|
||||||
* after this function returns.
|
|
||||||
*
|
*
|
||||||
* Returns 0 on success, -1 on error.
|
* Returns 0 on success, -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qemuMonitorSetMigrationCapabilities(qemuMonitorPtr mon,
|
qemuMonitorSetMigrationCapabilities(qemuMonitorPtr mon,
|
||||||
virJSONValuePtr caps)
|
virJSONValuePtr *caps)
|
||||||
{
|
{
|
||||||
QEMU_CHECK_MONITOR_GOTO(mon, error);
|
QEMU_CHECK_MONITOR(mon);
|
||||||
|
|
||||||
return qemuMonitorJSONSetMigrationCapabilities(mon, caps);
|
return qemuMonitorJSONSetMigrationCapabilities(mon, caps);
|
||||||
|
|
||||||
error:
|
|
||||||
virJSONValueFree(caps);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -864,7 +864,7 @@ int qemuMonitorGetMigrationStats(qemuMonitorPtr mon,
|
|||||||
int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
|
int qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
|
||||||
char ***capabilities);
|
char ***capabilities);
|
||||||
int qemuMonitorSetMigrationCapabilities(qemuMonitorPtr mon,
|
int qemuMonitorSetMigrationCapabilities(qemuMonitorPtr mon,
|
||||||
virJSONValuePtr caps);
|
virJSONValuePtr *caps);
|
||||||
|
|
||||||
int qemuMonitorGetGICCapabilities(qemuMonitorPtr mon,
|
int qemuMonitorGetGICCapabilities(qemuMonitorPtr mon,
|
||||||
virGICCapability **capabilities);
|
virGICCapability **capabilities);
|
||||||
|
@@ -6972,14 +6972,14 @@ qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon,
|
|||||||
|
|
||||||
int
|
int
|
||||||
qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon,
|
qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon,
|
||||||
virJSONValuePtr caps)
|
virJSONValuePtr *caps)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virJSONValuePtr cmd = NULL;
|
virJSONValuePtr cmd = NULL;
|
||||||
virJSONValuePtr reply = NULL;
|
virJSONValuePtr reply = NULL;
|
||||||
|
|
||||||
cmd = qemuMonitorJSONMakeCommand("migrate-set-capabilities",
|
cmd = qemuMonitorJSONMakeCommand("migrate-set-capabilities",
|
||||||
"a:capabilities", &caps,
|
"a:capabilities", caps,
|
||||||
NULL);
|
NULL);
|
||||||
if (!cmd)
|
if (!cmd)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -6992,7 +6992,6 @@ qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virJSONValueFree(caps);
|
|
||||||
virJSONValueFree(cmd);
|
virJSONValueFree(cmd);
|
||||||
virJSONValueFree(reply);
|
virJSONValueFree(reply);
|
||||||
return ret;
|
return ret;
|
||||||
|
@@ -149,7 +149,7 @@ int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon,
|
|||||||
int qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon,
|
int qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon,
|
||||||
char ***capabilities);
|
char ***capabilities);
|
||||||
int qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon,
|
int qemuMonitorJSONSetMigrationCapabilities(qemuMonitorPtr mon,
|
||||||
virJSONValuePtr caps);
|
virJSONValuePtr *caps);
|
||||||
|
|
||||||
int qemuMonitorJSONGetGICCapabilities(qemuMonitorPtr mon,
|
int qemuMonitorJSONGetGICCapabilities(qemuMonitorPtr mon,
|
||||||
virGICCapability **capabilities);
|
virGICCapability **capabilities);
|
||||||
|
@@ -2092,8 +2092,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities(const void *opaque)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = qemuMonitorJSONSetMigrationCapabilities(qemuMonitorTestGetMonitor(test),
|
ret = qemuMonitorJSONSetMigrationCapabilities(qemuMonitorTestGetMonitor(test),
|
||||||
json);
|
&json);
|
||||||
json = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virJSONValueFree(json);
|
virJSONValueFree(json);
|
||||||
|
Reference in New Issue
Block a user