From 60696c94a10c41997fe44478a3551dce50d29233 Mon Sep 17 00:00:00 2001
Message-Id: <60696c94a10c41997fe44478a3551dce50d29233@dist-git>
From: Katerina Koukiou <kkoukiou@redhat.com>
Date: Mon, 16 Jul 2018 11:20:56 +0200
Subject: [PATCH] qemu: hotplug: don't overwrite error message in
qemuDomainAttachNetDevice
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
(cherry picked from commit f7b55665cc6b805bc4c34e1ec5908df31084ef5c)
Signed-off-by: Katerina Koukiou <kkoukiou@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
src/qemu/qemu_hotplug.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 456bfa4493..3d0f1055d9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -790,6 +790,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)
@@ -1071,7 +1072,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(
--
2.18.0