mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-04 18:46:19 +00:00
Use default values when memory is not set in vm.conf when migrating
This fixes a "Use of uninitialized value in multiplication (*) " warning when doing a migration
This commit is contained in:
parent
9fea7ca3cf
commit
171ed95c76
@ -640,8 +640,9 @@ sub phase2 {
|
|||||||
};
|
};
|
||||||
warn $@ if $@;
|
warn $@ if $@;
|
||||||
|
|
||||||
#set cachesize 10% of the total memory
|
# set cachesize to 10% of the total memory
|
||||||
my $cachesize = int($conf->{memory}*1048576/10);
|
my $memory = $conf->{memory} || $defaults->{memory};
|
||||||
|
my $cachesize = int($memory * 1048576 / 10);
|
||||||
$self->log('info', "set cachesize: $cachesize");
|
$self->log('info', "set cachesize: $cachesize");
|
||||||
eval {
|
eval {
|
||||||
PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-cache-size", value => int($cachesize));
|
PVE::QemuServer::vm_mon_cmd_nocheck($vmid, "migrate-set-cache-size", value => int($cachesize));
|
||||||
@ -712,7 +713,7 @@ sub phase2 {
|
|||||||
if ($stat->{status} eq 'completed') {
|
if ($stat->{status} eq 'completed') {
|
||||||
my $delay = time() - $start;
|
my $delay = time() - $start;
|
||||||
if ($delay > 0) {
|
if ($delay > 0) {
|
||||||
my $mbps = sprintf "%.2f", $conf->{memory}/$delay;
|
my $mbps = sprintf "%.2f", $memory / $delay;
|
||||||
my $downtime = $stat->{downtime} || 0;
|
my $downtime = $stat->{downtime} || 0;
|
||||||
$self->log('info', "migration speed: $mbps MB/s - downtime $downtime ms");
|
$self->log('info', "migration speed: $mbps MB/s - downtime $downtime ms");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user