[libvirt-users] About the change of a VM's vcpu count in runtime?

Dennis Chen xschen at tnsoft.com.cn
Tue May 28 07:24:07 UTC 2013


Hi,

We know that there is a command "setvcpus" in virsh used to "change 
number of virtual CPUs", now we just have the need to change vcpu count 
dynamically for a running VM, so I tried this command (the vcpu count is 
2 in the VM xml file), below is the result:

virsh # setvcpus 3 --count 4
error: invalid argument: requested vcpus is greater than max allowable 
vcpus for the domain: 4 > 2

virsh # setvcpus 3 --count 1
error: Operation not supported: qemu didn't unplug the vCPUs properly

So I tried another way: log into the running VM, and "echo 0 > 
/sys/devices/system/cpu/cpu1/online", after that I can find only one 
processor in the vm through '/proc/cpuinfo', but in virsh, the vcpuinfo 
still shows:

virsh # vcpuinfo 3
VCPU:           0
CPU:            0
State:          running
CPU time:       13.5s
CPU Affinity:   yyyy

VCPU:           1
CPU:            1
State:          running
CPU time:       6.9s
CPU Affinity:   yyyy

So the question is: is there any method I can't find yet to change the 
vcpu count of a running vm dynamically?

BRs,
Dennis




More information about the libvirt-users mailing list