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

Dennis Chen xschen at tnsoft.com.cn
Sat Jun 1 10:49:31 UTC 2013


On 06/01/2013 03:16 PM, Dennis Chen wrote:
> On 05/29/2013 04:28 AM, Eric Blake wrote:
>> On 05/28/2013 02:24 PM, Eric Blake wrote:
>>
>>>> So the question is: is there any method I can't find yet to change the
>>>> vcpu count of a running vm dynamically?
>>> Wait for newer qemu and libvirt, or else pitch in and help write 
>>> patches.
>> You might not have to wait that long - if you could help test these
>> patches, it would be appreciated:
>>
>> https://www.redhat.com/archives/libvir-list/2013-May/msg01857.html
>>
> Hi,
>
> After apply the patch, I've made a test. The testing environment as:
>
> virsh # version
> Compiled against library: libvirt 1.0.5
> Using library: libvirt 1.0.5
> Using API: QEMU 1.0.5
> Running hypervisor: QEMU 1.5.0
>
> The xml piece of the vm domain:
>     <channel type='unix'>
>         <source mode='bind' 
> path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
>         <target type='virtio' name='org.qemu.guest_agent.0'/>
>     </channel>
>
> the network connection between the vm and host is ok.
>
> Also I installed the qemu-guest-agent in the guest os:
> [root at localhost ~]#rpm -qa | grep qemu-guest
> qemu-guest-agent-0.12.1.2-2.355.el6.i686
>
> An error happened when I try to offline a guest vcpu in virsh:
> virsh # setguestvcpu 8  1 --offline
> error: Guest agent is not responding: Guest agent not available for now
>
> Is there some step I missed before I invoke the 'setguestvcpu' command 
> in virsh or I need to write a program to hot-plug/unplug the vcpu with 
> the help of the new API introduced by this patch? Thanks!
>
> BRs,
> Dennis

update after investigation, I need to start up the 'qemu-guest-agent' 
daemon in the guest 
(https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/qemu-ga.html):
[root at localhost ~]#qemu-ga

After that, I tried the command again:
virsh # setguestvcpu 8 1 --offline
error: internal error unable to execute QEMU agent command 
'guest-set-vcpus': The command guest-set-vcpus has not been found

I think the communication between monitor and guest is ok, because below 
command is OK:
virsh # shutdown 8 --mode agent
Domain 8 is being shutdown

VM shutdown after this command. Also, I double checked the 
src/qemu/qemu_agent.c, and I can find the 2 functions:
qemuAgentGetVCPUs() and qemuAgentSetVCPUs()

Another,
virsh # qemu-agent-command 9 '{"execute":"cpu-add","arguments":{"id":2}}'
{"error":{"class":"CommandNotFound","desc":"The command cpu-add has not 
been found","data":{"name":"cpu-add"}}}

Seems the guest agent can't find vcpu hot-plug/unplug command, the qemu 
I am using is 1.5.0, does it need some patches to handle this or 
something I still missed?

BRs,
Dennis




More information about the libvirt-users mailing list