3879 Commits

Author SHA1 Message Date
Li Ning
2511cabbc3 virtcontainers: fix outdated example code in api document
Some type declarations were changed. The example code here is outdated
according to the example_pod_run_test.go under virtcontainers directory.
And add the imports to make where the types from clear.

Fixes: #507

Signed-off-by: Li Ning <lining_yewu@cmss.chinamobile.com>
2020-08-18 17:42:18 +08:00
Bin Liu
17e2a35cbe Merge pull request #509 from lifupan/fix_lo
agent: setup the "lo" interface run agent as init
2020-08-18 17:24:19 +08:00
fupan.lfp
5c7f0016fb rustjail: add the "HOME" env for process
When creating a container process/exec process, it should set the
"HOME" env for this process by getting from /etc/passwd.

Fixes: #498

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-08-17 22:15:45 +08:00
fupan.lfp
58dfd50317 rustjail: fix the issue of missing set propagation for bind mount
When do bind mount for container's volumes, the propagation
flags should be mount/set after bind mount.

Fixes: #530

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-08-17 21:15:43 +08:00
fupan.lfp
e79c57274b agent: setup the "lo" interface run agent as init
It should setup the "lo" interface when agent run
as init porcess.

Fixes: #508

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-08-17 20:52:12 +08:00
Julio Montes
d0a45637ba agent: add unit tests for rustjail/process.rs
Increase code coverage to 80.9%

fixes #285

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-08-14 09:31:48 -05:00
bin liu
e7d3ba12d0 virtcontainers: cleanup codes, delete not used APIs
Some APIs are not used anymore.

Fixes: #517

Signed-off-by: bin liu <bin@hyper.sh>
2020-08-13 15:28:09 +08:00
Hui Zhu
5231a3eddf Merge pull request #452 from cmaf/unit-virtcontainers-container
virtcontainers: Add unit test for types/container.go
2020-08-07 16:45:01 +08:00
Bin Liu
0a233ff4bd Merge pull request #440 from lifupan/2.0-dev
shimv2: fix the issue  of close IO stream
2020-08-07 11:28:44 +08:00
fupan.lfp
bd78ccaf31 shimv2: fix the issue of close IO stream
It should wait until the stdin io copy
termianted to close the process's io stream,
otherwise, it would miss forwarding some contents
to process stdin.

Fixes: #439

Signed-off-by: fupan.lfp <fupan.lfp@antgroup.com>
2020-08-05 21:26:31 +08:00
Tim Zhang
06834931a6 agent: Fix fd leaks in execute_hook
Fixes: #480

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-08-03 10:58:43 +08:00
Fabiano Fidêncio
ec84a94a61 Merge pull request #474 from merwick/2.0-dev
Kata 2.0-dev port of #2867 (NoReboot Knob)
2020-07-30 22:10:46 +02:00
Liam Merwick
c15ef219e5 qemu: Set govmmQemu NoReboot config Knob
The Kata architecture does not support rebooting VMs (the lifecycle
being start/exec/kill) and if a VM is killed (e.g. using sysrq-trigger),
the VM does not exit fully and other layers do not notice the state change.
Set the NoReboot config Knob so that govmmQemu.LaunchQemu() runs QEMU
with the --no-reboot command-line option.

