]> git.proxmox.com Git - qemu-server.git/commitdiff
Add check if host has enough real CPUs for starting VM
authorWolfgang Link <wolfgang@linksystems.org>
Mon, 17 Nov 2014 08:52:30 +0000 (09:52 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 17 Nov 2014 10:24:15 +0000 (11:24 +0100)
To prevent a Qemu CPU emualtion!

Signed-off-by: Wolfgang Link <wolfgang@linksystems.org>
PVE/QemuServer.pm

index 02bf404ebe481cb1c8989750b618b0337f44368a..2970598204626f5dfac28f108b06a0ee806742b0 100644 (file)
@@ -2588,6 +2588,12 @@ 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 {