提交 d327ac53 编写于 作者: J Jiri Denemark

conf: Make error reporting in virDomainDefFindDevice optional

上级 09e9f281
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册