[libvirt-users] Hotplug/hotadd functionality of libvirt?

Hello, First of all, happy new year! I am interested in the hot plugging facilities of libvirt, in particular in what qemu calls 'hot add' of network interface cards. (And also the reverse: hot unplugging/removing of NICs.) I think I am overlooking something, but so far the best I have been able to find is: http://libvirt.org/sources/virshcmdref/html/ and it is not entirely clear to me what the relevant virsh commands are. The most obvious choice seems to be the iface-* commands such as http://libvirt.org/sources/virshcmdref/html/sect-iface-define.html but these seem to be about physical rather than virtual network interfaces, and the documentation `needs to be written' anyway, and from the copyright notice the manual seems to be somewhat outdated by now. Can you give me a little help with this? Is such hot plug/add functionality supported by libvirt in the first place? Is there some kind of overview document about this? What is the most authoritative documentation of this functionality? Is there a Java or C API to access this functionality? Thank you for any help you can give me, -- Kees van Reeuwijk

On 03.01.2012 14:39, Kees van Reeuwijk wrote:
Hello,
First of all, happy new year!
I am interested in the hot plugging facilities of libvirt, in particular in what qemu calls 'hot add' of network interface cards. (And also the reverse: hot unplugging/removing of NICs.)
I think I am overlooking something, but so far the best I have been able to find is:
http://libvirt.org/sources/virshcmdref/html/
and it is not entirely clear to me what the relevant virsh commands are. The most obvious choice seems to be the iface-* commands such as
http://libvirt.org/sources/virshcmdref/html/sect-iface-define.html
but these seem to be about physical rather than virtual network interfaces, and the documentation `needs to be written' anyway, and from the copyright notice the manual seems to be somewhat outdated by now.
Can you give me a little help with this? Is such hot plug/add functionality supported by libvirt in the first place? Is there some kind of overview document about this? What is the most authoritative documentation of this functionality? Is there a Java or C API to access this functionality?
Thank you for any help you can give me,
I think virsh attach-interface / detach-interface is what you are looking for. Another option is to write a little XML snippet and virsh attach-device it. Michal

On 01/03/2012 01:31 PM, Michal Privoznik wrote:
On 03.01.2012 14:39, Kees van Reeuwijk wrote:
Hello,
First of all, happy new year!
I am interested in the hot plugging facilities of libvirt, in particular in what qemu calls 'hot add' of network interface cards. (And also the reverse: hot unplugging/removing of NICs.)
I think I am overlooking something, but so far the best I have been able to find is:
http://libvirt.org/sources/virshcmdref/html/
and it is not entirely clear to me what the relevant virsh commands are. The most obvious choice seems to be the iface-* commands such as
http://libvirt.org/sources/virshcmdref/html/sect-iface-define.html
but these seem to be about physical rather than virtual network interfaces, and the documentation `needs to be written' anyway, and from the copyright notice the manual seems to be somewhat outdated by now.
Can you give me a little help with this? Is such hot plug/add functionality supported by libvirt in the first place? Is there some kind of overview document about this? What is the most authoritative documentation of this functionality? Is there a Java or C API to access this functionality?
Thank you for any help you can give me,
I think virsh attach-interface / detach-interface is what you are looking for. Another option is to write a little XML snippet and virsh attach-device it.
Additionally, I can vouch for at least a centos6 guest being able to properly respond to hotplug/remove for virtio NICs. It automatically runs the ifup for the interface as long as the MAC address is correct. I imagine this works for other O/S as well. I add/remove using virt-manager (which uses libvirt) so I don't know the specific virsh command... David
participants (3)
-
David Mansfield
-
Kees van Reeuwijk
-
Michal Privoznik