1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-02-03 17:47:15 +03:00

qemuMonitorJSONDelDevice: Return -2 on DeviceNotFound error

A caller might be interested in differentiating the cause for
error, especially if DeviceNotFound error occurred.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2019-03-14 08:46:37 +01:00
parent 4cd13478ac
commit 229a0358f0
2 changed files with 15 additions and 0 deletions

View File

@ -3008,6 +3008,16 @@ qemuMonitorDriveDel(qemuMonitorPtr mon,
}
/**
* @mon: monitor object
* @devalias: alias of the device to detach
*
* Sends device detach request to qemu.
*
* Returns: 0 on success,
* -2 if DeviceNotFound error encountered (error NOT reported)
* -1 otherwise (error reported)
*/
int
qemuMonitorDelDevice(qemuMonitorPtr mon,
const char *devalias)

View File

@ -4191,6 +4191,11 @@ int qemuMonitorJSONDelDevice(qemuMonitorPtr mon,
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
goto cleanup;
if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) {
ret = -2;
goto cleanup;
}
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
goto cleanup;