[lxc-devel] lxc-1.0.0 reboot error

Serge Hallyn serge.hallyn at ubuntu.com
Mon Feb 24 14:28:16 UTC 2014


Quoting Stéphane Graber (stgraber at ubuntu.com):
> Hi,
> 
> Thanks for your patch.
> 
> Can I just ask you to sign it off? (Signed-off-by: Name <email>)

Without looking at the context, can you also give, in the patch
description, your best understanding of under which conditions
ifindex can be 0 in those two hunks?  Have you tested this with
other network and netif types (phys device;  EMPTY and NONE
netns)?

> Thanks.
> 
> On Sat, Feb 22, 2014 at 03:46:22PM +0400, Vitaly Lavrov wrote:
> > if you try to reboot the container having a network interface type vlan, then the container will be halted.
> > 
> > Tested on kernels 3.10.x and 3.12.x
> > 
> > Suggest a patch to fix this problem and fix warnings for network interfaces type veth.
> > 
> 
> > diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> > index 046d8dd..f4d4f54 100644
> > --- a/src/lxc/conf.c
> > +++ b/src/lxc/conf.c
> > @@ -2910,9 +2910,11 @@ static int instanciate_vlan(struct lxc_handler *handler, struct lxc_netdev *netd
> >  
> >  	err = lxc_vlan_create(netdev->link, peer, netdev->priv.vlan_attr.vid);
> >  	if (err) {
> > -		ERROR("failed to create vlan interface '%s' on '%s' : %s",
> > -		      peer, netdev->link, strerror(-err));
> > -		return -1;
> > +		if(!(handler->conf->reboot && err == -EEXIST)) {
> > +			ERROR("failed to create vlan interface '%s' on '%s' : %s",
> > +			      peer, netdev->link, strerror(-err));
> > +			return -1;
> > +		}
> >  	}
> >  
> >  	netdev->ifindex = if_nametoindex(peer);
> > @@ -3089,13 +3091,15 @@ void lxc_delete_network(struct lxc_handler *handler)
> >  		if (netdev_deconf[netdev->type](handler, netdev)) {
> >  			WARN("failed to destroy netdev");
> >  		}
> > +		if (!netdev->ifindex) continue;
> > +		if ( netdev->type == LXC_NET_VLAN || netdev->type == LXC_NET_VETH) 
> > +			continue;
> >  
> >  		/* Recent kernel remove the virtual interfaces when the network
> >  		 * namespace is destroyed but in case we did not moved the
> >  		 * interface to the network namespace, we have to destroy it
> >  		 */
> > -		if (netdev->ifindex != 0 &&
> > -		    lxc_netdev_delete_by_index(netdev->ifindex))
> > +		if (lxc_netdev_delete_by_index(netdev->ifindex))
> >  			WARN("failed to remove interface '%s'", netdev->name);
> >  	}
> >  }
> 
> > _______________________________________________
> > lxc-devel mailing list
> > lxc-devel at lists.linuxcontainers.org
> > http://lists.linuxcontainers.org/listinfo/lxc-devel
> 
> 
> -- 
> Stéphane Graber
> Ubuntu developer
> http://www.ubuntu.com



> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel



More information about the lxc-devel mailing list