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:
parent
4cd13478ac
commit
229a0358f0
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user