if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0)
goto cleanup;
- rc = qemuMonitorBlockdevCreate(priv->mon, job->name, props);
- props = NULL;
+ rc = qemuMonitorBlockdevCreate(priv->mon, job->name, &props);
qemuDomainObjExitMonitor(priv->driver, vm);
if (rc < 0)
* qemuMonitorBlockdevCreate:
* @mon: monitor object
* @jobname: name of the job
- * @props: JSON object describing the blockdev to add
+ * @props: JSON object describing the blockdev to add (consumed on success)
*
* Instructs qemu to create/format a new storage or format layer. Note that
* the job does not add the created/formatted image into qemu and
* qemuMonitorBlockdevAdd needs to be called separately with corresponding
* arguments. Note that the arguments for creating and adding are different.
- *
- * Note that @props is always consumed by this function and should not be
- * accessed after calling this function.
*/
int
qemuMonitorBlockdevCreate(qemuMonitor *mon,
const char *jobname,
- virJSONValue *props)
+ virJSONValue **props)
{
VIR_DEBUG("jobname=%s props=%p", jobname, props);
- QEMU_CHECK_MONITOR_GOTO(mon, error);
+ QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONBlockdevCreate(mon, jobname, props);
-
- error:
- virJSONValueFree(props);
- return -1;
}
/**
int
qemuMonitorJSONBlockdevCreate(qemuMonitor *mon,
const char *jobname,
- virJSONValue *props)
+ virJSONValue **props)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
cmd = qemuMonitorJSONMakeCommand("blockdev-create",
"s:job-id", jobname,
- "a:options", &props,
+ "a:options", props,
NULL);
- virJSONValueFree(props);
if (!cmd)
return -1;