Commit Graph

9851 Commits

Author SHA1 Message Date
Peng Tao
d085389127 vc: fix up UT for CreateSandbox API change
Need to adapt the UT as well.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2023-01-03 22:30:42 +08:00
Peng Tao
578a9c25f0 vc: rescan network endpoints after running prestart hooks
Moby relies on the prestart hooks to configure network endpoints. We
should rescan the netns after running them so that the newly added
endpoints can be found and plugged to the guest.

Fixes: #5941
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2023-01-03 22:30:41 +08:00
Fabiano Fidêncio
a3e1257708
Merge pull request #5891 from jtumber-ibm/foreign-cc
agent: unset `CC` for cross-build
2023-01-03 14:38:24 +01:00
Peng Tao
cb84b0fb02 katautils: run prestart hooks after starting VM
So that we can pass the hypervisor pid to the hook instead of the
runtime process's.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2023-01-03 10:52:32 +00:00
Fabiano Fidêncio
079462d2eb runk: Fix needless_borrow warning
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 17:14:13 +01:00
Fabiano Fidêncio
2c24fcf34c runtime-rs: Fix clippy::bool-to-int-with-if warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to boolean to int conversion using if.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 17:14:13 +01:00
Fabiano Fidêncio
025e78341e runtime-rs: Fix needless_borrow warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 17:14:13 +01:00
Fabiano Fidêncio
4fb163d570 runtime-rs: Allow clippy:box_default warnings
As the rust toolchain version bump to its 1.66.0 release raised a
warning about using Box::default() instead of specifying a type.

For now that's something we don't need to change, so let's ignore such
warning in this very specific case.

See:
https://rust-lang.github.io/rust-clippy/master/index.html#box_default

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 17:14:01 +01:00
Fabiano Fidêncio
20121fcda7 runtime-rs: Fix unnecessary_cast warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
 raised due to unnecessary_cast.

 Let's fix them all here.

 For more info about the warnings, please, take a look at:
 https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 16:16:39 +01:00
Fabiano Fidêncio
b95364a140 dragonball: Allow question_mark warning in allocate_device_resources()
As the rust toolchain version bump to its 1.66.0 release raised a
warning about the code being able to be refactored to use `?`.

For now that's something we don't need to change, so let's ignore such
warning in this very specific case.

See:
https://rust-lang.github.io/rust-clippy/master/index.html#question_mark

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 15:55:49 +01:00
Fabiano Fidêncio
0b2f060bf3 dragonball: Fix unnecessary_cast warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to unnecessary_cast.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 15:55:42 +01:00
Fabiano Fidêncio
a545a65934 agent: Allow clippy::question_mark warning in Namespace{}
As the rust toolchain version bump to its 1.66.0 release raised a
warning about the code being able to be refactored to use `?`.

For now that's something we don't need to change, so let's ignore such
warning in this very specific case.

See:
https://rust-lang.github.io/rust-clippy/master/index.html#question_mark

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 15:22:20 +01:00
Fabiano Fidêncio
9ced34dd22 agent: Fix explicit_auto_deref warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to explicit_auto_deref.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:59:50 +01:00
Fabiano Fidêncio
f77220490e agent: Fix needless_borrow warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:58:13 +01:00
Fabiano Fidêncio
7bcdc9049a rustjail: Fix unnecessary_cast warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to unnecessary_cast.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:42:58 +01:00
Fabiano Fidêncio
41d7dbaaea rustjail: Fix needless_borrow warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:42:25 +01:00
Fabiano Fidêncio
2a73e057db kata-types: Fix unnecessary_cast warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to unnecessary_cast.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:28:07 +01:00
Fabiano Fidêncio
cf9ef1833c kata-types: Fix needless_borrow warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:28:07 +01:00
Fabiano Fidêncio
126187e814 safe-path: Fix needless_borrow warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:28:07 +01:00
Fabiano Fidêncio
bb78d35db8 kata-sys-util: Fix "match-like-matches-macro" warning
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to "match-like-matches-macro".

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:28:07 +01:00
Fabiano Fidêncio
668e652401 kata-sys-util: Fix unnecessary_cast warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to unnecessary_cast.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:28:07 +01:00
Fabiano Fidêncio
c1a8d89a72 kata-sys-util: Fix needless_borrow warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:28:07 +01:00
Fabiano Fidêncio
c9c38e6d01 logging: Allow clippy::type-complexity warning
As the rust toolchain version bump to its 1.66.0 release raised a
warning about the type complexity used for the closure, and that's
something we don't want to change, let's ignore such warning in this
very specific case.

