mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-06-18 08:18:23 +00:00
migrate cache-size : power of 2
qemu 2.11 need a power of 2 cache size. " Parameter 'xbzrle_cache_size' expects is invalid, it should be bigger than target page size and a power of two " roundup to near power of 2 value
This commit is contained in:
parent
d108cb1eb2
commit
50d8dd5dc7
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user