[pve-devel] [PATCH] increase migrate_set_downtime only if expected downtime is more than 30 iterations > 0
Alexandre Derumier
aderumier at odiso.com
Thu Dec 27 11:14:25 CET 2012
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};
--
1.7.10.4
More information about the pve-devel
mailing list