[libvirt] [PATCH] qemu: hotplug: don't overwrite error message in qemuDomainAttachNetDevice

Katerina Koukiou posted 1 patch 5 years, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180713153148.9541-1-kkoukiou@redhat.com
Test syntax-check passed
src/qemu/qemu_hotplug.c | 3 +++
1 file changed, 3 insertions(+)
[libvirt] [PATCH] qemu: hotplug: don't overwrite error message in qemuDomainAttachNetDevice
Posted by Katerina Koukiou 5 years, 9 months ago
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>
---
 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 3dfa51b0a0..2e13cab233 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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(
-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: hotplug: don't overwrite error message in qemuDomainAttachNetDevice
Posted by Michal Prívozník 5 years, 9 months ago
On 07/13/2018 05:31 PM, Katerina Koukiou wrote:
> 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>
> ---
>  src/qemu/qemu_hotplug.c | 3 +++
>  1 file changed, 3 insertions(+)

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] qemu: hotplug: don't overwrite error message in qemuDomainAttachNetDevice
Posted by Ján Tomko 5 years, 9 months ago
On Fri, Jul 13, 2018 at 05:31:48PM +0200, Katerina Koukiou wrote:
>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>
>---
> 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 3dfa51b0a0..2e13cab233 100644
>--- a/src/qemu/qemu_hotplug.c
>+++ b/src/qemu/qemu_hotplug.c
>@@ -793,6 +793,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
>     bool charDevPlugged = false;
>     bool netdevPlugged = false;
>     char *netdev_name;
>+    virErrorPtr save_error = NULL;

You can reuse the originalError variable that is used in the try_remove
section.

Jano

>
>     /* 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(
>-- 
>2.15.0
>
>--
>libvir-list mailing list
>libvir-list@redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list