Commit Graph

9129 Commits

Author SHA1 Message Date
Samuel Ortiz
fa0e9dc6b1 virtcontainers: Make all Linux VMMs only build on Linux
Some of them (e.g. QEMU) can run on other OSes (e.g. Darwin) but the
current virtcontainers implementation is Linux specific.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-16 19:07:34 +01:00
Samuel Ortiz
c91035d0e1 virtcontainers: Move non QEMU specific constants to hypervisor.go
Hotplugging errors and 9pfs size are not particularily QEMU specific.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-16 19:07:34 +01:00
Samuel Ortiz
10ae05914c virtcontainers: Move guest protection definitions to hypervisor.go
They're not QEMU specific, other VMMs may implement support for it.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-16 19:07:31 +01:00
Samuel Ortiz
b28d0274ff virtcontainers: Make max vCPU config less QEMU specific
Even though it's still actually defined as the QEMU upper bound,
it's now abstracted away through govmm.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-16 19:06:32 +01:00
Samuel Ortiz
a5f6df6a49 govmm: Define the number of supported vCPUs per architecture
Based on qhe QEMU supports on those architectures.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-16 19:06:32 +01:00
Fabiano Fidêncio
be2e90469a
Merge pull request #3669 from fidencio/wip/virtiofsd-use-announce-submounts
virtiofsd: Use "-o announce_submounts"
2022-02-16 16:43:18 +01:00
Fabiano Fidêncio
a6b4015130 tools: clh: Remove unused variables
Right now we're getting the info for the Cloud Hypervisor repo and
version, but we don't do anything with them, as those are not passed
down to the build script.

Morever, the build script itself gets the info from exactly the same
place when those are not passed, making those redundant.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-16 14:54:51 +01:00
Peng Tao
b4a1150638
Merge pull request #3344 from liubin/f/3342-hugepages-support
feature: hugepages support
2022-02-16 21:52:26 +08:00
Fabiano Fidêncio
5816c132ec tools: Build cloud-hypervisor with "--features tdx"
Right now TDx support on Cloud Hypervisor is gated behind a "--features
tdx" flag.  However, having TDx support enabled should not and does not
impact on the general usability of cloud-hypervisor.

As sooner than later we'll need kata-deploy binaries to be tested on a
CI that's TDx capable, for the confidential containers effort, let's
take the bullet and already enable it by default.

By the way, touching kata-deploy-binaries.sh as it's ensure the change
will be used in the following workflows:
* kata-deploy-push
* kata-deploy-test
* release

Fixes: #3688

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-16 14:51:15 +01:00
Carlos Venegas
e6060cb7c0 versions: Linux 5.15.x
Upgrade to new Linux kernel LTS version.

Fixes: #3576

Signed-off-by: Carlos Venegas <jose.carlos.venegas.munoz@intel.com>
2022-02-16 11:12:44 +01:00
James O. D. Hunt
9818cf7196 docs: Improve top-level and runtime README
Various improvements to the top-level README file:

- Moved the following sections from the runtime's README to the
  top-level README:
  - License
  - Platform support / Hardware requirements
- Added the following sections to the top-level README:
  - Configuration
  - Hypervisors
- Improved formatting of the Documentation section in the top-level
  README.
- Removed some unused named links from the top-level README.

Also improvements to the runtime README:

- Removed confusing mention of the old 1.x runtime name.
- Clarify the binary name for the 2.x runtime and the utility program.

> **Note:**
>
> We cannot currently link to the AMD website as that site's
> configuration causes the CI static checks to fail. See
> https://github.com/kata-containers/tests/issues/4401

Fixes: #3557.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-16 09:52:48 +00:00
Fabiano Fidêncio
d0c8eb7e14
Merge pull request #3673 from fidencio/wip/allow-passing-a-build-flag-to-cloud-hypervisor
tools: clh: Allow to set when to build from sources and the build flags passed down to cargo
2022-02-16 09:45:54 +01:00
bin
36c3fc12ce agent: support hugepages for containers
Mount hugepage directories and configure the requested number of hugepages
dynamically by writing to sysfs files

Port from:
78b307b5bd

Fixes: #3342

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
Signed-off-by: bin <bin@hyper.sh>
2022-02-16 15:14:53 +08:00
bin
81a8baa5e5 runtime: add hugepages support
Add hugepages support, port from:
b486387cba

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
Signed-off-by: bin <bin@hyper.sh>
2022-02-16 15:14:53 +08:00
bin
7df677c01e runtime: Update calculateSandboxMemory to include Hugepages Limit
Support hugepages and port from:
96dbb2e8f0

Fixes: #3342

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
Signed-off-by: bin <bin@hyper.sh>
2022-02-16 15:14:37 +08:00
GabyCT
1dcb413e68
Merge pull request #3677 from GabyCT/topic/removedockerrun
docs: Remove docker run and shared memory from limitations
2022-02-15 15:04:36 -06:00
Fabiano Fidêncio
948a2b099c tools: clh: Ensure the download binary is executable
We're downloading the released cloud-hypervisor binary from GitHub, but
we should also ensure we set the binary as executable.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-15 20:23:46 +01:00
bin
72bf5496fd agent: handle hook process result
Current hook process is handled by just calling
unwrap() on it, sometime it will cause panic.

