[pve-devel] [PATCH] increase migrate_set_downtime only if expected downtime is more than 30 iterations > 0

Stefan Priebe s.priebe at profihost.ag
Sat Dec 29 15:09:07 CET 2012


Hi,

i really like that idea instead of having a fixed downtime of 1s. What 
is about starting at 0.5s and then add 0.5s every 15 runs?

Dietmar what's your opinion?

Greets,
Stefan

Am 27.12.2012 11:14, schrieb Alexandre Derumier:
>
> Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
> ---
>   PVE/QemuMigrate.pm |   24 ++++++++++++++----------
>   1 file changed, 14 insertions(+), 10 deletions(-)
>
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index dbbeb69..aeb6deb 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -341,16 +341,6 @@ sub phase2 {
>       };
>       $self->log('info', "migrate_set_speed error: $@") if $@;
>
> -    my $migrate_downtime = $defaults->{migrate_downtime};
> -    $migrate_downtime = $conf->{migrate_downtime} if defined($conf->{migrate_downtime});
> -    if (defined($migrate_downtime)) {
> -	$self->log('info', "migrate_set_downtime: $migrate_downtime");
> -	eval {
> -	    PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate_set_downtime", value => int($migrate_downtime));
> -	};
> -	$self->log('info', "migrate_set_downtime error: $@") if $@;
> -    }
> -
>       my $capabilities = {};
>       $capabilities->{capability} =  "xbzrle";
>       $capabilities->{state} = JSON::false;
> @@ -375,6 +365,8 @@ sub phase2 {
>       my $usleep = 2000000;
>       my $i = 0;
>       my $err_count = 0;
> +    my $expecteddowntimecounter = 0;
> +
>       while (1) {
>   	$i++;
>   	my $avglstat = $lstat/$i if $lstat;
> @@ -423,6 +415,7 @@ sub phase2 {
>   		my $xbzrlecachemiss = $stat->{"xbzrle-cache"}->{"cache-miss"} || 0;
>   		my $xbzrleoverflow = $stat->{"xbzrle-cache"}->{"overflow"} || 0;
>   		my $expected_downtime = $stat->{"expected-downtime"} || 0;
> +		$expecteddowntimecounter++ if $expected_downtime > 0;
>
>   		#reduce sleep if remainig memory if lower than the everage transfert
>   		$usleep = 300000 if $avglstat && $rem < $avglstat;
> @@ -431,6 +424,17 @@ sub phase2 {
>   			   "remaining ${rem}), total ${total}, expected downtime ${expected_downtime})");
>
>   		#$self->log('info', "migration xbzrle cachesize: ${xbzrlecachesize} transferred ${xbzrlebytes} pages ${xbzrlepages} cachemiss ${xbzrlecachemiss} overflow ${xbzrleoverflow}");
> +
> +		my $migrate_downtime = $defaults->{migrate_downtime};
> +		$migrate_downtime = $conf->{migrate_downtime} if defined($conf->{migrate_downtime});
> +		if (defined($migrate_downtime) && $expecteddowntimecounter == 30) {
> +		    $self->log('info', "migrate_set_downtime: $migrate_downtime");
> +		    eval {
> +			PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate_set_downtime", value => int($migrate_downtime));
> +		    };
> +		    $self->log('info', "migrate_set_downtime error: $@") if $@;
> +		 }
> +
>   	    }
>
>   	    $lstat = $stat->{ram}->{transferred};
>



More information about the pve-devel mailing list