if (!(params = qemuMigrationParamsToJSON(migParams)))
goto cleanup;
- if (virJSONValueObjectKeysNumber(params) > 0) {
- rc = qemuMonitorSetMigrationParams(priv->mon, params);
- params = NULL;
- if (rc < 0)
- goto cleanup;
- }
+ if (virJSONValueObjectKeysNumber(params) > 0 &&
+ qemuMonitorSetMigrationParams(priv->mon, ¶ms) < 0)
+ goto cleanup;
ret = 0;
* @mon: Pointer to the monitor object.
* @params: Migration parameters.
*
- * The @params object is consumed and should not be referenced by the caller
- * after this function returns.
+ * The @params object is consumed and cleared on success and some errors.
*
* Returns 0 on success, -1 on error.
*/
int
qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
- virJSONValuePtr params)
+ virJSONValuePtr *params)
{
- QEMU_CHECK_MONITOR_GOTO(mon, error);
+ QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONSetMigrationParams(mon, params);
-
- error:
- virJSONValueFree(params);
- return -1;
}
int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
virJSONValuePtr *params);
int qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
- virJSONValuePtr params);
+ virJSONValuePtr *params);
typedef enum {
QEMU_MONITOR_MIGRATION_STATUS_INACTIVE,
int
qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
- virJSONValuePtr params)
+ virJSONValuePtr *params)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
+ virJSONValuePtr par = g_steal_pointer(params);
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("migrate-set-parameters", params)))
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("migrate-set-parameters", par)))
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
int qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
virJSONValuePtr *params);
int qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
- virJSONValuePtr params);
+ virJSONValuePtr *params);
int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon,
qemuMonitorMigrationStatsPtr stats,