[pve-devel] [PATCH qemu-server] migration: fix downtime limit auto-increase

Stefan Reiter s.reiter at proxmox.com
Thu Apr 2 15:20:07 CEST 2020


485449e37 ("qmp: use migrate-set-parameters in favor of deprecated options")
changed the initial "migrate_set_downtime" QMP call to the more recent
"migrate-set-parameters", but forgot to do so for the auto-increase code
further below.

Since the units of the two calls don't match, this would have caused the
auto-increase to increase the limit to absurd levels as soon as it kicked
in (ms treated as s).

Update the second call to the new version as well, and while at it remove
the unnecessary "defined()" check for $migrate_downtime, which is always
initialized from the defaults anyway.

Signed-off-by: Stefan Reiter <s.reiter at proxmox.com>
---

I am not sure when this code is used at all... I tried slowing the network down
to 56k-modem levels, and migration still completed without triggering it (both
with default migrate_downtime and migrate_downtime set to 1ms).

 PVE/QemuMigrate.pm | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 579be0e..e954eca 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -860,12 +860,10 @@ sub phase2 {
 
     my $migrate_downtime = $defaults->{migrate_downtime};
     $migrate_downtime = $conf->{migrate_downtime} if defined($conf->{migrate_downtime});
-    if (defined($migrate_downtime)) {
-	# migrate-set-parameters expects limit in ms
-	$migrate_downtime *= 1000;
-	$self->log('info', "migration downtime limit: $migrate_downtime ms");
-	$qemu_migrate_params->{'downtime-limit'} = int($migrate_downtime);
-    }
+    # migrate-set-parameters expects limit in ms
+    $migrate_downtime *= 1000;
+    $self->log('info', "migration downtime limit: $migrate_downtime ms");
+    $qemu_migrate_params->{'downtime-limit'} = int($migrate_downtime);
 
     # set cachesize to 10% of the total memory
     my $memory =  $conf->{memory} || $defaults->{memory};
@@ -988,11 +986,13 @@ sub phase2 {
 		if ($downtimecounter > 5) {
 		    $downtimecounter = 0;
 		    $migrate_downtime *= 2;
-		    $self->log('info', "migrate_set_downtime: $migrate_downtime");
+		    $self->log('info', "auto-increased downtime to continue migration: $migrate_downtime ms");
 		    eval {
-			mon_cmd($vmid, "migrate_set_downtime", value => int($migrate_downtime*100)/100);
+			# migrate-set-parameters does not touch values not
+			# specified, so this only changes downtime-limit
+			mon_cmd($vmid, "migrate-set-parameters", 'downtime-limit' => int($migrate_downtime));
 		    };
-		    $self->log('info', "migrate_set_downtime error: $@") if $@;
+		    $self->log('info', "migrate-set-parameters error: $@") if $@;
             	}
 
 	    }
-- 
2.26.0





More information about the pve-devel mailing list