cleanup: do not send reply message in hyper_shutdown

make hyper_shutdown interface more clearer.
Do the reply in hyper_pod_destroyed.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
This commit is contained in:
Gao feng
2016-09-20 04:35:30 -04:00
parent ff845ee371
commit 98262e7e50
5 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -731,7 +731,7 @@ static int hyper_release_exec(struct hyper_exec *exec,
if (pod->type == DESTROYPOD) {
/* shutdown vm manually, hyper doesn't care the pod finished codes */
hyper_shutdown(0);
hyper_pod_destroyed(0);
} else {
/* send out pod finish message, hyper will decide if restart pod or not */
hyper_send_pod_finished(pod);
+1
View File
@@ -91,6 +91,7 @@ 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);
extern struct hyper_pod global_pod;
extern struct hyper_ctl ctl;
+7 -1
View File
@@ -519,11 +519,17 @@ static void hyper_print_uptime(void)
close(fd);
}
void hyper_pod_destroyed(int failed)
{
hyper_send_msg_block(ctl.chan.fd, failed?ERROR:ACK, 0, NULL);
hyper_shutdown();
}
static int hyper_destroy_pod(struct hyper_pod *pod, int error)
{
if (pod->init_pid == 0) {
/* Pod stopped, just shutdown */
hyper_shutdown(error);
hyper_pod_destroyed(error);
} else {
/* Kill pod */
hyper_term_all(pod);
+1 -2
View File
@@ -673,9 +673,8 @@ static void hyper_unmount_all(void)
sync();
}
void hyper_shutdown(int error)
void hyper_shutdown()
{
hyper_send_msg_block(ctl.chan.fd, error?ERROR:ACK, 0, NULL);
hyper_unmount_all();
reboot(LINUX_REBOOT_CMD_POWER_OFF);
}
+1 -1
View File
@@ -35,7 +35,7 @@ int hyper_setfd_cloexec(int fd);
int hyper_setfd_block(int fd);
int hyper_setfd_nonblock(int fd);
int hyper_socketpair(int domain, int type, int protocol, int sv[2]);
void hyper_shutdown(int ack);
void hyper_shutdown();
int hyper_insmod(char *module);
struct passwd *hyper_getpwnam(const char *name);
struct group *hyper_getgrnam(const char *name);