mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-08-19 12:26:06 +00:00
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:
+1
-1
@@ -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);
|
||||
|
||||
@@ -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
@@ -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
@@ -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
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user