]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: hotplug: don't overwrite error message in qemuDomainAttachNetDevice
authorKaterina Koukiou <kkoukiou@redhat.com>
Fri, 13 Jul 2018 15:01:44 +0000 (17:01 +0200)
committerKaterina Koukiou <kkoukiou@redhat.com>
Mon, 16 Jul 2018 08:41:44 +0000 (10:41 +0200)
Since commit f14c37, virDomainConfVMNWFilterTeardown is reporting errors
thus any previously reported error gets overwritten.
We need to save the errors in qemuDomainAttachNetDevice before calling
this function when we are in cleanup code.

https://bugzilla.redhat.com/show_bug.cgi?id=1598311

Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_hotplug.c

index 3dfa51b0a0fee36176b4c4a64fe78ced23b7f06a..2e13cab23336b8eab5eb9cec7b79bfddfc5edace 100644 (file)
@@ -793,6 +793,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
     bool charDevPlugged = false;
     bool netdevPlugged = false;
     char *netdev_name;
+    virErrorPtr save_error = NULL;
 
     /* preallocate new slot for device */
     if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets + 1) < 0)
@@ -1074,7 +1075,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
             qemuDomainReleaseDeviceAddress(vm, &net->info, NULL);
 
         if (iface_connected) {
+            virErrorPreserveLast(&save_error);
             virDomainConfNWFilterTeardown(net);
+            virErrorRestore(&save_error);
 
             if (virDomainNetGetActualType(net) == VIR_DOMAIN_NET_TYPE_DIRECT) {
                 ignore_value(virNetDevMacVLanDeleteWithVPortProfile(