Commit Graph

472 Commits

Author SHA1 Message Date
Lai Jiangshan 1fda991fee move hyper_kill_container_processes() up
hyper_kill_container_processes() depends on container->ns,
but hyper_release_exec() may calls hyper_cleanup_pod() which
calls hyper_cleanup_containers() and then hyper_cleanup_container(),
and container->ns is closed in hyper_cleanup_container().
It cause hyper_kill_container_processes() failed to
stat the container->ns.

[root@box ~]# grep 'fail to stat mnt ns' /var/log/hyper/ -rIn -l
/var/log/hyper/hyperd.sbox.root.log.INFO.20160923-231500.17245
/var/log/hyper/hyperd.sbox.root.log.INFO.20160925-100719.3091
/var/log/hyper/hyperd.sbox.root.log.INFO.20160925-104216.3720
/var/log/hyper/hyperd.sbox.root.log.INFO.20160925-195450.8766
/var/log/hyper/hyperd.sbox.root.log.INFO.20160926-150357.7493
/var/log/hyper/hyperd.sbox.root.log.INFO.20160926-151213.10722
/var/log/hyper/hyperd.sbox.root.log.INFO.20160926-151555.13867
/var/log/hyper/hyperd.sbox.root.log.INFO.20160926-152510.22823
/var/log/hyper/hyperd.sbox.root.log.INFO.20160926-171120.2454
/var/log/hyper/hyperd.sbox.root.log.INFO.20160926-174512.3308
/var/log/hyper/hyperd.sbox.root.log.INFO.20160928-153012.27740
/var/log/hyper/hyperd.sbox.root.log.INFO.20160929-214026.17673
/var/log/hyper/hyperd.sbox.root.log.INFO.20160929-222011.18735
/var/log/hyper/hyperd.sbox.root.log.INFO.20161001-004225.5899
[root@box ~]# grep 'fail to stat mnt ns' /var/log/hyper/ -rIn -l | wc
     14      14     875

it can be triggered via 'hyperctl run -t ubuntu' and then 'exit'
in the shell of the container.

so we have to swap the order of hyper_kill_container_processes
and hyper_release_exec().

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-10-02 21:28:14 +08:00
Lai Jiangshan 9077cf47b3 Merge pull request #199 from laijs/rename
rename stdio related functions
2016-10-02 20:36:48 +08:00
Lai Jiangshan ac4d6d8fc7 rename stdio related functions
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-10-01 00:59:42 +08:00
Lai Jiangshan cb680e280d Merge pull request #195 from laijs/stdio_config
add struct stdio_config for fds
2016-10-01 00:41:25 +08:00
Lai Jiangshan 83c3c1d424 add struct stdio_config for fds
directly close init/exec process stdio fds at the end of
hyper_run_process().

move exec->std*ev code into hyper_watch_exec_pty().

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-29 22:28:27 +08:00
Lai Jiangshan 9cd968e2d2 move hyper_watch_exec_pty() after get the process pid
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-29 20:13:53 +08:00
Lai Jiangshan 290217c87a Merge pull request #193 from laijs/remove-unused-hyper_cleanup_exec
Remove unused hyper_cleanup_exec()
2016-09-29 11:49:30 +08:00
Gao feng 39c027e58c Merge pull request #192 from laijs/no-EPOLLPRI
remove the usage of EPOLLPRI
2016-09-28 03:37:30 -04:00
Lai Jiangshan 22cfaea4d2 remove block out from send_exec_finishing()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-28 15:36:59 +08:00
Lai Jiangshan e3704f66ba remove unused hyper_cleanup_exec()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-28 15:36:59 +08:00
Lai Jiangshan 8ac18bf650 remove the usage of EPOLLPRI
partially revert 9a6738d8

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-28 12:17:04 +08:00
Lai Jiangshan d63f716523 Merge pull request #190 from laijs/exec-ref-pod
add pod field in struct hyper_exec
2016-09-27 17:07:04 +08:00
Lai Jiangshan 1973768704 add pod field in struct hyper_exec
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-26 21:04:31 +08:00
Lai Jiangshan 4011640b08 Merge pull request #189 from laijs/symlink-EEXIST
ignore the errno EEXIST when symlink for /dev/fd & /dev/std*
2016-09-26 18:21:14 +08:00
Lai Jiangshan db6f286244 ignore the errno EEXIST when symlink for /dev/fd & /dev/std*
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-26 17:51:49 +08:00
Lai Jiangshan b2e7a0f631 Merge pull request #188 from laijs/check-result
check the return value of the functions declared with warn_unused_result
2016-09-26 15:19:53 +08:00
Lai Jiangshan f4ad330a75 Merge pull request #187 from laijs/exec-cid-cleanup
cleanups for exec-id
2016-09-26 15:15:31 +08:00
Lai Jiangshan 54f5362a03 check the return value of the functions declared with warn_unused_result
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-25 19:58:29 +08:00
Lai Jiangshan 45967cc8b8 rename exec->id to exec->container_id
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-25 10:28:21 +08:00
Lai Jiangshan 728d02983e remove local variable path
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-25 10:12:31 +08:00
Lai Jiangshan 4e830d77b4 check exec->seq and exec->id earlier
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-25 10:08:21 +08:00
Lai Jiangshan 2a669f0558 Merge pull request #186 from laijs/stdio-cleanup
save ptymaster on exec->ptyfd and do some cleanups for stdio
2016-09-24 23:26:13 +08:00
Lai Jiangshan 5ed9195bf8 move setsid() out from hyper_install_process_stdio()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-23 23:25:13 +08:00
Lai Jiangshan 064879ff0a rename hyper_dup_exec_tty() to hyper_install_process_stdio()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-23 23:25:13 +08:00
Lai Jiangshan 2360c4dc3f use ptyslave instead of e->ptyfd to make code clean
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-23 23:25:13 +08:00
Lai Jiangshan da72799c96 close ptymaster when failed
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-23 23:25:13 +08:00
Lai Jiangshan 56198c3acd save ptymaster on ptyfd rather than pty slave
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-23 23:25:13 +08:00
Lai Jiangshan a07cabf2d0 Merge pull request #184 from gao-feng/status
shutdown vm immediately if no container remained
2016-09-23 14:36:35 +08:00
Lai Jiangshan 440e14cde4 Merge pull request #183 from laijs/check-close
check close before discarding the data
2016-09-23 13:21:21 +08:00
Lai Jiangshan 5b1b29593e check close before discarding the data
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-23 12:06:52 +08:00
Gao feng 519db047fb shutdown vm immediately if no container remained
Hyperstart may receive destroy-event after all of the
containers are exited, then hyper_destroy_pod will still
try to term all processes, but there are no container will
exit and trigger the sending out podfinished-event/ack-event
logic in hyper_release_exec.

