diff --git a/src/exec.c b/src/exec.c index cbd1a5a..ae4e5de 100644 --- a/src/exec.c +++ b/src/exec.c @@ -545,9 +545,6 @@ int hyper_release_exec(struct hyper_exec *exec, fprintf(stdout, "%s container init exited, type %d, remains %d, policy %d\n", __func__, pod->type, pod->remains, pod->policy); - if (exec->code) - pod->code = exec->code; - if (exec->init == 2) { // dynamic container struct hyper_container *c = container_of(exec, struct hyper_container, exec); // TODO send finish of this container and full cleanup @@ -560,26 +557,16 @@ int hyper_release_exec(struct hyper_exec *exec, if (--pod->remains > 0) return 0; - /* stop pod, should not restart container */ if (pod->type == STOPPOD) { + /* stop pod manually */ hyper_send_type(ctl.chan.fd, ACK); - hyper_cleanup_pod(pod); - return 0; - } - /* should shutdown? */ - if (pod->policy == POLICY_NEVER || - ((pod->policy == POLICY_ONFAILURE) && pod->code == 0)) { + } else { + /* send out pod finish message, hyper will decide if restart pod or not */ hyper_send_finish(pod); - hyper_cleanup_pod(pod); - return 0; - } - - if (hyper_start_containers(pod) < 0) { - fprintf(stderr, "restart container failed\n"); - return -1; } + hyper_cleanup_pod(pod); return 0; } diff --git a/src/hyper.h b/src/hyper.h index f7344b4..f4f45bf 100644 --- a/src/hyper.h +++ b/src/hyper.h @@ -43,7 +43,6 @@ struct hyper_pod { char **dns; struct list_head dyn_containers; struct list_head exec_head; - //struct list_head ce_head; char *hostname; char *share_tag; int init_pid; @@ -53,7 +52,6 @@ struct hyper_pod { uint32_t e_num; uint32_t d_num; uint32_t type; - uint32_t code; uint32_t remains; uint8_t policy; int efd; diff --git a/src/parse.c b/src/parse.c index 7ca28c2..621379d 100644 --- a/src/parse.c +++ b/src/parse.c @@ -575,7 +575,7 @@ struct hyper_container *hyper_parse_new_container(struct hyper_pod *pod, char *j jsmn_parser p; int toks_num = 100; jsmntok_t *toks = NULL; - struct hyper_container *c; + struct hyper_container *c = NULL; realloc: toks = realloc(toks, toks_num * sizeof(jsmntok_t));