Re: [PATCHv3] lxc veth interfaces: fix interface name collisions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 02, 2013 at 11:45:27AM +0300, Oskari Saarenmaa wrote:
> The previous veth interface naming scheme tried to find the lowest unused
> index for both the parent and container veth interfaces.  That's susceptible
> to race conditions when multiple containers are started at the same time.
> 
> Try to pick a random unused interface id for the parent if one wasn't given
> by the caller and use that as a template for the container interface name.
> This should prevent races to create two uniquely named interfaces for each
> container.  The caller can still assign the parent interface name manually
> and that name is used for in container (before the interface is moved to the
> container namespace and renamed.)
> 
> Signed-off-by: Oskari Saarenmaa <os@xxxxxxx>
> ---
> My previous two patches for this issue were rejected because of concerns
> with the naming scheme (in v1) or leaving fixing the race condition to the
> caller (v2) and I mostly forgot about this issue after implementing a
> workaround in my application, but yesterday someone else on #virt ran into
> the same issue and I took another look at my patches.
> 
> The third iteration of this patch uses random identifiers and makes sure
> they're not already in use, but still does not retry interface creation on
> failure.  I believe this is good enough as the likelihood of two containers
> starting up at the same time and coming up with the same random 32-bit
> identifier should be rather low.
> 
> This does change the interface names from nice low integers to random larger
> integers, but I don't see that an issue.  And the caller can select any
> other name they like if that's not acceptable.

I think having 20 digit NICs names is pretty fugly. It is possible to
address the race condition by re-trying creation with new names. I will
post patches todo this.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]