Add exec to global list only after process is running,
And add remains after container is running.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-09-23 11:39:24 +08:00
Lai Jiangshan 504218c41f Merge pull request #179 from laijs/event-read
event read handling refactor part1
2016-09-22 23:21:08 +08:00
Lai Jiangshan c0e8d92d9a Merge pull request #180 from crook/master
remove unexpectedly cd ..
2016-09-21 21:34:10 +08:00
Lai Jiangshan be7654b416 remove the unused struct hyper_event_ops::len_offset
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 21:26:09 +08:00
Lai Jiangshan 1cf932a784 introduce CONTROL_HEADER_SIZE & CONTROL_HEADER_LENGTH_OFFSET
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 21:24:56 +08:00
Lai Jiangshan 5c30a49c27 introduce STREAM_HEADER_SIZE & STREAM_HEADER_LENGTH_OFFSET
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 20:41:02 +08:00
Ray Chen 4b662dd4fa remove unexpectedly cd .. 2016-09-21 20:34:06 +08:00
Lai Jiangshan 13a58d6531 Merge pull request #178 from gao-feng/rename
some cleanup
2016-09-21 20:18:13 +08:00
Lai Jiangshan ecf00fc578 remove the unused struct hyper_event_ops::handle
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 18:38:17 +08:00
Lai Jiangshan 819f639334 directly call hyper_channel_handle() in hyper_channel_read()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 18:36:10 +08:00
Lai Jiangshan cdc84ecb4b remove the unused struct hyper_event_ops::ack
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 18:33:22 +08:00
Lai Jiangshan 9d7a6c0a0f remove hyper_event_read()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 18:22:04 +08:00
Lai Jiangshan d9e871409e introduce hyper_channel_read()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 18:13:36 +08:00
Lai Jiangshan bb5c2c5744 call hyper_ttyfd_handle() directly in hyper_ttyfd_read()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 17:08:43 +08:00
Lai Jiangshan 2f2be98cff introduce hyper_ttyfd_read()
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 16:59:33 +08:00
Lai Jiangshan 28ea806216 introduce nonblock_read()
and call it in hyper_event_read()

Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2016-09-21 16:59:18 +08:00
Gao feng 8c45a5d6fe rename type to req_destroy
The only usage of type is to identify if the pod
is destroyed by manually.

set the req_destroy inside the switch, this prevents
the other events overwriting this field.

Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-09-20 21:22:53 +08:00
Gao feng 98262e7e50 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>
2016-09-20 21:22:51 +08:00
Gao feng ff845ee371 cleanup: remove restart policy type
Signed-off-by: Gao feng <omarapazanadi@gmail.com>
2016-09-20 21:17:34 +08:00
Lai Jiangshan 6224d6b779 Merge pull request #173 from gao-feng/cleanup
typo: fix debug message
2016-09-20 10:49:39 +08:00