From ff845ee371b026a14728e52002d768ab2106573a Mon Sep 17 00:00:00 2001 From: Gao feng Date: Tue, 20 Sep 2016 03:42:59 -0400 Subject: [PATCH] cleanup: remove restart policy type Signed-off-by: Gao feng --- src/exec.c | 4 ++-- src/hyper.h | 7 ------- src/parse.c | 11 ++--------- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/src/exec.c b/src/exec.c index 8ee3f52..8dba5d1 100644 --- a/src/exec.c +++ b/src/exec.c @@ -722,8 +722,8 @@ static int hyper_release_exec(struct hyper_exec *exec, fprintf(stdout, "%s exit code %" PRIu8"\n", __func__, exec->code); if (exec->init) { - fprintf(stdout, "%s container init exited, type %d, remains %d, policy %d\n", - __func__, pod->type, pod->remains, pod->policy); + fprintf(stdout, "%s container init exited, type %d, remains %d\n", + __func__, pod->type, pod->remains); // TODO send finish of this container and full cleanup if (--pod->remains > 0) diff --git a/src/hyper.h b/src/hyper.h index 95e06ca..f9cc494 100644 --- a/src/hyper.h +++ b/src/hyper.h @@ -18,12 +18,6 @@ /* Path to rootfs shared directory */ #define SHARED_DIR "/tmp/hyper/shared" -enum { - POLICY_NEVER, - POLICY_ALWAYS, - POLICY_ONFAILURE, -}; - struct hyper_pod { struct hyper_interface *iface; struct hyper_route *rt; @@ -40,7 +34,6 @@ struct hyper_pod { uint32_t type; /* how many containers are running */ uint32_t remains; - uint8_t policy; int efd; }; diff --git a/src/parse.c b/src/parse.c index 64d614a..7c4c434 100644 --- a/src/parse.c +++ b/src/parse.c @@ -1146,8 +1146,6 @@ realloc: goto out; } - pod->policy = POLICY_NEVER; - fprintf(stdout, "jsmn parse successed, n is %d\n", n); next = 0; for (i = 0; i < n;) { @@ -1193,13 +1191,8 @@ realloc: fprintf(stdout, "hostname is %s\n", pod->hostname); i++; } else if (json_token_streq(json, t, "restartPolicy") && t->size == 1) { - i++; - if (json_token_streq(json, &toks[i], "always") && toks[i].size == 1) - pod->policy = POLICY_ALWAYS; - else if (json_token_streq(json, &toks[i], "onFailure") && toks[i].size == 1) - pod->policy = POLICY_ONFAILURE; - fprintf(stdout, "restartPolicy is %" PRIu8 "\n", pod->policy); - i++; + i += 2; + fprintf(stdout, "restartPolicy is deprecated\n"); } else if (json_token_streq(json, t, "portmappingWhiteLists") && t->size == 1) { next = hyper_parse_portmapping_whitelist(pod, json, &toks[++i]); if (next < 0)