From 3bd18e48cf76397e9c565397d7d9852d45628e2d Mon Sep 17 00:00:00 2001 From: Alexandre Derumier Date: Tue, 7 Jan 2014 13:32:50 +0100 Subject: [PATCH] add maxcpus config Signed-off-by: Alexandre Derumier --- PVE/QemuServer.pm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 7813115..a9aeac7 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -300,6 +300,13 @@ EODESC minimum => 1, default => 1, }, + maxcpus => { + optional => 1, + type => 'integer', + description => "Maximum cpus for hotplug.", + minimum => 1, + default => 1, + }, acpi => { optional => 1, type => 'boolean', @@ -1741,6 +1748,9 @@ sub write_vm_config { delete $conf->{smp}; } + if ($conf->{maxcpus} && $conf->{sockets}){ + delete $conf->{sockets}; + } my $used_volids = {}; my $cleanup_config = sub { @@ -2403,7 +2413,13 @@ sub config_to_command { $sockets = $conf->{sockets} if $conf->{sockets}; my $cores = $conf->{cores} || 1; - push @$cmd, '-smp', "sockets=$sockets,cores=$cores"; + my $maxcpus = $conf->{maxcpus} if $conf->{maxcpus}; + + if($maxcpus){ + push @$cmd, '-smp', "cpus=$cores,maxcpus=$maxcpus"; + }else{ + push @$cmd, '-smp', "sockets=$sockets,cores=$cores"; + } push @$cmd, '-nodefaults'; -- 2.39.2