]> git.proxmox.com Git - qemu-server.git/commitdiff
add maxcpus config
authorAlexandre Derumier <aderumier@odiso.com>
Tue, 7 Jan 2014 12:32:50 +0000 (13:32 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 14 Jan 2014 06:26:55 +0000 (07:26 +0100)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QemuServer.pm

index 7813115da600e7ea75f7736f72f03ef34309bb89..a9aeac730f0c5a6be986a9f3569d16e589fe762b 100644 (file)
@@ -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';