[pve-devel] applied: [PATCH qemu-server v3] Use default values from load_defaults() when none is specified in conf
Wolfgang Bumiller
w.bumiller at proxmox.com
Fri Dec 15 13:09:12 CET 2017
applied
On Tue, Dec 12, 2017 at 11:56:15AM +0100, Emmanuel Kasper wrote:
> This also fixes a bug where VMs with no memory defined in the config
> where reported as using 0MB instead of 512.
>
> Signed-off-by: Emmanuel Kasper <e.kasper at proxmox.com>
> ---
> changes since V1:
> use load_defaults() instead of $confdesc for consistency with the
> rest of the codebase
>
> PVE/QemuServer.pm | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 1d1ae29..42c412a 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2591,6 +2591,8 @@ sub vmstatus {
> my $storecfg = PVE::Storage::config();
>
> my $list = vzlist();
> + my $defaults = load_defaults();
> +
> my ($uptime) = PVE::ProcFSTools::read_proc_uptime(1);
>
> my $cpucount = $cpuinfo->{cpus} || 1;
> @@ -2616,16 +2618,19 @@ sub vmstatus {
> $d->{maxdisk} = 0;
> }
>
> - $d->{cpus} = ($conf->{sockets} || 1) * ($conf->{cores} || 1);
> + $d->{cpus} = ($conf->{sockets} || $defaults->{sockets})
> + * ($conf->{cores} || $defaults->{cores});
> $d->{cpus} = $cpucount if $d->{cpus} > $cpucount;
> $d->{cpus} = $conf->{vcpus} if $conf->{vcpus};
>
> $d->{name} = $conf->{name} || "VM $vmid";
> - $d->{maxmem} = $conf->{memory} ? $conf->{memory}*(1024*1024) : 0;
> + $d->{maxmem} = $conf->{memory} ? $conf->{memory}*(1024*1024)
> + : $defaults->{memory}*(1024*1024);
>
> if ($conf->{balloon}) {
> $d->{balloon_min} = $conf->{balloon}*(1024*1024);
> - $d->{shares} = defined($conf->{shares}) ? $conf->{shares} : 1000;
> + $d->{shares} = defined($conf->{shares}) ? $conf->{shares}
> + : $defaults->{shares};
> }
>
> $d->{uptime} = 0;
> --
> 2.11.0
More information about the pve-devel
mailing list