[PATCH 1/2] qemuDomainSetInterfaceParameters: Explicitly reject unsupported net types

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

 



For instance, NET_TYPE_MCAST doesn't support setting QoS. Instead
of claiming success and doing nothing, we should be explicit
about that and report an error.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/qemu/qemu_driver.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 32a416f9e..54a93711a 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -108,6 +108,7 @@
 #include "virnuma.h"
 #include "dirname.h"
 #include "network/bridge_driver.h"
+#include "netdev_bandwidth_conf.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
@@ -11106,6 +11107,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
     virNetDevBandwidthPtr bandwidth = NULL, newBandwidth = NULL;
     virQEMUDriverConfigPtr cfg = NULL;
     bool inboundSpecified = false, outboundSpecified = false;
+    int actualType;
+    bool qosSupported = true;
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -11149,6 +11152,24 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
         !(persistentNet = virDomainNetFind(persistentDef, device)))
         goto endjob;
 
+    if (net) {
+        actualType = virDomainNetGetActualType(net);
+        qosSupported = virNetDevSupportBandwidth(actualType);
+    }
+
+    if (qosSupported && persistentNet) {
+        actualType = virDomainNetGetActualType(persistentNet);
+        qosSupported = virNetDevSupportBandwidth(actualType);
+    }
+
+    if (!qosSupported) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("setting bandwidth on interfaces of "
+                         "type '%s' is not implemented yet"),
+                       virDomainNetTypeToString(actualType));
+        goto endjob;
+    }
+
     if ((VIR_ALLOC(bandwidth) < 0) ||
         (VIR_ALLOC(bandwidth->in) < 0) ||
         (VIR_ALLOC(bandwidth->out) < 0))
-- 
2.13.6

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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