On 01/12/2015 11:10 PM, zhang bo wrote: > It works well if we use qmp command to directly interact with qemu 2.1 to hot-add vhost-user network card. However, libvirt seems not support hotplugging well. > > Steps to use qmp commands to directly(without libvirtd) interact with qemu 2.1 : > 1 (qemu) chardev-add backend=socket,id=charnet1,path=/var/run/vhost-user/tap1 > 2 (qemu) netdev_add vhost-user,id=hostnet1,chardev=charnet1 > 3 (qemu) device_add virtio-net-pci,netdev=hostnet1,id=net1 > > In libvirt, we found that, Hot-plug is finished with a success result, but the network card doesn't work afterwards, it could not send/receive IOs. > As we further digged into the problem, the 1st step of qmp commands is missing if we use libvirt to do the hot-plug job. > 1 (qemu) chardev-add backend=socket,id=charnet1,path=/var/run/vhost-user/tap1 > > After looking into the function qemuDomainAttachNetDevice(), we found that it does have > 1) qemuMonitorAddNetdev() > 2) qemuMonitorAddDevice() > except for *ChardevAdd*() > > The question is : why does qemuDomainAttachNetDevice() not do the *ChardevAdd*() work? It seems necessary to add chardev to add a vhost-user network card. My guess would be that it is because all of the other netdev types require only an AddNetDev and AddDevice, and the person who added vhost-user support didn't notice that the vhost-user device was different in this aspect, either assuming that it would work similar to the existing types, or just not considering hotplug when they added the support. As a matter of fact, I don't see any code specific to vhost-user added to qemu_hotplug.c in commit a14abd46, so it seems that the latter is the case. Patches welcome :-) -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list