Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/container.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,13 +778,3 @@ void hyper_cleanup_container(struct hyper_container *c, struct hyper_pod *pod)
hyper_cleanup_container_portmapping(c, pod);
hyper_free_container(c);
}

void hyper_cleanup_containers(struct hyper_pod *pod)
{
struct hyper_container *c, *n;

list_for_each_entry_safe(c, n, &pod->containers, list)
hyper_cleanup_container(c, pod);

pod->remains = 0;
}
1 change: 0 additions & 1 deletion src/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ struct hyper_pod;
int hyper_setup_container(struct hyper_container *container, struct hyper_pod *pod);
struct hyper_container *hyper_find_container(struct hyper_pod *pod, const char *id);
void hyper_cleanup_container(struct hyper_container *container, struct hyper_pod *pod);
void hyper_cleanup_containers(struct hyper_pod *pod);
void hyper_free_container(struct hyper_container *c);

static inline int hyper_has_container(struct hyper_pod *pod, const char *id) {
Expand Down
7 changes: 1 addition & 6 deletions src/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,16 +715,11 @@ static int hyper_release_exec(struct hyper_exec *exec)
fprintf(stdout, "%s container init exited %s, remains %d\n",
__func__, exec->pod->req_destroy?"manually":"automatically", exec->pod->remains);

// TODO send finish of this container and full cleanup
if (--exec->pod->remains > 0)
return 0;

if (exec->pod->req_destroy) {
if (--exec->pod->remains == 0 && exec->pod->req_destroy) {
/* shutdown vm manually, hyper doesn't care the pod finished codes */
hyper_pod_destroyed(0);
}

hyper_cleanup_pod(exec->pod);
return 0;
}

Expand Down
1 change: 0 additions & 1 deletion src/hyper.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ static inline int hyper_create(char *hyper_path)
}

int hyper_open_serial(char *tty);
void hyper_cleanup_pod(struct hyper_pod *pod);
int hyper_enter_sandbox(struct hyper_pod *pod, int pidpipe);
void hyper_pod_destroyed(int failed);
int hyper_ctl_append_msg(struct hyper_event *he, uint32_t type, uint8_t *data, uint32_t len);
Expand Down
41 changes: 0 additions & 41 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -887,47 +887,6 @@ static void hyper_cmd_online_cpu_mem()
}
}

static void hyper_cleanup_hostname(struct hyper_pod *pod)
{
free(pod->hostname);
pod->hostname = NULL;
}

static void hyper_cleanup_shared(struct hyper_pod *pod)
{
if (pod->share_tag == NULL) {
fprintf(stdout, "no shared directory\n");
return;
}

free(pod->share_tag);
pod->share_tag = NULL;
if (umount(SHARED_DIR) < 0 &&
umount2(SHARED_DIR, MNT_DETACH)) {
perror("fail to umount shared dir");
return;
}

if (rmdir(SHARED_DIR) < 0)
perror("fail to delete " SHARED_DIR);

sync();
}

void hyper_cleanup_pod(struct hyper_pod *pod)
{
if (pod->init_pid) {
hyper_kill_process(pod->init_pid);
pod->init_pid = 0;
}
hyper_cleanup_containers(pod);
hyper_cleanup_network(pod);
hyper_cleanup_shared(pod);
hyper_cleanup_dns(pod);
hyper_cleanup_portmapping(pod);
hyper_cleanup_hostname(pod);
}

static int hyper_setup_ctl_channel(char *name)
{
uint8_t buf[8];
Expand Down
Loading