From 98b8211ddc1f30cc20d5780cbdde5895759e2f7c Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Wed, 6 Jul 2016 15:52:12 +0800 Subject: [PATCH] move hyper_start_containers() to hyper_start_pod() Signed-off-by: Lai Jiangshan --- src/init.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/init.c b/src/init.c index b40e686..27f22c8 100644 --- a/src/init.c +++ b/src/init.c @@ -414,7 +414,7 @@ int hyper_start_containers(struct hyper_pod *pod) return 0; } -static int hyper_setup_container(struct hyper_pod *pod) +static int hyper_setup_pod_init(struct hyper_pod *pod) { int stacksize = getpagesize() * 4; int flags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | @@ -461,11 +461,6 @@ static int hyper_setup_container(struct hyper_pod *pod) goto out; } - if (hyper_start_containers(pod) < 0) { - fprintf(stderr, "start containers failed\n"); - goto out; - } - ret = 0; out: close(arg.ctl_pipe[1]); @@ -587,7 +582,7 @@ static int hyper_setup_pod(struct hyper_pod *pod) return -1; } - if (hyper_setup_container(pod) < 0) { + if (hyper_setup_pod_init(pod) < 0) { fprintf(stderr, "start container failed\n"); return -1; } @@ -641,6 +636,12 @@ static int hyper_start_pod(char *json, int length) return -1; } + if (hyper_start_containers(pod) < 0) { + fprintf(stderr, "start containers failed\n"); + hyper_destroy_pod(pod); + return -1; + } + return 0; }