Blame SOURCES/libvirt-qemuDomainSetInterfaceParameters-Use-new-functions-to-update-bandwidth.patch

7a3408
From 97db8e9056749a76419e87339d2d368b29a9098a Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <97db8e9056749a76419e87339d2d368b29a9098a@dist-git>
7a3408
From: Michal Privoznik <mprivozn@redhat.com>
7a3408
Date: Fri, 14 Aug 2015 16:06:33 +0200
7a3408
Subject: [PATCH] qemuDomainSetInterfaceParameters: Use new functions to update
7a3408
 bandwidth
7a3408
7a3408
https://bugzilla.redhat.com/show_bug.cgi?id=1252473
7a3408
7a3408
As sketched in previous commits, imagine the following scenario:
7a3408
7a3408
  virsh # domiftune gentoo vnet0
7a3408
  inbound.average: 100
7a3408
  inbound.peak   : 0
7a3408
  inbound.burst  : 0
7a3408
  outbound.average: 100
7a3408
  outbound.peak  : 0
7a3408
  outbound.burst : 0
7a3408
7a3408
  virsh # domiftune gentoo vnet0 --inbound 0
7a3408
7a3408
  virsh # shutdown gentoo
7a3408
  Domain gentoo is being shutdown
7a3408
7a3408
  virsh # list --all
7a3408
  error: Failed to list domains
7a3408
  error: Cannot recv data: Connection reset by peer
7a3408
7a3408
  Program received signal SIGSEGV, Segmentation fault.
7a3408
  0x00007fffe80ea221 in networkUnplugBandwidth (net=0x7fff9400c1a0, iface=0x7fff940ea3e0) at network/bridge_driver.c:4881
7a3408
  4881            net->floor_sum -= ifaceBand->in->floor;
7a3408
7a3408
This is rather unfortunate. We should not SIGSEGV here. The
7a3408
problem is, that while in the second step the inbound QoS was
7a3408
cleared out, the network part of it was not updated (moreover, we
7a3408
don't report that vnet0 had inbound.floor set). Internal
7a3408
structure therefore still had some fragments left (e.g.
7a3408
class_id). So when qemuProcessStop() started to clean up the
7a3408
environment it got to networkUnplugBandwidth(). Here, class_id is
7a3408
set therefore function assumes that there is an inbound QoS. This
7a3408
actually is a fair assumption to make, there's no need for a
7a3408
special QoS box in network's QoS when there's no QoS to set.
7a3408
Anyway, the problem is not the networkUnplugBandwidth() rather
7a3408
than qemuDomainSetInterfaceParameters() which completely forgot
7a3408
about QoS being disperse (some parts are set directly on
7a3408
interface itself, some on bridge the interface is plugged into).
7a3408
7a3408
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7a3408
(cherry picked from commit 5ee6d243fc5f2ba840ba43e4c9bd85cb5cb745a0)
7a3408
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/qemu/qemu_driver.c | 7 ++++++-
7a3408
 1 file changed, 6 insertions(+), 1 deletion(-)
7a3408
7a3408
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
7a3408
index ec61bb5..e1ceb98 100644
7a3408
--- a/src/qemu/qemu_driver.c
7a3408
+++ b/src/qemu/qemu_driver.c
7a3408
@@ -100,6 +100,7 @@
7a3408
 #include "vircgroup.h"
7a3408
 #include "virnuma.h"
7a3408
 #include "dirname.h"
7a3408
+#include "network/bridge_driver.h"
7a3408
 
7a3408
 #define VIR_FROM_THIS VIR_FROM_QEMU
7a3408
 
7a3408
@@ -11323,7 +11324,11 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
7a3408
                    sizeof(*newBandwidth->out));
7a3408
         }
7a3408
 
7a3408
-        if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0) {
7a3408
+        if (!networkBandwidthChangeAllowed(net, newBandwidth))
7a3408
+            goto endjob;
7a3408
+
7a3408
+        if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0 ||
7a3408
+            networkBandwidthUpdate(net, newBandwidth) < 0) {
7a3408
             ignore_value(virNetDevBandwidthSet(net->ifname,
7a3408
                                                net->bandwidth,
7a3408
                                                false));
7a3408
-- 
7a3408
2.5.0
7a3408