[PATCH 2/2] qemu: Restore default root qdisc when QoS is cleared out

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When an interface has some bandwidth limitation set (it's root
qdisc is htb in that case) but this gets cleared out via public
API call (virDomainSetInterfaceParameters() or
virDomainUpdateDeviceFlags()) then virNetDevBandwidthSet() clears
out whatever qdiscs were set on the interface and kernel places
the default qdisc at the root. What we need to do next is to
replace the root qdisc with the one we want.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1329644
Fixes: 0b66196d86ea375234cb0ee99289c486f9921820
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c  | 9 +++++++++
 src/qemu/qemu_hotplug.c | 9 +++++++++
 2 files changed, 18 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4fd70ed300..6eca2645de 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10358,6 +10358,15 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
             goto endjob;
         }
 
+        /* If the old bandwidth was cleared out, restore qdisc. */
+        if (virDomainNetTypeSharesHostView(net)) {
+            if (!newBandwidth->out || newBandwidth->out->average == 0)
+                qemuDomainInterfaceSetDefaultQDisc(driver, net);
+        } else {
+            if (!newBandwidth->in || newBandwidth->in->average == 0)
+                qemuDomainInterfaceSetDefaultQDisc(driver, net);
+        }
+
         virNetDevBandwidthFree(net->bandwidth);
         if (newBandwidth->in || newBandwidth->out) {
             net->bandwidth = newBandwidth;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 235e9e177a..3aa6fb8a27 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -3871,6 +3871,15 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
              */
             virNetDevBandwidthClear(newdev->ifname);
         }
+
+        /* If the old bandwidth was cleared out, restore qdisc. */
+        if (virDomainNetTypeSharesHostView(newdev)) {
+            if (!newb->out || newb->out->average == 0)
+                qemuDomainInterfaceSetDefaultQDisc(driver, newdev);
+        } else {
+            if (!newb->in || newb->in->average == 0)
+                qemuDomainInterfaceSetDefaultQDisc(driver, newdev);
+        }
         needReplaceDevDef = true;
     }
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux