#+SETUPFILE: ~/Dropbox/Doc/Org_Templates/level-1.org
// this post has not be done yet.
In the world of cloud compute, Scaling the compute resources without shutdown the compute instance is important. e.g. Add/Reduce cpu number, memory size, and so on.
In the version 1.5, QEMU has implemented the feature: CPU Hotplug, it allows virtual machine to add cpu core without shutdown.
Below is how to do it:
Before try this feature, please make sure your QEMU version >= 1.5.0, or this feature is not supported.
# ~/usr/bin/qemu-system-x86_64 --version
QEMU emulator version 1.6.50, Copyright (c) 2003-2008 Fabrice Bellard
Use QEMU command directly to enable this feature
# qemu-system-x86_64 -enable-kvm -m 512 -smp 1,maxcpus=4 ArchLinux.raw -serial \
tcp::3333,nowait,server -qmp tcp::5555,nowait,server -nographic
the maxcpus means the maximum number of hotpluggable CPUs.
[root@myhost ~]# cat /proc/cpuinfo | grep processor
processor : 0
After active the CPU we just add
# telnet localhost 5555
......
{ "execute": "qmp_capabilities" }
{"return": {}}
{ "execute": "cpu-add", "arguments": { "id": 1 }}
{"return": {}}
[root@myhost ~]# cat /proc/cpuinfo | grep processor
processor : 0
processor : 1