5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-06-03 17:05:40 +03:00

fix #909: pass rate to tap_plug()

When using OVS tap_plug() resets rate limiting so we need
to pass it along to reapply it.

The rate on its own can still be hot-plugged with the
regular tap_rate_limit() call.
This commit is contained in:
Wolfgang Bumiller 2016-03-08 13:55:13 +01:00 committed by Dietmar Maurer
parent a9920f48f8
commit 4f4fbeb048
2 changed files with 6 additions and 10 deletions

View File

@ -4275,16 +4275,16 @@ sub vmconfig_update_net {
die "internal error" if $opt !~ m/net(\d+)/;
my $iface = "tap${vmid}i$1";
if (&$safe_num_ne($oldnet->{rate}, $newnet->{rate})) {
PVE::Network::tap_rate_limit($iface, $newnet->{rate});
}
if (&$safe_string_ne($oldnet->{bridge}, $newnet->{bridge}) ||
&$safe_num_ne($oldnet->{tag}, $newnet->{tag}) ||
&$safe_string_ne($oldnet->{trunks}, $newnet->{trunks}) ||
&$safe_num_ne($oldnet->{firewall}, $newnet->{firewall})) {
PVE::Network::tap_unplug($iface);
PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $newnet->{trunks});
PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $newnet->{trunks}, $newnet->{rate});
} elsif (&$safe_num_ne($oldnet->{rate}, $newnet->{rate})) {
# Rate can be applied on its own but any change above needs to
# include the rate in tap_plug since OVS resets everything.
PVE::Network::tap_rate_limit($iface, $newnet->{rate});
}
if (&$safe_string_ne($oldnet->{link_down}, $newnet->{link_down})) {

View File

@ -38,10 +38,6 @@ die "unable to parse network config '$netid'\n" if !$net;
PVE::Network::tap_create($iface, $net->{bridge});
# if ovs is under this bridge all traffic control settings will be flushed.
# so we need to call tap_rate_limit after tap_plug
PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks});
PVE::Network::tap_rate_limit($iface, $net->{rate}) if $net->{rate};
PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{trunks}, $net->{rate});
exit 0;