]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: Fix net iface remaining issue 2559/head 2628/head
authorJungsub Shin <supsup5642@gmail.com>
Tue, 21 Aug 2018 10:21:59 +0000 (19:21 +0900)
committerJungsub Shin <supsup5642@gmail.com>
Tue, 21 Aug 2018 10:21:59 +0000 (19:21 +0900)
When creating container that has multiple net ifaces fails
because of wrong net config, lxc doesn't remove previously created
net ifaces.

Solve this issue with changing return path in lxc_spawn().

Signed-off-by: Jungsub Shin jungsub_shin@tmax.co.kr
src/lxc/start.c

index 35a2bed04864b5aef547caf09d8c0f99de548be8..967d23c1bbdd75886c5b5e06dd246f382290c25e 100644 (file)
@@ -1662,6 +1662,20 @@ static int lxc_spawn(struct lxc_handler *handler)
                return -1;
        }
 
+       if (conf->shmount.path_host) {
+               if (!conf->shmount.path_cont) {
+                       lxc_sync_fini(handler);
+                       return -1;
+               }
+
+               ret = lxc_setup_shmount(conf);
+               if (ret < 0) {
+                       ERROR("Failed to setup shared mount point");
+                       lxc_sync_fini(handler);
+                       return -1;
+               }
+       }
+
        if (handler->ns_clone_flags & CLONE_NEWNET) {
                if (!lxc_list_empty(&conf->network)) {
 
@@ -1683,26 +1697,11 @@ static int lxc_spawn(struct lxc_handler *handler)
                        ret = lxc_create_network_priv(handler);
                        if (ret < 0) {
                                ERROR("Failed to create the network");
-                               lxc_sync_fini(handler);
-                               return -1;
+                               goto out_delete_net;
                        }
                }
        }
 
-       if (conf->shmount.path_host) {
-               if (!conf->shmount.path_cont) {
-                       lxc_sync_fini(handler);
-                       return -1;
-               }
-
-               ret = lxc_setup_shmount(conf);
-               if (ret < 0) {
-                       ERROR("Failed to setup shared mount point");
-                       lxc_sync_fini(handler);
-                       return -1;
-               }
-       }
-
        if (!cgroup_init(handler)) {
                ERROR("Failed initializing cgroup support");
                goto out_delete_net;