Skip to content

Commit

Permalink
start: Fix net iface remaining issue
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ssup2 committed Aug 21, 2018
1 parent 501751d commit 78852a0
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/lxc/start.c
Expand Up @@ -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)) {

Expand All @@ -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;
Expand Down

0 comments on commit 78852a0

Please sign in to comment.