See:
https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:28:07 +01:00
Fabiano Fidêncio
ffd6fbb6b6 logging: Fix needless_borrow warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:18:14 +01:00
Fabiano Fidêncio
60df30015b protocols: Fix unnecessary_cast warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to unnecessary_cast.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 14:18:14 +01:00
Danny Canter
56e7b5d0fd runtime/Makefile: Get some bits happy on darwin
Substitution in the yq install script doesn't like zsh, and additionally
the version of yq we're using doesn't have a darwin/arm64 build so grab
the amd64 version and let rosetta work its magic.

Additionally swap to abspath from readlink -m for the printing of what binaries
to install, as the -m flag doesn't exist on the BSD variant, and this
should be the same behavior.

Fixes: #5970

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-01-02 04:19:58 -08:00
Fabiano Fidêncio
0bbeb34b4c protocols: Fix needless_borrow warnings
As we bumped the rust toolchain to 1.66.0, some new warnings have been
raised due to needless_borrow.

Let's fix them all here.

For more info about the warnings, please, take a look at:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 12:41:29 +01:00
Fabiano Fidêncio
dfea6c7d21 versions: Update the rust toolchain to 1.66.0
We're doing the bump on main, as we'll need this as part of the CCv0
branch due to the dependencies we have there.

Link to the 1.66.0 release:
https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1660-2022-12-15

Fixes: #5966

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-01-02 11:34:00 +01:00
Danny Canter
86ee24b33c Runtime: Clarify mutability of global var
Was about to change `urandomdev` to a constant when I realized it's
intentionally mutable so it can be mocked in tests. There's other
comments to the same effect so clarify here as well.

Fixes: #5965

Signed-off-by: Danny Canter <danny@dcantah.dev>
2023-01-02 01:13:34 -08:00
Zhongtao Hu
dae6670628 kata-runtime: add rust runtime path for kata-runtime exec
add rust runtime path for kata-runtime exec

Fixes:#5963
Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
2022-12-30 13:34:34 +08:00
Chao Wu
a2e3715e01 upcall: remove upcall client when stopping vm
In order to avoid resource leak, we need to remove upcall client in vm
and vcpu manager when stopping vm.

Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
2022-12-28 20:23:39 +08:00
wllenyj
31591d7915 dragonball: fix unit test failure case about Kvm.
Due to the wrong use of as_raw_fd, Kvm was dropped twice.

Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
2022-12-26 11:32:31 +08:00
wllenyj
2b02e0a9bf dragonball: add more unit test for vcpu manager
Added more unit tests for Vcpu Manager.

Fixes: #4899

Signed-off-by: wllenyj <wllenyj@linux.alibaba.com>
2022-12-26 11:31:42 +08:00
Yushuo
85f9094f17 agent: refactor guest hooks
We have to execute some hooks both in host and guest. And in
/libs/kata-sys-util/src/hooks.rs, the coomon operations are implemented.

In this commit, we are going to refactor the code of guest hooks using
code in /libs/kata-sys-util/src/hooks.rs. At the same time, we move
function valid_env to kata-sys-util to make it usable by both agent and
runtime.

Fixes: #5857

Signed-off-by: Yushuo <y-shuo@linux.alibaba.com>
2022-12-26 10:15:19 +08:00
Chao Wu
1511587a9a
Merge pull request #5601 from openanolis/hugepage
runtime-rs: enable hugepage
2022-12-25 22:35:06 +08:00
Zhongtao Hu
3605062258 runtime-rs: add dbs-upcall feature
add dbs-upcall feature to dragonball

