Rate This Document
Findability
Accuracy
Completeness
Readability

Feature Enablement

To use the vCPU hot add function, configure the number of CPUs, the maximum number of CPUs supported by the VM, and the VM chipset type when creating the VM. (For the AArch64 architecture, the virt-4.2 or a later version is required. For the x86_64 architecture, the pc-i440fx-1.5 or a later version is required.) The AArch64 VM is used as an example. The configuration template is as follows:

<domain type='kvm'>
...
<vcpu placement='static' current='m'>n</vcpu>
<os><type arch='aarch64' machine='virt-6.2'>hvm</type>
</os>
...
<domain>
  • The value of placement must be static.
  • m indicates the current number of CPUs on the VM, that is, the default number of CPUs after the VM is started. n indicates the maximum number of CPUs that can be hot added to a VM. The value cannot exceed the maximum CPU specifications supported by the hypervisor or guest OS. n is greater than or equal to m.
  • When a VM is created using the virt-install command, the XML configuration file does not contain the preceding vCPU node by default after the VM is created. When a node is dynamically added using the virsh edit <vm name> command, the node does not take effect immediately. It is required to restart the VM after the node is added for subsequent vCPU hotplug operations.

In openEuler 24.03 LTS, this feature is enabled by default. For the non-openEuler kernel, integrate and adapt to the following function patches:

QEMU
https://gitee.com/openeuler/qemu/pulls/804
https://gitee.com/openeuler/qemu/pulls/850
https://gitee.com/openeuler/qemu/pulls/860
https://gitee.com/openeuler/qemu/pulls/863
Guest OS:
https://gitee.com/openeuler/kernel/pulls/4219
https://gitee.com/openeuler/kernel/pulls/5555
https://gitee.com/openeuler/kernel/pulls/7902
https://gitee.com/openeuler/kernel/pulls/9746