]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: preserve error on bandwidth rollback
authorJán Tomko <jtomko@redhat.com>
Fri, 7 Feb 2020 11:40:51 +0000 (12:40 +0100)
committerJán Tomko <jtomko@redhat.com>
Mon, 10 Feb 2020 15:41:52 +0000 (16:41 +0100)
We call APIs that reset the error in the rollback code.
Preserve the error from the original call that failed.

This turns the boringly cryptic:
  error: Unable to set interface parameters
  error: An error occurred, but the cause is unknown
to the unexpectedly anarchist:
  error: internal error: Child process (/usr/sbin/tc filter add
  dev vnet1 parent ffff: protocol all u32 match u32 0 0 police
  rate 4294968kbps burst 4294968kb mtu 64kb drop flowid :1)
  unexpected exit status 1: Illegal "rate"
  Illegal "police"

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: f02e21cb3379a41cd42f2d8116f2d10dabace83b
https://bugzilla.redhat.com/show_bug.cgi?id=1800505
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
src/qemu/qemu_driver.c

index 9b244ec4f2d3549510a978d2d392be5619086af4..2813f084cd3d069453de812428d077de1949762c 100644 (file)
@@ -11678,6 +11678,9 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
 
         if (virNetDevBandwidthSet(net->ifname, newBandwidth, false,
                                   !virDomainNetTypeSharesHostView(net)) < 0) {
+            virErrorPtr orig_err;
+
+            virErrorPreserveLast(&orig_err);
             ignore_value(virNetDevBandwidthSet(net->ifname,
                                                net->bandwidth,
                                                false,
@@ -11686,6 +11689,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
                 ignore_value(virDomainNetBandwidthUpdate(net,
                                                          net->bandwidth));
             }
+            virErrorRestore(&orig_err);
             goto endjob;
         }