Fixes:#5949

Depends-on: github.com/kata-containers/tests#5355

Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
2022-12-25 19:02:42 +08:00
Bin Liu
03a0c9d78e kata-ctl: skip test if access GitHub.com fail
This commit will call `error_for_status` after `send`, this call
will generate errors if status code between 400-499 and 500-599.

And sometime access github.com will fail, in this case we can
skip the test to prevent the CI failing.

Fixes: #5948

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-12-23 15:12:12 +08:00
Bin Liu
1dcbda3f0f kata-ctl: update Cargo.lock
kata-ctl depends on runtime-rs, and this commit:
fbf294da3f

added a new dependency named shim-interface, this Cargo.lock should be updated too.

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-12-23 15:06:50 +08:00
Bin Liu
b4b5d8150e docs: remove old and misleading instructions for minikube
Some instructions are old, delete them to prevent misleading.

Fixes: #5942

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-12-23 12:02:46 +08:00
Bin Liu
0fe24e08bb packaging: fix indents in build-kernel.sh
In the function get_kernel, the indents are two tabs,
which should be 1 tab.

Fixes: #5944

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-12-22 14:56:06 +08:00
Fupan Li
dc9c8d3357
Merge pull request #5901 from justxuewei/fix/mpleak
runtime-rs: Clean up mount points shared to guest
2022-12-21 09:59:25 +08:00
Bin Liu
92b843ac5a
Merge pull request #5924 from jongwu/kata-ctl-checkcpu
kata-ctl: fix checkcpu bug in non-x86 arches
2022-12-21 09:16:53 +08:00
Jianyong Wu
3480780bd8 kata-ctl: add check framework support for non-x86
x86 changes the check framwork. Enable them for non-x86 accordingly.

Fixes: #5923
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2022-12-20 11:41:00 +08:00
Jianyong Wu
1bd533f10b kata-ctl: let check framework arch-agnostic
The current check framwork is specific for x86. Refactor the code
to let it arch-agnostic.

Fixes: #5923
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2022-12-20 11:41:00 +08:00
Fabiano Fidêncio
2e54c8e887
Merge pull request #5921 from fidencio/3.1.0-alpha1-branch-bump
# Kata Containers 3.1.0-alpha1
2022-12-19 15:45:53 +01:00
Bin Liu
6039516802
Merge pull request #5925 from xinydev/fix-docs
docs: Remove duplicate sentences
2022-12-19 17:12:15 +08:00
Peng Tao
473f5ff7da
Merge pull request #5861 from mflagey/Docs_Change_build_virtiofsd_in_developer_guide_#5860
docs: Update virtiofsd build script in the developer guide
2022-12-19 17:02:35 +08:00
Bin Liu
0cf443a612
Merge pull request #5915 from openanolis/legacy_device
dragonball: refactor legacy device initialization
2022-12-19 13:31:45 +08:00
Xuewei Niu
fd77eebd4d runtime-rs: fix the issues mentioned in the code review
In order to avoid cloning, changed the signature of
`ShareFsMount::share_rootfs`, `ShareFsMount::share_volume`, and
`ShareFsMount::umount_rootfs` to receive a reference to a config.

Fixes: #5898

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2022-12-19 11:46:50 +08:00
Xuewei Niu
0e69207909 runtime-rs: Clean up mount points shared to guest
Fixed issues where shared volumes couldn't umount correctly.

The rootfs of each container is cleaned up after the container is killed, except
for `NydusRootfs`. `ShareFsRootfs::cleanup()` calls
`VirtiofsShareMount::umount_rootfs()` to umount mount points shared to the
guest, and umounts the bundle rootfs.

Fixes: #5898

Signed-off-by: Xuewei Niu <niuxuewei.nxw@antgroup.com>
2022-12-19 11:46:14 +08:00