[PVE-User] tc rate limit issue

lyt_yudi lyt_yudi at icloud.com
Tue Mar 24 04:21:08 CET 2015


> 在 2015年3月23日,下午3:18,Dietmar Maurer <dietmar at proxmox.com> 写道:
> 
> We do not use TC to rate limit qemu network devices (we use qemu internal rate
> limit features).

hi,
	i see those code, use tc for rate limit also?
———
QemuServer.pm
———
……
Ignore content
……
           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});
            }
……
Ignore content
……
———


———
Network.pm
———
sub setup_tc_rate_limit {
    my ($iface, $rate, $burst, $debug) = @_;

    system("/sbin/tc class del dev $iface parent 1: classid 1:1 >/dev/null 2>&1");
    system("/sbin/tc filter del dev $iface parent ffff: protocol ip prio 50 estimator 1sec 8sec >/dev/null 2>&1”);
……
Ignore content
……
        system("/sbin/tc class ls dev $iface");
        system("/sbin/tc filter ls dev $iface parent ffff:");
    }
}

sub tap_rate_limit {
    my ($iface, $rate) = @_;

    my $debug = 0;
    $rate = int($rate*1024*1024);
    my $burst = 1024*1024;

    setup_tc_rate_limit($iface, $rate, $burst, $debug);
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.proxmox.com/pipermail/pve-user/attachments/20150324/ee6b4634/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2345 bytes
Desc: not available
URL: <http://lists.proxmox.com/pipermail/pve-user/attachments/20150324/ee6b4634/attachment.bin>


More information about the pve-user mailing list