[pve-devel] [PATCH 2/2] dynamic rate limit change on network update

Dietmar Maurer dietmar at proxmox.com
Mon Mar 4 16:34:16 CET 2013


> 
> @@ -750,10 +751,19 @@ my $vmconfig_update_net = sub {
>      my ($rpcenv, $authuser, $conf, $storecfg, $vmid, $opt, $value) = @_;
> 
>      if ($conf->{$opt}) {
> +	my $oldnet = PVE::QemuServer::parse_net($conf->{$opt});
> +	my $newnet = PVE::QemuServer::parse_net($value);
> +
> +	if(($newnet->{rate} && $newnet->{rate} ne $oldnet->{rate}) || ($oldnet-
> >{rate} && !$newnet->{rate})){
> +	    if($opt =~ m/net(\d+)/){
> +		my $iface = "tap".$vmid."i".$1;
> +		PVE::Network::tap_rate_limit($iface, $newnet->{rate});
> +	    }
> +	}
> +
>  	#if online update, then unplug first
>  	die "error hot-unplug $opt for update" if
> !PVE::QemuServer::vm_deviceunplug($vmid, $conf, $opt);

We unplug after setting the rate?



More information about the pve-devel mailing list