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

Michal Privoznik mprivozn at redhat.com
Mon Feb 17 16:31:01 UTC 2020


On 2/14/20 5:26 PM, Pavel Mores wrote:
> 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;
> 

This should be merged with 4/6 and per Jano's suggestion turned into 
regular function.

Michal




More information about the libvir-list mailing list