cpu hot-add doesn't work with upstream qemu 1.5.50
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| QEMU |
Invalid
|
Undecided
|
Unassigned | ||
Bug Description
cpu hot-add doesn't work with upstream qemu 1.5.50. When we add the cpu [through QMP] it throws error as " {"error": {"class": "GenericError", "desc": "Unable to add CPU: 2, max allowed: 1"}} ", when we have booted the guest with two cpus.
Host Kernel Version: 3.10.0-rc5+
Libvirt Version: 1.0.6
Qemu Version: 1.5.50
Guest Kernel : 2.6.32-
Steps to Reproduce :
Boot the guest with : qemu-system-x86_64 -drive file='/
Start the telnet localhost 4444 on another shell
verify that there are two cpus :
I verified through HMP
(qemu) info cpus
* CPU #0: pc=0x0000000000
CPU #1: pc=0x0000000000
Hot add the CPU using the below command in QMP:
{ "execute": "cpu-add", "arguments": { "id": 2 } }
{"error": {"class": "GenericError", "desc": "Unable to add CPU: 2, max allowed: 1"}}
Notes:
--------
1. By default [without specifying the no of cpu], the guest boots up with 1 cpu, when we try to add one more cpu, below is the error:
{ "execute": "cpu-add", "arguments": { "id": 1 } }
{"error": {"class": "GenericError", "desc": "Unable to add CPU: 1, max allowed: 0"}}
2. This issue is seen with or without enabling the KVM [i.e booting the guest without -enable-kvm option]

You need to specify "-smp maxcpus=N" on the command-line, for example "-smp cpus=2,maxcpus=4" will start the VM with 2 CPUs and let you add 2 more. Also, the argument to cpu-add is zero-based, so the range is 0..(maxcpus-1).