[libvirt] iptables --physdev-out warnings

Hi, we've experienced some issues with starting lots of KVM based VM's with libvirt. Since I couldn't find any clues on the libvirt mailing list, I'm posting the way I fixed the issues. When starting a VM, /var/log/messages was spammed with the following message: xt_physdev: using --physdev-out in the OUTPUT, FORWARD and POSTROUTING chains for non-bridged traffic is not supported anymore. With each extra VM I start, the messages get amplified exponentially. This results in longer starting times every new VM, relative the the previously started VM. When I ran a test with starting 100 equal VM's, the first VM started in about 2 seconds, the 100th VM took 48 seconds to start. I'm running a vanilla 3.7.1 kernel, but I have the same issue on VM hosts with kernel 3.2.28 or 3.2.0, running libvirt 0.9.12 and 0.9.8 respectively. Looking into the warning, it seemed that iptables need an extra argument, --physdev-is-bridged, in commands like: iptables -A libvirt-out -m physdev --physdev-is-bridged --physdev-out vnet99 -g FP-vnet99 I patched the libvirt source (version 1.0.0) to test whether this works or not: --- src/nwfilter/nwfilter_ebiptables_driver.c.orig 2013-01-16 10:51:43.000000000 +0100 +++ src/nwfilter/nwfilter_ebiptables_driver.c 2013-01-16 10:52:07.000000000 +0100 @@ -166,7 +166,7 @@ snprintf(buf, sizeof(buf), "%c%c-%s", prefix[0], prefix[1], ifname) #define PHYSDEV_IN "--physdev-in" -#define PHYSDEV_OUT "--physdev-out" +#define PHYSDEV_OUT "--physdev-is-bridged --physdev-out" static const char *m_state_out_str = "-m state --state NEW,ESTABLISHED"; static const char *m_state_in_str = "-m state --state ESTABLISHED"; The warnings in /var/log/messages are gone and running the test again proved the 100th VM started in 3.8 seconds. It suprises me I'm the first to mention this problem on the libvirt mailing list and I wondering if I'm doing something wrong. Until then, this fix helps me a lot! Reinier Schoof -- TransIP BV | https://www.transip.nl/

On 01/16/2013 03:23 AM, Reinier Schoof wrote:
I patched the libvirt source (version 1.0.0) to test whether this works or not: --- src/nwfilter/nwfilter_ebiptables_driver.c.orig 2013-01-16 10:51:43.000000000 +0100 +++ src/nwfilter/nwfilter_ebiptables_driver.c 2013-01-16 10:52:07.000000000 +0100 @@ -166,7 +166,7 @@ snprintf(buf, sizeof(buf), "%c%c-%s", prefix[0], prefix[1], ifname)
#define PHYSDEV_IN "--physdev-in" -#define PHYSDEV_OUT "--physdev-out" +#define PHYSDEV_OUT "--physdev-is-bridged --physdev-out"
Thanks for the report, and also for a quick patch attempt.
The warnings in /var/log/messages are gone and running the test again proved the 100th VM started in 3.8 seconds. It suprises me I'm the first to mention this problem on the libvirt mailing list and I wondering if I'm doing something wrong. Until then, this fix helps me a lot!
I took a look on RHEL 5.9, to see if --physdev-is-bridged was supported in iptables that old (1.3.5). It appears to be listed there, so you are in luck. It would be nice if you can convert this to a formal git patch submission (see http://libvirt.org/hacking.html); but if you are not comfortable doing that, we can help. I'd like to see if Laine or Stefan have any comments; but if they don't reject this in another day or two, I have no problems going ahead and applying it. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Eric Blake <eblake@redhat.com> wrote on 01/16/2013 07:48:17 PM:
From: Eric Blake <eblake@redhat.com> To: Reinier Schoof <reinier@transip.nl>, Cc: libvir-list@redhat.com, Stefan Berger/Watson/IBM@IBMUS Date: 01/16/2013 07:49 PM Subject: Re: [libvirt] iptables --physdev-out warnings
On 01/16/2013 03:23 AM, Reinier Schoof wrote:
I patched the libvirt source (version 1.0.0) to test whether this
works
or not: --- src/nwfilter/nwfilter_ebiptables_driver.c.orig 2013-01-16 10:51:43.000000000 +0100 +++ src/nwfilter/nwfilter_ebiptables_driver.c 2013-01-16 10:52:07.000000000 +0100 @@ -166,7 +166,7 @@ snprintf(buf, sizeof(buf), "%c%c-%s", prefix[0], prefix[1], ifname)
#define PHYSDEV_IN "--physdev-in" -#define PHYSDEV_OUT "--physdev-out" +#define PHYSDEV_OUT "--physdev-is-bridged --physdev-out"
Thanks for the report, and also for a quick patch attempt.
The warnings in /var/log/messages are gone and running the test again proved the 100th VM started in 3.8 seconds. It suprises me I'm the first to mention this problem on the libvirt mailing list and I wondering if I'm doing something wrong. Until then, this fix helps me a lot!
I took a look on RHEL 5.9, to see if --physdev-is-bridged was supported in iptables that old (1.3.5). It appears to be listed there, so you are in luck.
It would be nice if you can convert this to a formal git patch submission (see http://libvirt.org/hacking.html); but if you are not comfortable doing that, we can help. I'd like to see if Laine or Stefan have any comments; but if they don't reject this in another day or two, I have no problems going ahead and applying it.
It looks good to me. please go ahead. Regards, Stefan
participants (3)
-
Eric Blake
-
Reinier Schoof
-
Stefan Berger