]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commit
network: only clear bandwidth if it has been set
authorLaine Stump <laine@laine.org>
Tue, 24 Feb 2015 17:12:56 +0000 (12:12 -0500)
committerLaine Stump <laine@laine.org>
Wed, 25 Feb 2015 18:09:34 +0000 (13:09 -0500)
commit118b240808d845323be8148bbd12efe9b965e527
tree2a28eabb36e8e742958900fca7eea93d54c470e1
parent18f9f69bb5307bf5edfb511d6a9dbcc9ce9aca46
network: only clear bandwidth if it has been set

libvirt was unconditionally calling virNetDevBandwidthClear() for
every interface (and network bridge) of a type that supported
bandwidth, whether it actually had anything set or not. This doesn't
hurt anything (unless ifname == NULL!), but is wasteful.

This patch makes sure that all calls to virNetDevBandwidthClear() are
qualified by checking that the interface really had some bandwidth
setup done, and checks for a null ifname inside
virNetDevBandwidthClear(), silently returning success if it is null
(as well as removing the ATTRIBUTE_NONNULL from that function's
prototype, since we can't guarantee that it is never null,
e.g. sometimes a type='ethernet' interface has no ifname as it is
provided on the fly by qemu).
src/conf/netdev_bandwidth_conf.c
src/lxc/lxc_driver.c
src/network/bridge_driver.c
src/qemu/qemu_hotplug.c
src/util/virnetdevbandwidth.c
src/util/virnetdevbandwidth.h