mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
conf: Make error reporting in virDomainDefFindDevice optional
This commit is contained in:
parent
09e9f28118
commit
d327ac5328
@ -18339,7 +18339,8 @@ virDomainDefFindDeviceCallback(virDomainDefPtr def ATTRIBUTE_UNUSED,
|
||||
int
|
||||
virDomainDefFindDevice(virDomainDefPtr def,
|
||||
const char *devAlias,
|
||||
virDomainDeviceDefPtr dev)
|
||||
virDomainDeviceDefPtr dev,
|
||||
bool reportError)
|
||||
{
|
||||
virDomainDefFindDeviceCallbackData data = { devAlias, dev };
|
||||
|
||||
@ -18348,8 +18349,12 @@ virDomainDefFindDevice(virDomainDefPtr def,
|
||||
true, &data);
|
||||
|
||||
if (dev->type == VIR_DOMAIN_DEVICE_NONE) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("no device found with alias %s"), devAlias);
|
||||
if (reportError) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("no device found with alias %s"), devAlias);
|
||||
} else {
|
||||
VIR_DEBUG("no device found with alias %s", devAlias);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2690,6 +2690,7 @@ char *virDomainDefGetDefaultEmulator(virDomainDefPtr def, virCapsPtr caps);
|
||||
|
||||
int virDomainDefFindDevice(virDomainDefPtr def,
|
||||
const char *devAlias,
|
||||
virDomainDeviceDefPtr dev);
|
||||
virDomainDeviceDefPtr dev,
|
||||
bool reportError);
|
||||
|
||||
#endif /* __DOMAIN_CONF_H */
|
||||
|
@ -1329,7 +1329,7 @@ qemuProcessHandleDeviceDeleted(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
|
||||
qemuDomainSignalDeviceRemoval(vm, devAlias);
|
||||
|
||||
if (virDomainDefFindDevice(vm->def, devAlias, &dev) < 0)
|
||||
if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0)
|
||||
goto cleanup;
|
||||
|
||||
qemuDomainRemoveDevice(driver, vm, &dev);
|
||||
|
Loading…
Reference in New Issue
Block a user