[libvirt] [PATCH 0/5] macvtap support for Qemu/KVM VMs via libvirt

Hello! This is a re-post of previously posted patches following Daniel Berrange's request for changes along with other fixes PLUS a rebase to the latest code where the conn parameter is missing along with changes requested by Daniel Veillard. The following patches provide support for making the macvtap networking device type available to Qemu/KVM VMs. The patches rely on the macvtap driver that just became available through the Linux net-next tree (fixes still may be necessary) and make the device available to Qemu/KVM via a tap file descriptor similar to a 'regular' tap device. Following up on previous discussions, the libvirt patches allow using the following XML in the domain description to enable qemu network connectivity via this type of device: <interface type='direct'> <source dev='eth1' mode='vepa'/> <model type='virtio'/> </interface> The above XML indicates that eth1 is the Ethernet interface to link the macvtap device to and communicate to the network. As a consequence, libvirt will create an instance of a macvtap device, assign it the same MAC address as the VM's interface has and open a file descriptor of the associated character device /dev/tap%d and pass it via command line to Qemu/kvm. In the above XML the mode can be chosen as 'vepa', 'private' or 'bridge' and is by default set to 'vepa'(by the driver) if omitted. Attachment and detachment of macvtap to/from a running VM also works. Regards, Stefan

On Thu, Feb 11, 2010 at 09:48:07AM -0500, Stefan Berger wrote:
Hello!
This is a re-post of previously posted patches following Daniel Berrange's request for changes along with other fixes PLUS a rebase to the latest code where the conn parameter is missing along with changes requested by Daniel Veillard.
Okay, I have applied and pushed the 5 patch set, but I had to do a bit of surgery. First the detection code in configure was always setting WITH_MACVTAP , so of course thsi didn't compile on my system. I also had to reorganize the patch order to have each patch compiling. And I also had to fix various things popping up when running "make syntax-check" after each patch got applied. But basically that's in and with the new version of [3/5] ! thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Daniel Veillard <veillard@redhat.com> wrote on 02/15/2010 12:24:01 PM:
On Thu, Feb 11, 2010 at 09:48:07AM -0500, Stefan Berger wrote:
Hello!
This is a re-post of previously posted patches following Daniel Berrange's request for changes along with other fixes PLUS a rebase to the latest code where the conn parameter is missing along with changes requested by Daniel Veillard.
Okay, I have applied and pushed the 5 patch set, but I had to do a bit of surgery. First the detection code in configure was always setting WITH_MACVTAP , so of course thsi didn't compile on my system. I also had to reorganize the patch order to have each patch compiling. And I also had to fix various things popping up when running "make syntax-check" after each patch got applied.
Thanks a lot for doing this. I posted the patches in the sequence I have them applied via quilt, assuming that they are all being applied. I ran make syntax-check on the version with the patches applied and no error was shown on anything that the patches touch. I see reports related to storage_conf.c, though. I am running FC12. Could this be related to a difference in installation? I'll follow up with a patch regarding the 'vm shutdown' issue and libnl for communication with the netlink sockets, but likely not use libnl for building the actual netlink message. Stefan
But basically that's in and with the new version of [3/5] !
thanks !
Daniel
-- Daniel Veillard | libxml Gnome XML XSLT toolkit
daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Mon, Feb 15, 2010 at 12:50:50PM -0500, Stefan Berger wrote:
Daniel Veillard <veillard@redhat.com> wrote on 02/15/2010 12:24:01 PM:
On Thu, Feb 11, 2010 at 09:48:07AM -0500, Stefan Berger wrote:
Hello!
This is a re-post of previously posted patches following Daniel Berrange's request for changes along with other fixes PLUS a rebase to the latest code where the conn parameter is missing along with changes requested by Daniel Veillard.
Okay, I have applied and pushed the 5 patch set, but I had to do a bit of surgery. First the detection code in configure was always setting WITH_MACVTAP , so of course thsi didn't compile on my system. I also had to reorganize the patch order to have each patch compiling. And I also had to fix various things popping up when running "make syntax-check" after each patch got applied.
Thanks a lot for doing this. I posted the patches in the sequence I have them applied via quilt, assuming that they are all being applied. I ran make syntax-check on the version with the patches applied and no error was shown on anything that the patches touch. I see reports related to storage_conf.c, though. I am running FC12. Could this be related to a difference in installation?
Same here, configure.ac had + AC_DEFINE_UNQUOTED([WITH_MACVTAP], 1, [whether macvtap support is enabled]) so #define WITH_MACVTAP 1 ended up in config.h whatever the check results. Plus the test for the feature was using #if defined(WITH_MACVTAP) which would turn true even with #define WITH_MACVTAP 1 Some of the "make/make check/make syntax-check" failures happened between patches, we try to be "make/make check" clean after each patch. The syntax-check also raised problem with isspace (need to use c_isspace) or po/POTFILE.in needing update. Anyway it's all in now, but I made various changes left and right, usually small ones though.
I'll follow up with a patch regarding the 'vm shutdown' issue and libnl for communication with the netlink sockets, but likely not use libnl for building the actual netlink message.
Okay, but if we can just cleanup the small allocations issues it's probably better than depend on another library. thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Mon, 2010-02-15 at 18:24 +0100, Daniel Veillard wrote:
On Thu, Feb 11, 2010 at 09:48:07AM -0500, Stefan Berger wrote:
Hello!
This is a re-post of previously posted patches following Daniel Berrange's request for changes along with other fixes PLUS a rebase to the latest code where the conn parameter is missing along with changes requested by Daniel Veillard.
Okay, I have applied and pushed the 5 patch set, but I had to do a bit of surgery. First the detection code in configure was always setting WITH_MACVTAP , so of course thsi didn't compile on my system. I also had to reorganize the patch order to have each patch compiling. And I also had to fix various things popping up when running "make syntax-check" after each patch got applied.
But basically that's in and with the new version of [3/5] !
thanks !
Daniel
The attached patch adds a macvtap usage example to the Network Interface chapter of the Libvirt Application Development Guide. -- Best regards, Gerhard Stenzel, ----------------------------------------------------------------------------------------------------------------------------------- IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Martin Jetter Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
participants (3)
-
Daniel Veillard
-
Gerhard Stenzel
-
Stefan Berger