mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
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);
|
||||
|
||||
if (newhotplug) {
|
||||
rc = qemuMonitorAddDeviceArgs(qemuDomainGetMonitor(vm), vcpuprops);
|
||||
vcpuprops = NULL;
|
||||
rc = qemuMonitorAddDeviceProps(qemuDomainGetMonitor(vm), &vcpuprops);
|
||||
} else {
|
||||
rc = qemuMonitorSetCPU(qemuDomainGetMonitor(vm), vcpu, true);
|
||||
}
|
||||
|
@ -2893,20 +2893,21 @@ qemuMonitorAddDevice(qemuMonitor *mon,
|
||||
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1028,8 +1028,8 @@ int qemuMonitorAttachPCIDiskController(qemuMonitor *mon,
|
||||
const char *bus,
|
||||
virPCIDeviceAddress *guestAddr);
|
||||
|
||||
int qemuMonitorAddDeviceArgs(qemuMonitor *mon,
|
||||
virJSONValue *args);
|
||||
int qemuMonitorAddDeviceProps(qemuMonitor *mon,
|
||||
virJSONValue **props);
|
||||
int qemuMonitorAddDevice(qemuMonitor *mon,
|
||||
const char *devicestr);
|
||||
|
||||
|
@ -4554,8 +4554,8 @@ int qemuMonitorJSONDelDevice(qemuMonitor *mon,
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
|
||||
virJSONValue *args)
|
||||
qemuMonitorJSONAddDeviceProps(qemuMonitor *mon,
|
||||
virJSONValue **props)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValue *cmd = NULL;
|
||||
@ -4564,7 +4564,7 @@ qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
|
||||
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)
|
||||
@ -4575,7 +4575,6 @@ qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
virJSONValueFree(args);
|
||||
virJSONValueFree(cmd);
|
||||
virJSONValueFree(reply);
|
||||
return ret;
|
||||
@ -4586,12 +4585,12 @@ int
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -235,8 +235,8 @@ int qemuMonitorJSONAttachPCIDiskController(qemuMonitor *mon,
|
||||
const char *bus,
|
||||
virPCIDeviceAddress *guestAddr);
|
||||
|
||||
int qemuMonitorJSONAddDeviceArgs(qemuMonitor *mon,
|
||||
virJSONValue *args);
|
||||
int qemuMonitorJSONAddDeviceProps(qemuMonitor *mon,
|
||||
virJSONValue **props);
|
||||
int qemuMonitorJSONAddDevice(qemuMonitor *mon,
|
||||
const char *devicestr);
|
||||
|
||||
|
@ -6085,8 +6085,7 @@ qemuProcessSetupHotpluggableVcpus(virQEMUDriver *driver,
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user