mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: virDomainControllerFind may return 0 if controller found
The return value of virDomainControllerFind >=0 means that the specific controller was found. But some functions invoke it and treat 0 as not found. This patch fix these incorrect invocation. Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
This commit is contained in:
parent
40942b788e
commit
21813c9fb5
@ -6626,7 +6626,7 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
|
||||
case VIR_DOMAIN_DEVICE_CONTROLLER:
|
||||
controller = dev->data.controller;
|
||||
if (virDomainControllerFind(vmdef, controller->type,
|
||||
controller->idx) > 0) {
|
||||
controller->idx) >= 0) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("Target already exists"));
|
||||
return -1;
|
||||
|
@ -358,7 +358,7 @@ int qemuDomainAttachPciControllerDevice(virQEMUDriverPtr driver,
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
bool releaseaddr = false;
|
||||
|
||||
if (virDomainControllerFind(vm->def, controller->type, controller->idx) > 0) {
|
||||
if (virDomainControllerFind(vm->def, controller->type, controller->idx) >= 0) {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("target %s:%d already exists"),
|
||||
type, controller->idx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user