[libvirt PATCH v2 2/6] qemu: add function to test if network supports setting 'floor'

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


This function will be useful in upcoming commits when code to check whether
a network can support 'floor' in the first place is introduced.

Signed-off-by: Pavel Mores <pmores at redhat.com>
---
 src/conf/netdev_bandwidth_conf.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h
index 5b5ed52566..0596d555e5 100644
--- a/src/conf/netdev_bandwidth_conf.h
+++ b/src/conf/netdev_bandwidth_conf.h
@@ -60,6 +60,26 @@ static inline bool virNetDevSupportBandwidth(virDomainNetType type)
 }
 
 
+static inline bool virNetDevSupportBandwidthFloor(virNetworkForwardType type)
+{
+    switch (type) {
+    case VIR_NETWORK_FORWARD_NONE:
+    case VIR_NETWORK_FORWARD_NAT:
+    case VIR_NETWORK_FORWARD_ROUTE:
+    case VIR_NETWORK_FORWARD_OPEN:
+        return true;
+    case VIR_NETWORK_FORWARD_BRIDGE:
+    case VIR_NETWORK_FORWARD_PRIVATE:
+    case VIR_NETWORK_FORWARD_VEPA:
+    case VIR_NETWORK_FORWARD_PASSTHROUGH:
+    case VIR_NETWORK_FORWARD_HOSTDEV:
+    case VIR_NETWORK_FORWARD_LAST:
+        break;
+    }
+    return false;
+}
+
+
 static inline bool virNetDevBandwidthHasFloor(const virNetDevBandwidth *b)
 {
     return b && b->in && b->in->floor != 0;
-- 
2.24.1




More information about the libvir-list mailing list