[pve-devel] [PATCH] Add Check: If host has enough real CPUs for starting VM, to prevent a Qemu CPU emualtion!

Dietmar Maurer dietmar at proxmox.com
Mon Nov 17 11:26:01 CET 2014


applied, thanks!

> -----Original Message-----
> From: pve-devel [mailto:pve-devel-bounces at pve.proxmox.com] On Behalf Of
> Wolfgang Link
> Sent: Montag, 17. November 2014 09:53
> To: pve-devel at pve.proxmox.com
> Cc: Wolfgang Link
> Subject: [pve-devel] [PATCH] Add Check: If host has enough real CPUs for
> starting VM, to prevent a Qemu CPU emualtion!
> 
> 
> Signed-off-by: Wolfgang Link <wolfgang at linksystems.org>
> ---
>  PVE/QemuServer.pm |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 02bf404..26c6c76
> 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2588,6 +2588,13 @@ sub config_to_command {
>      my $cores = $conf->{cores} || 1;
>      my $maxcpus = $conf->{maxcpus} if $conf->{maxcpus};
> 
> +    my $total_cores = $sockets * $cores;
> +    my $allowed_cores = $cpuinfo->{cpus};
> +
> +    die "MAX $allowed_cores Cores allowed per VM on this Node"
> +	if($allowed_cores < $total_cores ) ;
> +
> +
>      if ($maxcpus) {
>  	push @$cmd, '-smp', "cpus=$cores,maxcpus=$maxcpus";
>      } else {
> --
> 1.7.10.4
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel





More information about the pve-devel mailing list