summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJán Tomko <jtomko@redhat.com>2013-06-21 19:20:31 +0200
committerJán Tomko <jtomko@redhat.com>2013-07-01 15:02:20 +0200
commitfbd23fbcbf1012a1d0636f6aa50de04bb671e6c6 (patch)
treea12a69145c1317be35ea6230238b882079ef6400
parent0f953ec3de6f343bab0ef8b6f673622a88c3c7ff (diff)
downloadlibvirt-fbd23fbcbf1012a1d0636f6aa50de04bb671e6c6.tar.gz
bridge: don't crash on bandwidth unplug with no bandwidth
If networkUnplugBandwidth is called on a network which has no bandwidth defined, print a warning instead of crashing. This can happen when destroying a domain with bandwidth if bandwidth was removed from the network after the domain was started. https://bugzilla.redhat.com/show_bug.cgi?id=975359 (cherry picked from commit 658c932ab4aec2222b0ce3840a96748e73b39b3f)
-rw-r--r--src/network/bridge_driver.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 31c8585ee1..2facabe65e 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -4680,6 +4680,11 @@ networkUnplugBandwidth(virNetworkObjPtr net,
if (iface->data.network.actual &&
iface->data.network.actual->class_id) {
+ if (!net->def->bandwidth || !net->def->bandwidth->in) {
+ VIR_WARN("Network %s has no bandwidth but unplug requested",
+ net->def->name);
+ goto cleanup;
+ }
/* we must remove class from bridge */
new_rate = net->def->bandwidth->in->average;