5
0
mirror of git://git.proxmox.com/git/qemu-server.git synced 2025-01-10 01:18:01 +03:00

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 <s.reiter@proxmox.com>
This commit is contained in:
Stefan Reiter 2020-04-02 15:20:07 +02:00 committed by Thomas Lamprecht
parent e5fd1c6591
commit c05f1b33ea

View File

@ -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);
}
# 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 $@;
}
}