CPU Hot Plug/Unplug With KVM On CentOS

Home » CentOS-Virt » CPU Hot Plug/Unplug With KVM On CentOS
CentOS-Virt No Comments


I’m trying to plug and unplug cpus with a host CentOS 7 on a guest machine with CentOS too. I have created the guest with virt-install command, modified my domxml to have maximum 4 vcpus and updated the current cpu to 2.

After that I open the virsh console, and used command setvcpus to add/remove cpus. I was able to increase the vcpu count until 4 but can’t increase it after 4 as it exceeds maximum vcpu count. However when I want to remove vcpus, again by using setvcpus command, I noticed that it’s not possbile. I have looked around and found a changelog related to CentOS 6.5
where unplugging was supported. To check that, I have installed CentOS 6.5
on the host machine and tried again and noticed that it worked.

I used the commands as this:

virsh -c qemu:///system setvcpus myguest 3
setvcpus myguest 2 (Caused an error on CentOS 7 but not on 6.5)

The excerpt from my domxml related to the cpus is like this:


I can again see those cpus being plugged and unplugged using the

I have looked around a little bit but I was unable to find why this happened. Can you direct me to the right place to look or tell me if this is a bug or not? Or is it something related to the libvirt and not kvm/qemu?