From 7626772856ebee610623de043d184ae7ad1a12a5 Mon Sep 17 00:00:00 2001 From: Wolfgang Link Date: Mon, 17 Nov 2014 09:52:30 +0100 Subject: [PATCH] Add check if host has enough real CPUs for starting VM To prevent a Qemu CPU emualtion! Signed-off-by: Wolfgang Link --- PVE/QemuServer.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 02bf404e..29705982 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -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 {