I am using libvirt version 6.0.0 on Ubuntu 20.04.4 LTS to manage my KVM VMs. I want to change a number of cores of the VM lively using virsh CLI. I have seen that by using virsh setvcpus VM_name number_of_core --live
I can do this. Here is my output about it from the host OS.
Step 1. I spun up my VM with 1 core. Here is vcpu info of the VM.
host$ virsh vcpuinfo ubuntu_18_04_guest4
VCPU: 0
CPU: 14
State: running
CPU time: 25.8s
CPU Affinity: yyyyyyyyyyyyyyyy
- I change a number of cores of the VM from 1 core to 2 cores.
host$ virsh setvcpus ubuntu_18_04_guest4 2 --live
- I check the number of cores of the VM
host$ virsh vcpuinfo ubuntu_18_04_guest4
VCPU: 0
CPU: 2
State: running
CPU time: 65.5s
CPU Affinity: yyyyyyyyyyyyyyyy
VCPU: 1
CPU: 0
State: running
CPU Affinity: yyyyyyyyyyyyyyyy
On the host side, it looks like it works. Now, I am moving to the guest OS side. Here is the output when the VM is first spun up with 1 core.
As we see, there is 1 core because we started the VM with 1 core. Now, I attach the screenshot after I increased the number of cores to 2.
As we see, I do not see this increase on the guest side although I see it on the host side. I now reboot the VM.
guest$ sudo reboot
I attach htop output after rebooting the VM.
Now previously allocated 2 cores are effective in the guest machine.
To conclude, even if I do live core allocation to VM on the host side, I needed to reboot the VM to make it effective. In this case, what is the reason for the live core allocation?
Thank you,