mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +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
|
int
|
||||||
virDomainDefFindDevice(virDomainDefPtr def,
|
virDomainDefFindDevice(virDomainDefPtr def,
|
||||||
const char *devAlias,
|
const char *devAlias,
|
||||||
virDomainDeviceDefPtr dev)
|
virDomainDeviceDefPtr dev,
|
||||||
|
bool reportError)
|
||||||
{
|
{
|
||||||
virDomainDefFindDeviceCallbackData data = { devAlias, dev };
|
virDomainDefFindDeviceCallbackData data = { devAlias, dev };
|
||||||
|
|
||||||
@ -18348,8 +18349,12 @@ virDomainDefFindDevice(virDomainDefPtr def,
|
|||||||
true, &data);
|
true, &data);
|
||||||
|
|
||||||
if (dev->type == VIR_DOMAIN_DEVICE_NONE) {
|
if (dev->type == VIR_DOMAIN_DEVICE_NONE) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
if (reportError) {
|
||||||
_("no device found with alias %s"), devAlias);
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("no device found with alias %s"), devAlias);
|
||||||
|
} else {
|
||||||
|
VIR_DEBUG("no device found with alias %s", devAlias);
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2690,6 +2690,7 @@ char *virDomainDefGetDefaultEmulator(virDomainDefPtr def, virCapsPtr caps);
|
|||||||
|
|
||||||
int virDomainDefFindDevice(virDomainDefPtr def,
|
int virDomainDefFindDevice(virDomainDefPtr def,
|
||||||
const char *devAlias,
|
const char *devAlias,
|
||||||
virDomainDeviceDefPtr dev);
|
virDomainDeviceDefPtr dev,
|
||||||
|
bool reportError);
|
||||||
|
|
||||||
#endif /* __DOMAIN_CONF_H */
|
#endif /* __DOMAIN_CONF_H */
|
||||||
|
@ -1329,7 +1329,7 @@ qemuProcessHandleDeviceDeleted(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
|||||||
|
|
||||||
qemuDomainSignalDeviceRemoval(vm, devAlias);
|
qemuDomainSignalDeviceRemoval(vm, devAlias);
|
||||||
|
|
||||||
if (virDomainDefFindDevice(vm->def, devAlias, &dev) < 0)
|
if (virDomainDefFindDevice(vm->def, devAlias, &dev, true) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
qemuDomainRemoveDevice(driver, vm, &dev);
|
qemuDomainRemoveDevice(driver, vm, &dev);
|
||||||
|
Loading…
Reference in New Issue
Block a user