From c05f1b33ea1cf6ed76a5e3036c23cbf428723aba Mon Sep 17 00:00:00 2001 From: Stefan Reiter Date: Thu, 2 Apr 2020 15:20:07 +0200 Subject: [PATCH] migration: fix downtime limit auto-increase 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 --- PVE/QemuMigrate.pm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 579be0eb..e954eca5 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 $@; } }