qemuDomainObjEnterMonitor(driver, vm);
if (newhotplug) {
- rc = qemuMonitorAddDeviceArgs(qemuDomainGetMonitor(vm), vcpuprops);
- vcpuprops = NULL;
+ rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops);
} else {
rc = qemuMonitorSetCPU(qemuDomainGetMonitor(vm), vcpu, true);
}
/**
- * qemuMonitorAddDeviceArgs:
+ * qemuMonitorAddDeviceProps:
* @mon: monitor object
- * @args: arguments for device add, consumed on success or failure
+ * @props: JSON object describing the device to add, the object is consumed
+ * and cleared.
*
- * Adds a device described by @args. Requires JSON monitor.
+ * Adds a device described by @props.
* Returns 0 on success -1 on error.
*/
int
-qemuMonitorAddDeviceArgs(qemuMonitor *mon,
- virJSONValue *args)
+qemuMonitorAddDeviceProps(qemuMonitor *mon,
+ virJSONValue **props)
{
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONAddDeviceArgs(mon, args);
+ return qemuMonitorJSONAddDeviceProps(mon, props);
}
const char *bus,
virPCIDeviceAddress *guestAddr);
-int qemuMonitorAddDeviceArgs(qemuMonitor *mon,
- virJSONValue *args);
+int qemuMonitorAddDeviceProps(qemuMonitor *mon,
+ virJSONValue **props);
int qemuMonitorAddDevice(qemuMonitor *mon,
const char *devicestr);
int
-qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
- virJSONValue *args)
+qemuMonitorJSONAddDeviceProps(qemuMonitor *mon,
+ virJSONValue **props)
{
int ret = -1;
virJSONValue *cmd = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("device_add", NULL)))
goto cleanup;
- if (virJSONValueObjectAppend(cmd, "arguments", &args) < 0)
+ if (virJSONValueObjectAppend(cmd, "arguments", props) < 0)
goto cleanup;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
ret = 0;
cleanup:
- virJSONValueFree(args);
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
qemuMonitorJSONAddDevice(qemuMonitor *mon,
const char *devicestr)
{
- virJSONValue *args;
+ g_autoptr(virJSONValue) props = NULL;
- if (!(args = qemuMonitorJSONKeywordStringToJSON(devicestr, "driver")))
+ if (!(props = qemuMonitorJSONKeywordStringToJSON(devicestr, "driver")))
return -1;
- return qemuMonitorJSONAddDeviceArgs(mon, args);
+ return qemuMonitorJSONAddDeviceProps(mon, &props);
}
const char *bus,
virPCIDeviceAddress *guestAddr);
-int qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
- virJSONValue *args);
+int qemuMonitorJSONAddDeviceProps(qemuMonitor *mon,
+ virJSONValue **props);
int qemuMonitorJSONAddDevice(qemuMonitor *mon,
const char *devicestr);
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
- rc = qemuMonitorAddDeviceArgs(qemuDomainGetMonitor(vm), vcpuprops);
- vcpuprops = NULL;
+ rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;