[libvirt] [PATCH v3 2/2] network: Add code for setting network bandwidth for ethernet interfaces
Eric Blake
eblake at redhat.com
Wed Oct 8 21:39:14 UTC 2014
On 10/08/2014 01:59 PM, Anirban Chakraborty wrote:
>
> Signed-off-by: Anirban Chakraborty <abchak at juniper.net>
> ---
> src/conf/domain_conf.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index f03599e..91da1ec 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -2852,7 +2852,8 @@ static inline bool virNetDevSupportBandwidth(int type)
> {
> return ((type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
> type == VIR_DOMAIN_NET_TYPE_NETWORK ||
> - type == VIR_DOMAIN_NET_TYPE_DIRECT) ? true : false);
> + type == VIR_DOMAIN_NET_TYPE_DIRECT ||
> + type == VIR_DOMAIN_NET_TYPE_ETHERNET) ? true : false);
Needs rework after my comments on 1/2. I also wonder if this should
just be folded in to that patch, and/or made into a switch statement
where the compiler forces us to think about any future
VIR_DOMAIN_NET_TYPE_* additions on whether they should return true or false.
As in:
bool virNetDevSupportBandwidth(virDomainNetType type)
{
switch (type) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
case VIR_DOMAIN_NET_TYPE_NETWORK:
case VIR_DOMAIN_NET_TYPE_DIRECT:
case VIR_DOMAIN_NET_TYPE_ETHERNET:
return true;
case VIR_DOMAIN_NET_TYPE_USER:
case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
case VIR_DOMAIN_NET_TYPE_SERVER:
case VIR_DOMAIN_NET_TYPE_CLIENT:
case VIR_DOMAIN_NET_TYPE_MCAST:
case VIR_DOMAIN_NET_TYPE_INTERNAL:
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
case VIR_DOMAIN_NET_TYPE_LAST:
/* cover all enums to appease the compiler */ ;
}
return false;
}
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141008/73b0f68e/attachment-0001.sig>
More information about the libvir-list
mailing list