mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
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 658c932ab4
)
This commit is contained in:
parent
67a2f4c6d8
commit
b3e3bd304d
@ -4807,6 +4807,11 @@ networkUnplugBandwidth(virNetworkObjPtr net,
|
|||||||
|
|
||||||
if (iface->data.network.actual &&
|
if (iface->data.network.actual &&
|
||||||
iface->data.network.actual->class_id) {
|
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 */
|
/* we must remove class from bridge */
|
||||||
new_rate = net->def->bandwidth->in->average;
|
new_rate = net->def->bandwidth->in->average;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user