mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-09-03 20:21:47 +00:00
Merge pull request #27 from gao-feng/restartPolicy
remove the codes of restart pod
This commit is contained in:
+4
-17
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user