]> git.proxmox.com Git - qemu-server.git/commitdiff
fix #909: pass rate to tap_plug()
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 8 Mar 2016 13:15:20 +0000 (14:15 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 9 Mar 2016 12:28:43 +0000 (13:28 +0100)
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.

PVE/QemuServer.pm
pve-bridge

index d3f4da2e585a0e8698d36f0352377444ea1ad005..6279e048c753f3bc5b6968a8b12dd2af5ea0afb1 100644 (file)
@@ -3989,16 +3989,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_num_ne($oldnet->{firewall}, $newnet->{firewall})) {
                PVE::Network::tap_unplug($iface);
-               PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall});
+               PVE::Network::tap_plug($iface, $newnet->{bridge}, $newnet->{tag}, $newnet->{firewall}, $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})) {
index b4550f1cf324e3ba1448ff4764c300ea7795ed4e..b28c27b1e3bcc8a8eddc488384b8054eb47adc01 100755 (executable)
@@ -32,10 +32,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});
-
-PVE::Network::tap_rate_limit($iface, $net->{rate}) if $net->{rate};
+PVE::Network::tap_plug($iface, $net->{bridge}, $net->{tag}, $net->{firewall}, $net->{rate});
 
 exit 0;