Fixes: #2866

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2020-07-30 16:04:08 +01:00
Liam Merwick
5726926201 qemu: Add test for qemuConfig Knobs
Add TestQemuKnobs unit test to validate parameters passed to QEMU.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2020-07-30 16:04:05 +01:00
Liam Merwick
5010e3a368 vendor: update govmm
Bring support for '--no-reboot' QEMU parameter (intel/govmm#131)

shortlog:
qemu: Add NoReboot config Knob for qemuParams

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
2020-07-30 15:43:02 +01:00
Julio Montes
b94b46db08 Merge pull request #467 from jongwu/multidev
qemu: remove multidev in fsdev parameter on arm64
2020-07-30 08:07:59 -05:00
Julio Montes
3871b3c67c Merge pull request #469 from jongwu/makefile
Makefile: add CLHCMD in arm64-options.mk
2020-07-30 08:07:08 -05:00
Fupan Li
a3c300f06b Merge pull request #459 from liubin/feature/458-add-structured-log
runtime: change un-structured log to structured log
2020-07-30 17:26:18 +08:00
bin liu
61d133f941 runtime: change un-structured log to structured log
Change some logger from directly calling logrus to use a
logrus instance to use structured log.

Fixes: #458

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-30 16:07:41 +08:00
Chelsea Mafrica
31d601b772 Merge pull request #429 from cmaf/unit-virtcontainers-cap
virtcontainers: Add function to capabilities test
2020-07-29 15:15:25 -07:00
Chelsea Mafrica
7169a269e1 Merge pull request #425 from cmaf/unit-virtcontainers-asset
virtcontainers: Expand unit test coverage for asset
2020-07-29 15:02:41 -07:00
Chelsea Mafrica
f24ad25d7b virtcontainers: Add unit test for types/container.go
Add unit tests for types/container.go. Tests were adapted from
sandbox_test.go since ContainerState is a sandbox state structure and
the transition tests are the same.

Fixes #451

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-07-29 16:10:44 +00:00
Jianyong Wu
1637e9d367 qemu: remove multidev in qemu/fsdev parameter on arm64
As the current qemu of arm64 is so old, the new multidev parameter
in 9pfsdev is not supported on arm64, so disabled it temporarily.

Fixes:#466
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2020-07-29 18:05:37 +08:00
Jianyong Wu
b61c9ca25a Makefile: add CLHCMD in arm64-options.mk
As cloud-hypervisor has enabled for arm64, add CLHCMD in
arm64-options.mk

Fixes: #468
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2020-07-29 16:38:19 +08:00
Peng Tao
6fc7d4b238 Merge pull request #457 from liubin/feature/405-add-memory-info-for-kata-env
runtime: add CPU cores and memory basic info for `kata-env` sub-command
2020-07-29 09:45:03 +08:00
Julio Montes
d5d7c22d42 Merge pull request #460 from devimc/2020-07-27/update-qemu5
update to QEMU 5
2020-07-28 10:11:04 -05:00
bin liu
fe99e7e165 runtime: add CPU cores and memory basic info for kata-env sub-command
Add host memory size(Total/Free/Avaiable) and CPU cores in host info
for `kata-runtime kata-env`.

Fixes: #405

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-28 20:41:51 +08:00
Peng Tao
3246bdce7c Merge pull request #445 from liubin/fix/444-remove-docs-about-shim-proxy
docs: remove shim/proxy topics and fix docs links
2020-07-28 20:06:02 +08:00
Chelsea Mafrica
e1a79e6945 virtcontainers: Add function to capabilities test
Add function that tests multiqueue functions in types/capabilities.go.

Fixes #428

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-07-27 16:15:50 +00:00
Chelsea Mafrica
d1d5c69b64 virtcontainers: Expand unit test coverage for asset
Add additional test cases that cover more asset types and functions to
increase unit test coverage.

Fixes #424

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-07-27 16:14:41 +00:00
Gabriela Cervantes
1f8e4f67e1 docs: Update travis and go report card url
This PR fixes travis and go report carl url for the runtime README for kata
2.0

Fixes #432

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2020-07-27 10:39:42 -05:00
Julio Montes
3c415d93fe virtcontainers: 9p: shares multiple devices with only one export
Use 'remap' behaviour to deal with multiple devices being shared with
a 9p export.

Fixes the following warning:

```
9p: Multiple devices detected in same VirtFS export, which might lead to file
ID collisions and severe misbehaviours on guest!
You should either use a separate export for each device shared from host or
use virtfs option 'multidevs=remap'!
```

fixes #378

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-07-27 10:18:18 -05:00
Julio Montes
17fe0104a4 vendor: update govmm
bring fixes for the 9p filesystem

shortlog:
abca6f3 Add multidevs option to fsdev

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-07-27 10:18:14 -05:00
Peng Tao
322d85c48f Merge pull request #434 from evanfoster/add-container-creation-cleanup
sandbox: Stop and clean up containers that fail to create
2020-07-27 10:00:01 +08:00
Peng Tao
8d3f758716 Merge pull request #450 from cmaf/unit-virtcontainers-sandbox
virtcontainers: Move unit tests for types/sandbox.go
2020-07-27 09:55:10 +08:00
bin liu
db93a1631e runtime: remove mock shim
Remove mock codes for shim

Fixes #444

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-25 09:08:44 +08:00
Evan Foster
e5910c9b88 sandbox: Stop and clean up containers that fail to create
A container that is created and added to a sandbox can still fail
the final creation steps. In this case, the container must be stopped
and have its resources cleaned up to prevent leaking sandbox mounts.

Forward port of https://github.com/kata-containers/runtime/pull/2826

Fixes #2816

Signed-off-by: Evan Foster <efoster@adobe.com>
2020-07-24 09:25:47 -06:00
bin liu
d7f75dce83 docs: remove shim/proxy topics and fix docs links
And also change links from old documentation to docs sub-directory.

Fixes #444

Signed-off-by: bin liu <bin@hyper.sh>
2020-07-24 17:53:38 +08:00
Chelsea Mafrica
0b3cbee815 virtcontainers: Add additional unit tests for sandbox
Add tests for state change, empty string failures for Volumes and
Sockets. Change two function names to accurately reflect tests.

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-07-24 02:57:41 +00:00
Chelsea Mafrica
07a307b4b1 virtcontainers: Remove duplicate unit tests
Remove tests from virtcontainers/sandbox_test.go which were moved to
virtcontainers/types/sandbox_test.go.

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-07-24 01:36:12 +00:00
Chelsea Mafrica
d914f01829 virtcontainers: Move unit tests for types/sandbox.go
Move unit tests that were in virtcontainers/sandbox_test.go relating
to Socket, Volume, and SandboxState to types/sandbox_test.go.

Change testSandboxStateTransition function to use SandboxState only
instead of Sandbox from virtcontainers/sandbox.go.

Fixes #435

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-07-24 01:36:00 +00:00
Archana Shinde
3d46750596 device: Ease device access for rootfs device to allow node creation
For docker in docker scenario, the nested container created
has entry "b *:* m" in the list of devices it is allowed to access
under /sys/fs/cgroup/devices/docker/{ctrid}/devices.list.

This entry was causing issues while starting a nested container
as we were denying "m" access to the rootfs block devices.
With this change we add back "m" access, the container would be
allowed to create a device node for the rootfs device but will
not have read-write access to the created device node.

This fixes the docker in docker use case while still making sure
the container is not allowed read/write access to the rootfs.
Note, this could also be fixed by simply skipping {"Type : "b"}
while creating the device cgroup with libcontainer.
But this seems to be undocumented behaviour at this point,
hence refrained from taking this approach.

Fixes #426

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2020-07-17 15:33:41 -07:00
Chelsea Mafrica
f554cdec2c virtcontainers: Add to bridges unit test
Add function that creates new bridges to increase unit test coverage
for virtcontainers/types/bridges. Also adds test for address formats.

Fixes #422

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-07-16 16:34:49 +00:00
Penny Zheng
1d7d944f2c fc: refactor --daemonize option
Option --daemonize is invalid to firecarcker, and only valid to
jailer.

Fixes: #389

Signed-off-by: Penny Zheng penny.zheng@arm.com
2020-07-16 05:26:28 +00:00
Penny Zheng
7f3e8959c5 console-watcher: use console watcher to monitor guest console outputs
Import new console watcher to monitor guest console outputs, and will be
only effective when we turn on enable_debug option.
Guest console outputs may include guest kernel debug info, agent debug info,
etc.

Fixes: #389

Signed-off-by: Penny Zheng penny.zheng@arm.com
2020-07-16 05:26:19 +00:00
Penny Zheng
1099a28830 kata 2.0: delete use_vsock option and proxy abstraction
With kata containers moving to 2.0, (hybrid-)vsock will be the only
way to directly communicate between host and agent.
And kata-proxy as additional component to handle the multiplexing on
serial port is also no longer needed.
Cleaning up related unit tests, and also add another mock socket type
`MockHybridVSock` to deal with ttrpc-based hybrid-vsock mock server.

Fixes: #389

Signed-off-by: Penny Zheng penny.zheng@arm.com
2020-07-16 04:20:02 +00:00
Xu Wang
c052e46c66 Merge pull request #416 from bergwolf/cleanup
runtime: consolidate network types definition
2020-07-15 22:46:21 +08:00
Yang Bo
dacb2fded1 Merge pull request #414 from lifupan/2.0-fix
cgroup: fix the issue of crashed when meet unsupported cgroup
2020-07-15 22:22:06 +08:00
fupan.lfp
73bf9329ca cgroup: fix the issue of crashed when meet unsupported cgroup
Fix the issue of applying/set to unsupported cgroups.

Fixes: #408

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-07-15 20:54:00 +08:00
Peng Tao
5b15e9ef4f runtime: consolidate types definition
We do not need the vc types translation for network data structures.
Just use the protocol buffer definitions.

Fixes: #415
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-07-15 17:48:31 +08:00