提交 167028e3 编写于 作者: P Peter Krempa

qemu: monitor: Don't resist stealing 'actions' in qemuMonitorJSONTransaction

Rather than trying to prevent stealing of the 'actions' virJSONValue
into the monitor command replace the code so that it does the same
thing, since 'actions' was actually not really used after calling the
monitor.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
上级 66cb1fa2
......@@ -14811,7 +14811,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
ret = qemuMonitorTransaction(priv->mon, actions);
ret = qemuMonitorTransaction(priv->mon, &actions);
if (qemuDomainObjExitMonitor(driver, vm) < 0 || ret < 0) {
ret = -1;
......@@ -14855,7 +14855,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
}
}
if (ret == 0 || !actions) {
if (ret == 0 || !do_transaction) {
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0 ||
(persist && virDomainSaveConfig(cfg->configDir, driver->caps,
vm->newDef) < 0))
......
......@@ -3386,9 +3386,9 @@ qemuMonitorDriveMirror(qemuMonitorPtr mon,
/* Use the transaction QMP command to run atomic snapshot commands. */
int
qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
{
VIR_DEBUG("actions=%p", actions);
VIR_DEBUG("actions=%p", *actions);
QEMU_CHECK_MONITOR_JSON(mon);
......
......@@ -898,7 +898,7 @@ int qemuMonitorDiskSnapshot(qemuMonitorPtr mon,
const char *file,
const char *format,
bool reuse);
int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
int qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
ATTRIBUTE_NONNULL(2);
int qemuMonitorDriveMirror(qemuMonitorPtr mon,
const char *device,
......
......@@ -4125,18 +4125,14 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
}
int
qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
{
int ret = -1;
virJSONValuePtr cmd;
virJSONValuePtr reply = NULL;
virJSONValuePtr act = actions;
bool protect = actions->protect;
/* We do NOT want to free actions when recursively freeing cmd. */
actions->protect = true;
cmd = qemuMonitorJSONMakeCommand("transaction",
"a:actions", &act,
"a:actions", actions,
NULL);
if (!cmd)
goto cleanup;
......@@ -4151,7 +4147,6 @@ qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
cleanup:
virJSONValueFree(cmd);
virJSONValueFree(reply);
actions->protect = protect;
return ret;
}
......
......@@ -253,7 +253,7 @@ int qemuMonitorJSONDiskSnapshot(qemuMonitorPtr mon,
bool reuse)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
int qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr actions)
int qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
const char *device,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册