By handling all Result type and check the error can
avoid panic.

Fixes: #3649

Signed-off-by: bin <bin@hyper.sh>
2022-02-15 19:01:54 +01:00
bin
80e8dbf1f5 agent: valid envs for hooks
Envs contain null-byte will cause running hooks to panic,
this commit will filter envs and only pass valid envs to hooks.

Fixes: #3667

Signed-off-by: bin <bin@hyper.sh>
2022-02-15 19:01:54 +01:00
Samuel Ortiz
4f96e3eae3 katautils: Pass the nerdctl netns annotation to the OCI hooks
We need to let nerdctl know which namespace to use when calling the
selected CNI plugin.
See https://github.com/containerd/nerdctl/issues/787

Fixes: #1935

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-15 18:11:23 +01:00
Samuel Ortiz
a871a33b65 katautils: Run the createRuntime hooks
The preStart hooks are being deprecated over the createRuntime ones.

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-15 17:31:56 +01:00
Samuel Ortiz
d9dfce1453 katautils: Run the preStart hook in the host namespace
The OCI spec is very specific about it:

"The prestart hooks MUST be executed in the runtime namespace."

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-15 17:31:56 +01:00
Samuel Ortiz
6be6d0a3b3 katautils: Pass the OCI annotations back to the called OCI hooks
That allows us to amend those annotations with information that could be
used when running those hooks.

For example nerdctl will use those annotations to resolve the networking
namespace path in where to run the CNI plugin, i.e. the created pod
networking namespace.

Fixes #3629

Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
2022-02-15 17:31:56 +01:00
James O. D. Hunt
493ebc8ca5 utils: Update kata manager docs
Update the `kata-manager.sh` README to recommend users view the
available options before running the script.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 16:05:54 +00:00
James O. D. Hunt
34b2e67d48 utils: Added more kata manager cli options
Added CLI options to the `kata-manager.sh` script to:

