Feng Shaobao
cdc78f7760
split async and sync codes for runc-shim and shim
...
Signed-off-by: Feng Shaobao <fshb1988@gmail.com>
2022-03-07 22:34:51 +08:00
Feng Shaobao
777fe2ad23
support async feature for runc shim
...
Signed-off-by: Feng Shaobao <fshb1988@gmail.com>
2022-03-07 16:38:19 +08:00
Feng Shaobao
01f4916f95
shim: Support async traits and helper functions
...
Signed-off-by: Feng Shaobao <fshb1988@gmail.com>
2022-03-07 15:33:49 +08:00
Maksym Pavlenko
3aa4a4da77
Merge pull request #48 from Burning1020/shim-cgroup
...
runc-shim: support shim cgroup and oom score
2022-03-05 14:50:42 -08:00
Zhang Tianyang
4e1c3a2a69
runc-shim: support shim cgroup and oom score
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-03-04 15:47:29 +08:00
Zhang Tianyang
fda23cd59f
shim: refine set subreaper
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-03-03 20:46:01 +08:00
Zhang Tianyang
a06ec3df2d
runc-shim: implement pids task
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-03-01 19:04:12 +08:00
Zhang Tianyang
3ffe778e4b
runc-shim: implement close io task
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-03-01 19:02:31 +08:00
Zhang Tianyang
dd90a9180f
runc: Set piped stdio as default
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-28 21:36:03 +08:00
Zhang Tianyang
cdb93f2358
runc-shim: implement update task
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-27 18:12:33 +08:00
Zhang Tianyang
9b93f39ee1
runc-shim: implement stats task
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-27 18:12:33 +08:00
Maksym Pavlenko
c630c56e57
Merge pull request #41 from mxpv/exit
...
Rework exit signals and task creation
2022-02-25 12:30:37 -08:00
Maksym Pavlenko
fa0d72f516
Fix clippy warnings
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-24 11:46:22 -08:00
Maksym Pavlenko
996c8e6aa8
Rework exit signal and task creation
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-24 11:32:34 -08:00
Liu Jiang
33e940b9c8
runc: refine the way to setup Io
...
Refine the way to setup Io drivers for runC.
The capability to capture output/error messages from runc depends on
the Io driver used. Some add two more Io drivers: InheritedStdIo and
PipedStdIo. Also document whether the Io driver supports capturing
output/error messages.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:47:08 +08:00
Liu Jiang
41c2083eac
runc: simple syntax improvments
...
Simple syntax only improvements.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:38 +08:00
Liu Jiang
fc50adf2dc
runc: implement sync version of ps() and stats()
...
Implement sync version of ps() and stats().
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:37 +08:00
Liu Jiang
95cda30597
runc: fix two bugs in preparing command line arguments
...
1) it should use "runc resume" instead of "runc pause" for resume()
2) the order of arguments to run() is wrong, other options may appear
between "--bundle" and "bundle_id".
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:36 +08:00
Liu Jiang
6c6fa1ac09
runc: make async version of Runc::create() to return Response
...
Make async version of Runc::create() to return `Response` instead of
`()`, to keep symmetry with sync version.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:35 +08:00
Liu Jiang
f5f18ec52b
runc: avoid unwrap() in runc::launch()
...
In runc::launch(), it does
let stdout = String::from_utf8(result.stdout).unwrap();
let stderr = String::from_utf8(result.stderr).unwrap();
This is risk of DoS attack because the content result.stdout/sterr may
contain contents generated by the container, so it may contain malicious
non-UTF8 characters.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-24 18:46:33 +08:00
Maksym Pavlenko
fa766d4e75
Merge pull request #38 from Burning1020/fix-files-leak
2022-02-23 15:47:37 -08:00
Zhang Tianyang
b08e4090ea
runc: fix bug that exec command leaks files
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-23 21:16:16 +08:00
Liu Jiang
43f4702b7a
shim-proto: group common proto types into types
...
Group generated soruce files for common protobuf source files into
src/types, also simplify the build.rs.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Signed-off-by: Quanwei Zhou <quanweiZhou@linux.alibaba.com>
2022-02-23 16:39:09 +08:00
Maksym Pavlenko
78521c80bf
Remove runc dependency from shim crate
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-21 10:26:19 -08:00
Maksym Pavlenko
a1b2a25987
Update Cargo.toml for runc-shim
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-21 09:59:16 -08:00
Maksym Pavlenko
03496c936b
Merge pull request #34 from quanweiZhou/develop
...
support async for containerd-shim-protos
2022-02-21 09:52:01 -08:00
Quanwei Zhou
c4471c4cbf
shim-proto: add async example
...
Fixes : #33
Signed-off-by:Quanwei Zhou <quanweiZhou@linux.alibaba.com>
2022-02-21 18:10:12 +08:00
Quanwei Zhou
6e50c8741c
shim-proto: support async
...
Fixes : #33
Signed-off-by: Quanwei Zhou <quanweiZhou@linux.alibaba.com>
2022-02-21 16:52:45 +08:00
Zhang Tianyang
117263d9be
Move Io and Console
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-17 23:06:35 +08:00
Zhang Tianyang
db4e648261
Simpify Config transmission mode
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-17 23:02:26 +08:00
Zhang Tianyang
620ce26d59
Remove extern use and refactor naming
...
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-17 23:02:26 +08:00
Zhang Tianyang
0a33f3e867
Runc shim implementation
...
Implement shim cli commands and some basic task APIs to run a runc container
Co-authored-by: Feng Shaobao fshb1988@gmail.com
Co-authored-by: Zhang Tianyang burning9699@gmail.com
Co-authored-by: Yu Qitao yuqitao1024@qq.com
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
2022-02-17 23:02:14 +08:00
Maksym Pavlenko
464af70dfa
Remove IO impl for Arc
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-15 10:44:18 -08:00
Liu Jiang
d453f1e38a
runc: implement Io for Arc<T: Io>
...
Add an implementation of `impl<T: Io> Io for Arc<T>`.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 14:08:13 +08:00
Liu Jiang
0dc9705d7e
runc: add unit test cases for io.rs
...
Add unit test cases for io.rs to avoid mistake.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 14:08:12 +08:00
Liu Jiang
a52bcd0c7e
runc: add helper PipedIo::create_pipe()
...
Add helper PipedIo::create_pipe() to reduce duplicated code.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 14:08:11 +08:00
Liu Jiang
be8046e832
runc: simplify code a bit and refine doc
...
Simplify code in io.rs a bit, also refine doc and simplify code.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 14:08:10 +08:00
Liu Jiang
8c2a61a807
runc: introduce helper function execute()
...
Introduce helper function monitor.rs::execute() to avoid duplicated
code, and also correctly setup stdout/stderr for ProcessMonitor.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 11:15:33 +08:00
Liu Jiang
cd965aa06a
runc: avoid panic when the child process get signalled
...
On Unix, tokio::process::ExitStatus::code() will return None if the
process was terminated by a signal. So handle to avoid panicking
caused by unwrap().
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 11:15:31 +08:00
Liu Jiang
8f20cfb58c
runc: add test cases for process monitor
2022-02-15 11:15:27 +08:00
Liu Jiang
37975426b9
runc: enhance documentation for ProcessMonitor
...
Enhance documentation for ProcessMonitor, to explicitly state the
requirement of ProcessMonitor::start().
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-15 11:15:26 +08:00
Maksym Pavlenko
7a55e0f11b
Merge pull request #30 from jiangliu/globalotps
...
RFC: Refactor ConfigBuilder as GlobalOpts
2022-02-14 10:39:19 -08:00
Liu Jiang
8e86897ee9
shim-proto: avoid duplicated definition of Mount
...
There are two copies of mount.rs generated from the same protobuf file,
so unify them into one copy.
Fixed : #23
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 17:41:37 +08:00
Liu Jiang
d170d62326
runc: add a unit test case for GlobalOpts
...
Add a unit test case for GlobalOpts.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 16:57:05 +08:00
Liu Jiang
4b3efbc875
runc: move runc commandline constants into options.rs
...
Move runc commandline related constants into options.rs, so options.rs
hosts all commandline parsing related code. And util.rs only hosts
utilities.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 16:57:04 +08:00
Liu Jiang
cfdbb4dbcd
runc: rename ConfigBuilder as GlobalOpts and moves it into options.rs
...
Rename ConfigBuilder as GlobalOpts and moves it into options.rs,
to follow the runc man pages.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 16:48:08 +08:00
Liu Jiang
2cba19f230
runc: avoid using unwrap() in util.rs
...
Introduce helper path_to_string() to avoid using unwrap().
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-14 16:48:08 +08:00
Maksym Pavlenko
ab45a92d6d
Add async feature
...
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-02-13 14:23:16 -08:00
Maksym Pavlenko
0c6ca068ed
Merge pull request #26 from jiangliu/doc
2022-02-12 08:44:33 -08:00
Liu Jiang
f1b90cc9b2
shim: add inline doc for set_subreaper() and SOCKET_FD
...
As follow-on work, add inline documentation for set_reapder(#19 )
and SOCKET_FD (#20 ).
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
2022-02-12 16:25:10 +08:00