Merge pull request #27 from gao-feng/restartPolicy

remove the codes of restart pod
This commit is contained in:
Gao feng
2015-11-12 16:16:30 +08:00
3 changed files with 5 additions and 20 deletions
+4 -17
View File
@@ -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;
}
-2
View File
@@ -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;
+1 -1
View File
@@ -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));