fbe740
From f4c935bfa5bd3e4f4856dfdf660be0fa50d42798 Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <f4c935bfa5bd3e4f4856dfdf660be0fa50d42798@dist-git>
fbe740
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
fbe740
Date: Mon, 10 Feb 2020 17:05:54 +0100
fbe740
Subject: [PATCH] qemu: preserve error on bandwidth rollback
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
We call APIs that reset the error in the rollback code.
fbe740
Preserve the error from the original call that failed.
fbe740
fbe740
This turns the boringly cryptic:
fbe740
  error: Unable to set interface parameters
fbe740
  error: An error occurred, but the cause is unknown
fbe740
to the unexpectedly anarchist:
fbe740
  error: internal error: Child process (/usr/sbin/tc filter add
fbe740
  dev vnet1 parent ffff: protocol all u32 match u32 0 0 police
fbe740
  rate 4294968kbps burst 4294968kb mtu 64kb drop flowid :1)
fbe740
  unexpected exit status 1: Illegal "rate"
fbe740
  Illegal "police"
fbe740
fbe740
Signed-off-by: Ján Tomko <jtomko@redhat.com>
fbe740
Fixes: f02e21cb3379a41cd42f2d8116f2d10dabace83b
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1800505
fbe740
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
fbe740
(cherry picked from commit 457b0e74888f61b759e334d91479c258663835d5)
fbe740
Signed-off-by: Ján Tomko <jtomko@redhat.com>
fbe740
Message-Id: <a49ef696966d8b8ca28d298ffab16c3a77b1102a.1581350626.git.jtomko@redhat.com>
fbe740
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
fbe740
---
fbe740
 src/qemu/qemu_driver.c | 4 ++++
fbe740
 1 file changed, 4 insertions(+)
fbe740
fbe740
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
fbe740
index 08f492fa24..af81c4a6e4 100644
fbe740
--- a/src/qemu/qemu_driver.c
fbe740
+++ b/src/qemu/qemu_driver.c
fbe740
@@ -11642,6 +11642,9 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
fbe740
 
fbe740
         if (virNetDevBandwidthSet(net->ifname, newBandwidth, false,
fbe740
                                   !virDomainNetTypeSharesHostView(net)) < 0) {
fbe740
+            virErrorPtr orig_err;
fbe740
+
fbe740
+            virErrorPreserveLast(&orig_err);
fbe740
             ignore_value(virNetDevBandwidthSet(net->ifname,
fbe740
                                                net->bandwidth,
fbe740
                                                false,
fbe740
@@ -11650,6 +11653,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
fbe740
                 ignore_value(virDomainNetBandwidthUpdate(net,
fbe740
                                                          net->bandwidth));
fbe740
             }
fbe740
+            virErrorRestore(&orig_err);
fbe740
             goto endjob;
fbe740
         }
fbe740
 
fbe740
-- 
fbe740
2.25.0
fbe740