[lxc-devel] lxc-1.0.0 reboot error

Vitaly Lavrov vel21ripn at gmail.com
Tue Feb 25 09:51:18 UTC 2014


On 23.02.2014 03:36, Stéphane Graber wrote:
> Hi,
>
> Thanks for your patch.
>
> Can I just ask you to sign it off? (Signed-off-by: Name <email>)
Hi!

I found the source of the problem with a reboot of the container, but do not know how best to fix it.
We have a race condition between the end of the old container and the creation of the network interfaces
in the new container. Insert usleep (100000) before lxc_delete_network() solves the problem with a reboot,
but it's a bad way.

How to wait until the completion of the container?

> 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
>
>
>
>
> _______________________________________________
> 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