]> git.proxmox.com Git - pve-common.git/commitdiff
net: tap_plug() needs to apply rate limiting
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 8 Mar 2016 12:54:44 +0000 (13:54 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 8 Mar 2016 14:50:17 +0000 (15:50 +0100)
Any action we take in tap_plug() when using OVS will undo
our rate limiting, which means any hotplug change must
restore the previous rate setting.
Since this means tap_plug() would always be followed by a
tap_rate_limit() call anyway we just include the rate
parameter here and let the caller decide whether the full
tap_plug() is required or the simple tap_rate_limit()
suffices.

src/PVE/Network.pm

index 5d265299c5998683a3179c2139841e8f2d68d96e..2d6781a4eb1c4aaa0bd4c9ce9b99260b36f2a252 100644 (file)
@@ -319,7 +319,7 @@ my $cleanup_firewall_bridge = sub {
 };
 
 sub tap_plug {
 };
 
 sub tap_plug {
-    my ($iface, $bridge, $tag, $firewall, $trunks) = @_;
+    my ($iface, $bridge, $tag, $firewall, $trunks, $rate) = @_;
 
     #cleanup old port config from any openvswitch bridge
     eval {run_command("/usr/bin/ovs-vsctl del-port $iface", outfunc => sub {}, errfunc => sub {}) };
 
     #cleanup old port config from any openvswitch bridge
     eval {run_command("/usr/bin/ovs-vsctl del-port $iface", outfunc => sub {}, errfunc => sub {}) };
@@ -352,6 +352,8 @@ sub tap_plug {
            &$ovs_bridge_add_port($bridge, $iface, $tag, undef, $trunks);
        }
     }
            &$ovs_bridge_add_port($bridge, $iface, $tag, undef, $trunks);
        }
     }
+
+    tap_rate_limit($iface, $rate);
 }
 
 sub tap_unplug {
 }
 
 sub tap_unplug {