Commit Graph

2192 Commits

Author SHA1 Message Date
James O. D. Hunt
d5fbba3b0a main: Remove commented out and redundant code
Remove confusing commented out code and some stray testing code.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:58 +01:00
James O. D. Hunt
1b2fe4a5be agent: Refactor main function
Move the sandbox creation into a new function.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:58 +01:00
James O. D. Hunt
bac79eeef0 main: Display config in announce
Add the configuration details in the announcement log call.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:58 +01:00
James O. D. Hunt
e2952b5354 main: Simplify version handling
Print a simple version string rather than delaying the output
to display a structured version string. The structured output
is potentially more useful but:

- This output is not consistent with other components.

- Delaying the output makes `--version` unusable in some
  environments (since a lot of setup is called before the
  version string can be output).

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:15 +01:00
Bo Chen
3ec05a9f95 clh: Add support to unplug block devices
[ Port from runtime commit 44b58e4151d1fc7debed41274b65c37233a437e3 ]

This patch enables kata+clh to unplug block devices, which is required
to pass cri-o integration tests.

Fixes: #461

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 14:00:24 -07:00
Bo Chen
45e32e1b77 clh: Set 'Id' explicitly while hotplugging block device
[ Port from runtime commit 03fb9c50c180d3359178c30e06f1122df312ae76 ]

To support unplug block device, we need to set the 'Id' explicitly while
hotplugging devices with cloud-hypervisor HTTP API.

Fixes: #461

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 14:00:21 -07:00
Jose Carlos Venegas Munoz
895959d007 clh: Provide cpu topology to API
[ Port from runtime commit 39897867bc89667daaafdd141367ec4a5fdc9247 ]

API now requires cpu topology.

Fixes: #461

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 14:00:18 -07:00
Jose Carlos Venegas Munoz
3159438701 clh: opeanapi: update api for cloud hypervisor
[ Port from runtime commit 40f49312a4881c904a1cbdace04c4c697bd2d429 ]

Update api geneated by openapi.

Fixes: #461

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 14:00:15 -07:00
Bo Chen
76a64667d5 clh: Remove the use of deprecated '--memory file=' parameter
[ Port from runtime commit 30b40f5505fd46d23b89eb5fb38301d2f7454f35 ]

Along with the release of cloud-hypervisor v0.8.0, this option has been
deprecated. clh now enforces to use the alternative controls,
e.g. "shared" and "hugepages", which can infer the backing file
paths. Also, we don't use "hugepages" in kata, so we are fine now as the
"shared" control  is already enabled.

Fixes: #461

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 13:51:43 -07:00
Yang Bo
03b7bc17de Merge pull request #499 from lifupan/2.0-dev
rustjail: add the "HOME" env for process
2020-08-19 09:35:06 +08:00
Yang Bo
485fc8ddc8 Merge pull request #531 from lifupan/propagation
rustjail: fix the issue of missing set propagation for bind mount
2020-08-19 09:33:53 +08:00
Julio Montes
2d28043cb2 Merge pull request #527 from devimc/2020-08-13/unittest/rustjail-process
agent: add unit tests for rustjail/process.rs
2020-08-18 12:08:31 -05:00
Bin Liu
37a331a1e8 Merge pull request #506 from lining2020/2.0-dev
virtcontainers: fix outdated example code in api document
2020-08-18 19:36:51 +08:00
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