[lxc-devel] lxc-1.0.0 reboot error

Vitaly Lavrov vel21ripn at gmail.com
Sat Feb 22 11:46:22 UTC 2014


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.

-------------- next part --------------
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);
 	}
 }


More information about the lxc-devel mailing list