X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=PVE%2FQemuMigrate.pm;h=27cf7e36eb3706d3cc73cadad0f0ea436a7fa4dc;hb=2254ffcf8792a9b29957594945c181d2f38c17e7;hp=04a0776852fe755fba5d1ae8aec8780f1b7c20a7;hpb=d108cb1eb29b5629c95f776668de4f27007b0518;p=qemu-server.git diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 04a07768..27cf7e36 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -692,6 +692,8 @@ sub phase2 { # set cachesize to 10% of the total memory my $memory = $conf->{memory} || $defaults->{memory}; my $cachesize = int($memory * 1048576 / 10); + $cachesize = round_powerof2($cachesize); + $self->log('info', "set cachesize: $cachesize"); eval { PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-cache-size", value => int($cachesize)); @@ -1032,4 +1034,9 @@ sub final_cleanup { # nothing to do } +sub round_powerof2 { + return 1 if $_[0] < 2; + return 2 << int(log($_[0]-1)/log(2)); +} + 1;