@@ -524,6 +524,29 @@ int hyper_exec_cmd(char *json, int length)
524524 goto out ;
525525}
526526
527+ static int hyper_send_pod_finished (struct hyper_pod * pod )
528+ {
529+ int ret = -1 ;
530+ struct hyper_container * c ;
531+ uint8_t * data = NULL , * new ;
532+ int c_num = 0 ;
533+
534+ list_for_each_entry (c , & pod -> containers , list ) {
535+ c_num ++ ;
536+ new = realloc (data , c_num * 4 );
537+ if (new == NULL )
538+ goto out ;
539+
540+ hyper_set_be32 (new + ((c_num - 1 ) * 4 ), c -> exec .code );
541+ data = new ;
542+ }
543+
544+ ret = hyper_send_msg_block (ctl .chan .fd , PODFINISHED , c_num * 4 , data );
545+ out :
546+ free (data );
547+ return ret ;
548+ }
549+
527550int hyper_release_exec (struct hyper_exec * exec ,
528551 struct hyper_pod * pod )
529552{
@@ -550,8 +573,11 @@ int hyper_release_exec(struct hyper_exec *exec,
550573 return 0 ;
551574
552575 if (pod -> type == STOPPOD ) {
553- /* stop pod manually */
576+ /* stop pod manually, hyper doesn't care the pod finished codes */
554577 hyper_send_msg_block (ctl .chan .fd , ACK , 0 , NULL );
578+ } else if (pod -> type == DESTROYPOD ) {
579+ /* shutdown vm manually, hyper doesn't care the pod finished codes */
580+ hyper_shutdown ();
555581 } else {
556582 /* send out pod finish message, hyper will decide if restart pod or not */
557583 hyper_send_pod_finished (pod );
@@ -562,7 +588,6 @@ int hyper_release_exec(struct hyper_exec *exec,
562588 }
563589
564590 hyper_free_exec (exec );
565-
566591 return 0 ;
567592}
568593
0 commit comments