qemu: Rename 'qemuMonitorAddDeviceArgs' to 'qemuMonitorAddDeviceProps'
We commonly use 'props' for the JSON object describing something. Rename the monitor device addition code. Additionally the common approach is to clear the pointer if it was consumed so the arguments are adjusted to do so. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
daaa28d774
commit
2154718c29
@ -6301,8 +6301,7 @@ qemuDomainHotplugAddVcpu(virQEMUDriver *driver,
|
|||||||
qemuDomainObjEnterMonitor(driver, vm);
|
qemuDomainObjEnterMonitor(driver, vm);
|
||||||
|
|
||||||
if (newhotplug) {
|
if (newhotplug) {
|
||||||
rc = qemuMonitorAddDeviceArgs(qemuDomainGetMonitor(vm), vcpuprops);
|
rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops);
|
||||||
vcpuprops = NULL;
|
|
||||||
} else {
|
} else {
|
||||||
rc = qemuMonitorSetCPU(qemuDomainGetMonitor(vm), vcpu, true);
|
rc = qemuMonitorSetCPU(qemuDomainGetMonitor(vm), vcpu, true);
|
||||||
}
|
}
|
||||||
|
@ -2893,20 +2893,21 @@ qemuMonitorAddDevice(qemuMonitor *mon,
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qemuMonitorAddDeviceArgs:
|
* qemuMonitorAddDeviceProps:
|
||||||
* @mon: monitor object
|
* @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.
|
* Returns 0 on success -1 on error.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
qemuMonitorAddDeviceArgs(qemuMonitor *mon,
|
qemuMonitorAddDeviceProps(qemuMonitor *mon,
|
||||||
virJSONValue *args)
|
virJSONValue **props)
|
||||||
{
|
{
|
||||||
QEMU_CHECK_MONITOR(mon);
|
QEMU_CHECK_MONITOR(mon);
|
||||||
|
|
||||||
return qemuMonitorJSONAddDeviceArgs(mon, args);
|
return qemuMonitorJSONAddDeviceProps(mon, props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1028,8 +1028,8 @@ int qemuMonitorAttachPCIDiskController(qemuMonitor *mon,
|
|||||||
const char *bus,
|
const char *bus,
|
||||||
virPCIDeviceAddress *guestAddr);
|
virPCIDeviceAddress *guestAddr);
|
||||||
|
|
||||||
int qemuMonitorAddDeviceArgs(qemuMonitor *mon,
|
int qemuMonitorAddDeviceProps(qemuMonitor *mon,
|
||||||
virJSONValue *args);
|
virJSONValue **props);
|
||||||
int qemuMonitorAddDevice(qemuMonitor *mon,
|
int qemuMonitorAddDevice(qemuMonitor *mon,
|
||||||
const char *devicestr);
|
const char *devicestr);
|
||||||
|
|
||||||
|
@ -4554,8 +4554,8 @@ int qemuMonitorJSONDelDevice(qemuMonitor *mon,
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
|
qemuMonitorJSONAddDeviceProps(qemuMonitor *mon,
|
||||||
virJSONValue *args)
|
virJSONValue **props)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
virJSONValue *cmd = NULL;
|
virJSONValue *cmd = NULL;
|
||||||
@ -4564,7 +4564,7 @@ qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
|
|||||||
if (!(cmd = qemuMonitorJSONMakeCommand("device_add", NULL)))
|
if (!(cmd = qemuMonitorJSONMakeCommand("device_add", NULL)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virJSONValueObjectAppend(cmd, "arguments", &args) < 0)
|
if (virJSONValueObjectAppend(cmd, "arguments", props) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||||
@ -4575,7 +4575,6 @@ qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
|
|||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
virJSONValueFree(args);
|
|
||||||
virJSONValueFree(cmd);
|
virJSONValueFree(cmd);
|
||||||
virJSONValueFree(reply);
|
virJSONValueFree(reply);
|
||||||
return ret;
|
return ret;
|
||||||
@ -4586,12 +4585,12 @@ int
|
|||||||
qemuMonitorJSONAddDevice(qemuMonitor *mon,
|
qemuMonitorJSONAddDevice(qemuMonitor *mon,
|
||||||
const char *devicestr)
|
const char *devicestr)
|
||||||
{
|
{
|
||||||
virJSONValue *args;
|
g_autoptr(virJSONValue) props = NULL;
|
||||||
|
|
||||||
if (!(args = qemuMonitorJSONKeywordStringToJSON(devicestr, "driver")))
|
if (!(props = qemuMonitorJSONKeywordStringToJSON(devicestr, "driver")))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return qemuMonitorJSONAddDeviceArgs(mon, args);
|
return qemuMonitorJSONAddDeviceProps(mon, &props);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -235,8 +235,8 @@ int qemuMonitorJSONAttachPCIDiskController(qemuMonitor *mon,
|
|||||||
const char *bus,
|
const char *bus,
|
||||||
virPCIDeviceAddress *guestAddr);
|
virPCIDeviceAddress *guestAddr);
|
||||||
|
|
||||||
int qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
|
int qemuMonitorJSONAddDeviceProps(qemuMonitor *mon,
|
||||||
virJSONValue *args);
|
virJSONValue **props);
|
||||||
int qemuMonitorJSONAddDevice(qemuMonitor *mon,
|
int qemuMonitorJSONAddDevice(qemuMonitor *mon,
|
||||||
const char *devicestr);
|
const char *devicestr);
|
||||||
|
|
||||||
|
@ -6085,8 +6085,7 @@ qemuProcessSetupHotpluggableVcpus(virQEMUDriver *driver,
|
|||||||
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
rc = qemuMonitorAddDeviceArgs(qemuDomainGetMonitor(vm), vcpuprops);
|
rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops);
|
||||||
vcpuprops = NULL;
|
|
||||||
|
|
||||||
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user