[libvirt PATCH v2 4/6] qemu: check if 'floor' is supported for given interface and network

Pavel Mores pmores at redhat.com
Fri Feb 14 16:26:22 UTC 2020


Even if an interface of type 'network', setting 'floor' is only supported
if the network's forward type is nat, route, open or none.

Signed-off-by: Pavel Mores <pmores at redhat.com>
---
 src/network/bridge_driver.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 14976c9821..72220e1c64 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -5065,6 +5065,16 @@ networkCheckBandwidth(virNetworkObjPtr obj,
 
     virMacAddrFormat(ifaceMac, ifmac);
 
+    if (virNetDevBandwidthHasFloor(ifaceBand) &&
+        !virNetDevSupportBandwidthFloor(def->forward.type)) {
+
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+                       _("Invalid use of 'floor' on interface with MAC address %s "
+                         "- 'floor' is only supported for interface type 'network' with forward type 'nat', 'route', 'open' or none"),
+                       ifmac);
+        return -1;
+    }
+
     if (virNetDevBandwidthHasFloor(ifaceBand) && !(netBand && netBand->in)) {
         virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
                        _("Invalid use of 'floor' on interface with MAC "
-- 
2.24.1




More information about the libvir-list mailing list