[PATCH 2/4] conf: Make error reporting in virDomainDefFindDevice optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/conf/domain_conf.c  | 11 ++++++++---
 src/conf/domain_conf.h  |  3 ++-
 src/qemu/qemu_process.c |  2 +-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 57cd9b1..308a96b 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -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;
     }
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 25dad16..00d3c3a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -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 */
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index ef81536..33839d1 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -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);
-- 
1.8.3.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]