- Force installation
- Disable cleanup (retain downloaded files)
- Only install Kata (don't consider containerd).

> **Note:**
>
> This change introduces a subtle behaviour difference:
>
> - Previously, the script would error if containerd was already installed.
>
> - Now, the script will detect the existing installation and skip
>   trying to install containerd.
>
> This new behaviour makes more sense for most users but if you wish
> to use the old behaviour, you (now) need to run the script specifying
> the `-f` (force) option.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 16:05:54 +00:00
James O. D. Hunt
714c9f56fd utils: Improve containerd configuration
`kata-manager.sh` improvements for containerd:

- Fixed containerd default branch (which is now `main`).
- Only install service file if it doesn't already exist.
- Enable the containerd service to ensure it can be started.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 16:05:54 +00:00
James O. D. Hunt
c464f32676 utils: kata-manager: Force containerd sym link creation
For consistency with the rest of the script force the creation of a
symbolic link for containerd in `kata-manager.sh`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 16:05:54 +00:00
James O. D. Hunt
4755d004a7 utils: Fix unused parameter
Actually make use of the `requested_version` parameter in
`kata-manager.sh` and added a comment.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 16:05:54 +00:00
James O. D. Hunt
601be4e63b utils: Fix containerd installation
Fix bug introduced inadvertently on #3330 which fixes the Kata
installation, but unfortunately breaks installing containerd.

The new approach is to check that the download URL matches a
project-specific regular expression.

Also improves the architecture test to handle the containerd
architecture name (`amd64` rather than `x86_64`).

Fixes: #3674.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 16:05:54 +00:00
James O. D. Hunt
ae21fcc799 utils: Fix Kata tar archive check
The static tar archive published on GitHub (now) contains `./` which is
being being flagged as an "unknown path" and resulting in the
`kata-manager.sh` script failing.

Partially fixes: #3674.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 16:05:54 +00:00
James O. D. Hunt
f4d1e45c33 utils: Add kata-manager CLI options for kata and containerd
Add options to `kata-manager.sh` to allow the version of Kata and
containerd to be specified.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 16:05:52 +00:00
Gabriela Cervantes
395cff480d docs: Remove docker run and shared memory from limitations
This PR removes the docker run and shared memory segment from the
limitations document as for kata 2.0 we do not support docker
and this is not longer valid.

Fixes #3676

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-02-15 15:29:12 +00:00
Fabiano Fidêncio
e07545a23c tools: clh: Allow passing down a build flag
Let's allow passing down a build flag to cargo, when building Cloud
Hypervisor.

By doing this we allow calling this script with:
```
extra_build_flags="--features tdx" ./build-static-clh.sh
```

Fixes: #3671

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-15 14:14:30 +01:00
Fabiano Fidêncio
55cdef2295 tools: clh: Add the possibility to always build from sources
The current code will always pull the release binaries in case the
version requested by Kata Containers matches with a released version.

This, however, has a limitation of preventing users / CIs to build
cloud-hypervisor from source for a reason or another, such as passing a
specific build flag to cloud-hypervisor.

This is a pre-req to solving
https://github.com/kata-containers/kata-containers/issues/3671.

While here, a small changes were needed in order to improve readability
and debugability of why we're building something from the sources rather
than simply downloading and using a pre-built binary.

Fixes: #3672

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-15 14:13:51 +01:00
James O. D. Hunt
3f87835a0e utils: Switch kata manager to use getopts
Use `getopts(1)` for command line argument parsing in
`kata-manager.sh`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2022-02-15 08:55:54 +00:00
Fabiano Fidêncio
4bd945b67b virtiofsd: Use "-o announce_submounts"
German Maglione, one of the current virtio-fs developers, has brought to
our attention that using "announce-submounts" could help us to prevent
inode number collisions.

This feature was introduced a year ago or so by Hanna Reitz as part of
the 08dce386e77eb9ab044cb118e5391dc9ae11c5a8, and as we already mandate
QEMU >= 6.1.0, let's take advantage of that.

Fixes: #3507

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-15 08:52:03 +01:00
Yu Li
37df1678ae build: always reset ARCH after getting it
When building with `ARCH=x86_64`, the previous `Makefile` will use it
without checking and cause:

Makefile:319: *** "ERROR: No hypervisors known for architecture x86_64 (looked for: acrn firecracker qemu cloud-hypervisor)".  Stop.

This commit fix the above issue by checking `ARCH` no matter where it
is assigned.

Fixes: #3444

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
Signed-off-by: Yu Li <liyu.yukiteru@bytedance.com>
2022-02-15 14:26:34 +08:00
Fabiano Fidêncio
a3b3274121
Merge pull request #3664 from fidencio/clh-update-to-55479a64d237
versions: Udpate Cloud Hypervisor to 55479a64d237
2022-02-15 00:52:42 +01:00
Shengjing Zhu
3a641b56f6 katatestutils: remove distro constraints
The distro constraint parses os release files, which may not contain
distro version(VERSION_ID field), for example rolling release distributions
like Debian testing, archlinux.

These distro constraints are not used anyway, so removing them instead
of fixing the complex version detection.

Fixes: #1864

Signed-off-by: Shengjing Zhu <zhsj@debian.org>
2022-02-15 02:11:52 +08:00
Fabiano Fidêncio
90fd625d0c versions: Udpate Cloud Hypervisor to 55479a64d237
Let's update cloud-hypervisor to a version that exposes the TDx support
via the OpenAPI's auto-generated code.

Fixes: #3663

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-02-14 17:32:30 +01:00
Eric Ernst
1873fd2641
Merge pull request #3660 from devimc/2022-02-11/packaging/supportKernelTDx
kernel: add missing config fragment for TDx
2022-02-14 08:18:59 -08:00
Jakob Naucke
573a37b33b
osbuilder: Add CentOS Stream rootfs
to cover a Red Hat (adjacent) rootfs with great cross-platform compatibility
and a workable release cadence. The previous CentOS & Fedora workflows are
simplified.

Also remove unnecessary `/usr/share` files as on Ubuntu and mark Alpine
as unuspported on ppc64le (due to musl, for a while already).

Fixes: #3340
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-02-14 15:06:07 +01:00
Jakob Naucke
f10642c82b
osbuilder: Source .cargo/env before checking Rust
We install Rust in the build containers, but we also install Rust in
`rootfs.sh` if it is missing. It makes sense to install Rust in the build
containers so it does not have to be installed every time, but for that check
to work on non-login shells, we should source `.cargo/env` before running it.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-02-14 15:06:07 +01:00
Julio Montes
955d359f9e kernel: add missing config fragment for TDx
Add kernel config fragment that enables TDx

fixes #3659

Signed-off-by: Julio Montes <julio.montes@intel.com>
2022-02-14 07:40:12 -06:00
James O. D. Hunt
8f80dffead
Merge pull request #3648 from yaoyinnan/index-in-for
runtime: The index variable is initialized multiple times in for
2022-02-14 12:36:46 +00:00
James O. D. Hunt
3d3af84cde
Merge pull request #3636 from Kvasscn/kata_dev_fix_check_build_type
scripts: fix a typo while to check build_type
2022-02-14 12:33:59 +00:00
bin
734b618c16 agent-ctl: run cargo fmt/clippy in make check
Run cargo fmt/clippy in make check and
clear clippy warnings.

Fixes: #3656

Signed-off-by: bin <bin@hyper.sh>
2022-02-14 20:12:57 +08:00
bin
12c37fafc5 trace-forwarder: add make check for Rust
Add make check to run cargo fmt/clippy
for Rust projects.

Fixes: #3656

Signed-off-by: bin <bin@hyper.sh>
2022-02-14 20:12:48 +08:00
Fabiano Fidêncio
7ae8901a66
Merge pull request #3483 from fidencio/wip/bump-crio-to-its-1.23-release
versions: bump CRI-O to its 1.23 release
2022-02-14 10:06:51 +01:00
Bin Liu
cf53ec2c71
Merge pull request #2977 from luodw/support_nydus
feature(nydusd): add nydusd support to introduce lazyload ability
2022-02-14 13:08:50 +08:00