Feature Verification
In the supported openEuler versions, deploy libvirt 9.10.0 and QEMU 8.2.0, configure the VM XML file, and start the VM. Assume that the number of CPUs configured for the VM is 4, the maximum number of CPUs supported by the VM is 8, and the VM name is test_vm.
- Log in to a VM.
1virsh console test_vm
- Run lscpu and record the number of CPUs. The number should be 4.
- Press Ctrl+] to exit the VM.
- Run the vCPU hot add command.
1virsh setvcpus test_vm --count 8 --live
- In the preceding command, 8 is the expected number of vCPUs after the hotplug operation. You can configure the number as required, but the number cannot be greater than the maximum number of vCPUs specified during VM definition.
- --live indicates that the vCPU hot add takes effect immediately, but the initial settings are restored after a restart.
- If only --live is specified, the hotplug operation becomes invalid when the VM is restarted. To retain the vCPU hot add operation, specify the --config parameter so that the operation still takes effect after the VM is restarted. In openEuler 24.03 LTS, the config and live parameters can be specified at the same time.
- The maximum number of vCPUs that can be hot added to a VM is restricted by the OS. This number varies according to the OS version. If the number of vCPUs specified in the hot add command exceeds the maximum number of vCPUs specified when the VM is defined or the maximum number of vCPUs specified by the OS (usually in large-scale VM scenarios), an error is reported and the hot add command does not take effect.
- Log in to the VM again.
1virsh console test_vm
- Run lscpu and record the number of CPUs. The number should be 8, indicating that the vCPU hot add is successful.
Parent topic: Feature Usage