]> git.proxmox.com Git - qemu-server.git/commitdiff
cpu hotplug : add coldplugged cpu to qemu command line
authorAlexandre Derumier <aderumier@odiso.com>
Mon, 17 Oct 2016 10:18:55 +0000 (12:18 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 17 Oct 2016 10:51:12 +0000 (12:51 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/QemuServer.pm

index 3e069ea574a2b9034684efb01c361baf79fb3d42..186fae16714001753d15f6a7a14cf2e975ed93a6 100644 (file)
@@ -2975,8 +2975,18 @@ sub config_to_command {
     die "MAX $allowed_vcpus vcpus allowed per VM on this node\n"
        if ($allowed_vcpus < $maxcpus);
 
-    push @$cmd, '-smp', "$vcpus,sockets=$sockets,cores=$cores,maxcpus=$maxcpus";
+    if($hotplug_features->{cpu} && qemu_machine_feature_enabled ($machine_type, $kvmver, 2, 7)) {
 
+       push @$cmd, '-smp', "1,sockets=$sockets,cores=$cores,maxcpus=$maxcpus";
+        for (my $i = 2; $i <= $vcpus; $i++)  {
+           my $cpustr = print_cpu_device($conf,$i);
+           push @$cmd, '-device', $cpustr;
+       }
+
+    } else {
+
+       push @$cmd, '-smp', "$vcpus,sockets=$sockets,cores=$cores,maxcpus=$maxcpus";
+    }
     push @$cmd, '-nodefaults';
 
     my $bootorder = $conf->{boot} || $confdesc->{boot}->{default};