Commit Graph

3380 Commits

Author SHA1 Message Date
Pradipta Banerjee
1f0d709be6 CC: Add configurable context timeout for StopVM in remote hyp
Add configurable context timeout for StopVM in remote hypervisor
similar to StartVM

Fixes: #6730

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
2023-05-04 10:42:30 +00:00
Greg Kurz
bc101b7f56 rustjail: Use CPUWeight with systemd and CgroupsV2
The CPU shares property belongs to CgroupsV1. CgroupsV2 uses CPU weight
instead. The correct value is computed in the latter case but it is passed
to systemd using the legacy property. Systemd rejects the request and the
agent exists with the following error :

        Value specified in CPUShares is out of range: unknown

Replace the "shares" wording with "weight" in the CgroupsV2 code to
avoid confusions. Use the "CPUWeight" property since this is what
systemd expects in this case.

Fixes #6636

References:

https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html#CPUWeight=weight
https://www.freedesktop.org/software/systemd/man/systemd.resource-control.html#systemd%20252
https://github.com/containers/crun/blob/main/crun.1.md#cpu-controller

Signed-off-by: Greg Kurz <groug@kaod.org>
(cherry picked from commit c1fbaae8d6)
2023-04-24 15:43:27 +01:00
Fabiano Fidêncio
a3b2358c77 agent: Update image-rs to v0.5.1
Let's update image-rs to the latest released version of the project.

Fixes: #6650

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-04-14 15:20:35 +02:00
Wainer dos Santos Moschetta
2bd2b12a0a agent: update image-rs dependency
In preparation for CoCo 0.5 release, updated image-rs to
commit b28eaae.

Fixes #6650
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2023-04-12 18:22:33 -03:00
Steve Horsman
dfa7ed06eb Merge pull request #6617 from yoheiueda/remote-static-resmgmt
CCv0: runtime: Use static_sandbox_resource_mgmt by default in remote hypervisor
2023-04-12 07:49:11 +01:00
Jeremi Piotrowski
3db0c6bcac Merge pull request #6625 from BbolroC/revive-runtime-config-s390x
CC: Revive removed runtime config for IBM SE
2023-04-06 15:59:22 +02:00
Fabiano Fidêncio
b936ddc139 Merge pull request #6569 from jepio/jepio/6404-test
CC | agent: add support for ttrpc + dependency on test PR
2023-04-06 14:15:44 +02:00
Hyounggyu Choi
b73f26440e CC: Revive removed runtime config for IBM SE
This is just to get the removed runtime config for IBM SE back again.

Fixes: #6624

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-04-06 20:18:28 +09:00
Yohei Ueda
938447803b runtime: Use static resource in remote hypervisor
This patch updates the template configuration file for
the remote hypervisor to set static_sandbox_resource_mgmt
to be true.  The remote hypervisor uses the peer pod config
to determine the sandbox size, so requires this to be set to
true by default.

Fixes: #6616
Signed-off-by: Yohei Ueda <yohei@jp.ibm.com>
2023-04-06 16:53:05 +09:00
Jeremi Piotrowski
5c27f27af0 Merge pull request #6135 from Alex-Carter01/snp-config
config: Add SEV SNP config
2023-03-31 20:10:08 +02:00
Alex Carter
28fd92c478 kata-deploy: SNP version of Qemu
An SNP runtimeclass needs a build of Qemu from https://github.com/AMDESE/qemu/tree/snp-v3.

So a new target needs to be added to add it to a kata-deploy bundle.

Building requires a qemu no_patches file

Fixes: #6061
Signed-Off-By: Alex Carter <alex.carter@ibm.com>
2023-03-31 14:58:38 +00:00
Alex Carter
2b5c84b9ec config: Add SEV SNP config
Adding SNP template for config, and values to the runtime makefile to generate the output toml.

Based on [Joana's SNP Guide](https://github.com/kata-containers/kata-containers/blob/main/docs/how-to/how-to-run-kata-containers-with-SNP-VMs.md).

Fixes: #6112
Signed-Off-By: Alex Carter <alex.carter@ibm.com>
2023-03-31 13:51:09 +00:00
Pradipta Banerjee
3081cd5f8e runtime: propagate configmap/secrets etc changes for remote-hyp
For remote hypervisor, the configmap, secrets, downward-api or project-volumes are
copied from host to guest. This patch watches for changes to the host files
and copies the changes to the guest.

Note that configmap updates takes significantly longer than updates via downward-api.
This is similar across runc and Kata runtimes.

Fixes: #6341

Signed-off-by: Pradipta Banerjee <pradipta.banerjee@gmail.com>
Signed-off-by: Julien Ropé <jrope@redhat.com>
2023-03-30 03:14:52 +00:00
Xynnn007
fcea177d96 agent: add support for ttrpc
This commit brings ttrpc of image-rs. It will use the
lightweight underlying ttrpc to interact between kata-agent
and attestation-agent.

Also, this PR brings a patch for `oci-distribution`,
because two dependencies of `image-rs` depends on different
versions of `oci-distribution`, which will cause that
`image-rs` can not be built. We need a specified version of
`oci-distribution` to unify.

Fixes #6219

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2023-03-30 09:11:50 +08:00
Fabiano Fidêncio
4c810c7933 Merge pull request #6457 from arronwy/multiple_same_images
image_rpc: Add container_count for containers without cid
2023-03-28 10:16:48 +02:00
Steve Horsman
4b027ba664 Merge pull request #6506 from Megan-Wright/CCv0
CCv0: Merge main into CCv0 branch
2023-03-27 14:42:03 +01:00
stevenhorsman
7c9a791d67 config: Add initial remote hypervisor config
Remote hypervisor template config

Fixes: #6349
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-03-20 17:58:27 +00:00
Megan Wright
f31c907f46 Fix bad merge 2023-03-20 13:51:10 +00:00
Megan Wright
42978f3e83 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #6504
Signed-off-by: Megan Wright <megan.wright@ibm.com>
2023-03-20 13:23:49 +00:00
Fabiano Fidêncio
2fe0733dcb Merge pull request #4582 from BbolroC/vfio-ap
agent: Bring in VFIO-AP device handling again
2023-03-20 11:43:13 +01:00
Yushuo
f4938c0d90 bugfix: set hostname
Setting hostname according to the spec.

Fixes: #6247

Signed-off-by: Yushuo <y-shuo@linux.alibaba.com>
2023-03-16 17:16:06 +08:00
Hyounggyu Choi
96baa83895 agent: Bring in VFIO-AP device handling again
This PR is a continuing work for (kata-containers#3679).

This generalizes the previous VFIO device handling which only
focuses on PCI to include AP (IBM Z specific).

Fixes: kata-containers#3678
Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2023-03-16 18:14:12 +09:00
Greg Kurz
e6e719699f Merge pull request #6471 from etrunko/main
dependency: update cgroups-rs
2023-03-16 08:01:07 +01:00
QuanweiZhou
56c63a9b1c Merge pull request #6186 from wllenyj/dragonball-ut-6
Built-in Sandbox: add more unit tests for dragonball. Part 6
2023-03-16 11:02:05 +08:00
Jakob Naucke
f666f8e2df agent: Add VFIO-AP device handling
Initial VFIO-AP support (#578) was simple, but somewhat hacky; a
different code path would be chosen for performing the hotplug, and
agent-side device handling was bound to knowing the assigned queue
numbers (APQNs) through some other means; plus the code for awaiting
them was written for the Go agent and never released. This code also
artificially increased the hotplug timeout to wait for the (relatively
expensive, thus limited to 5 seconds at the quickest) AP rescan, which
is impractical for e.g. common k8s timeouts.

Since then, the general handling logic was improved (#1190), but it
assumed PCI in several places.

In the runtime, introduce and parse AP devices. Annotate them as such
when passing to the agent, and include information about the associated
APQNs.

The agent awaits the passed APQNs through uevents and triggers a
rescan directly.

Fixes: #3678
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2023-03-16 10:07:48 +09:00
Jakob Naucke
b546eca26f runtime: Generalize VFIO devices
Generalize VFIO devices to allow for adding AP in the next patch.
The logic for VFIOPciDeviceMediatedType() has been changed and IsAPVFIOMediatedDevice() has been removed.

The rationale for the revomal is:

- VFIODeviceMediatedType is divided into 2 subtypes for AP and PCI
- Logic of checking a subtype of mediated device is included in GetVFIODeviceType()
- VFIOPciDeviceMediatedType() can simply fulfill the device addition based
on a type categorized by GetVFIODeviceType()

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2023-03-16 10:06:37 +09:00
Jakob Naucke
4c527d00c7 agent: Rename VFIO handling to VFIO PCI handling
e.g., split_vfio_option is PCI-specific and should instead be named
split_vfio_pci_option. This mutually affects the runtime, most notably
how the labels are named for the agent.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2023-03-16 07:43:39 +09:00
Jakob Naucke
db89c88f4f agent: Use cfg-if for s390x CCW
Uses fewer lines in upcoming VFIO-AP support.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2023-03-16 07:43:39 +09:00
Jakob Naucke
68a586e52c agent: Use a constant for CCW root bus path
used a function like PCI does, but this is not necessary

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2023-03-16 07:43:39 +09:00
Fabiano Fidêncio
814d07af58 Merge pull request #6463 from sprt/sprt/mshv-compat
runtime: add support for Hyper-V
2023-03-15 18:03:25 +01:00
Eduardo Lima (Etrunko)
a8b55bf874 dependency: update cgroups-rs
Huge pages failure with cgroups v2.
https://github.com/kata-containers/cgroups-rs/issues/112

Fixes: #6470

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2023-03-15 12:21:12 -03:00
Steve Horsman
c3059d0bd9 Merge pull request #6207 from BbolroC/s390x-prepare-se-image
CC: Prepare secure execution image tarball for s390x
2023-03-15 14:33:59 +00:00
Steve Horsman
5da86f3e25 Merge pull request #6440 from GeorginaKin/CCv0
CCv0: Merge main into CCv0 branch
2023-03-15 10:40:55 +00:00
Chao Wu
97cdba97ea runtime-rs: update load_config comment
Since shimv2 create task option is already implemented, we need to update the
corresponding comments.

Also, the ordering is also updated to fit with the code.

fixes: #3961

Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
2023-03-15 14:44:47 +08:00
Fabiano Fidêncio
0bcbbfe44f Merge pull request #5665 from jimcadden/online_sev_kbc
CC | runtime: Add online-kbs to kernel params
2023-03-14 21:19:37 +01:00
Wang, Arron
dd1c22211c image_rpc: Add container_count for containers without cid
If cid is empty, we will use image name as default cid, to
support multiple containers with same image, we need append
unique id to the image name.

Fixes: #6456

Signed-off-by: Wang, Arron <arron.wang@intel.com>
2023-03-14 16:01:27 +08:00
Eric Ernst
dc42f0a33b Merge pull request #6411 from wlan0/empty-dir
Add support for ephemeral mounts to occupy entire sandbox's memory
2023-03-13 20:07:27 -07:00
Henry Beberman
974a5c22f0 runtime: add support for Hyper-V
This adds /dev/mshv to the list of sandbox devices so that VMMs can
create Hyper-V VMs.

In our testing, this also doesn't error out in case /dev/mshv isn't
present.

Fixes #6454.

Signed-off-by: Aurélien Bombo <abombo@microsoft.com>
2023-03-13 17:13:51 -07:00
Fabiano Fidêncio
40f4eef535 build: Use the correct kernel name
When calling `MAKE_KERNEL_NAME` we're considering the default kernel
name will be `vmlinux.container` or `vmlinuz.container`, which is not
the case as the runtime-rs, when used with dragonball, relies on the
`vmlinu[zx]-dragonball-experimental.container` kernel.

Other hypervisors will have to introduce a similar
`MAKE_KERNEL_NAME_${HYPERVISOR}` to adapt this to the kernel they want
to use, similarly to what's already done for the go runtime.

By doing this we also ensure that no changes in the configuration file
will be required to run runtime-rs, with dragonball, as part of our CI
or as part of kata-deploy.

Fixes: #6290

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-03-13 13:47:20 +01:00
James O. D. Hunt
ae9be1d94b Merge pull request #5840 from tzY15368/feat-runtimers-direct-vol
Implement direct-volume commands handler for shim-mgmt
2023-03-13 07:58:40 +00:00
Chelsea Mafrica
4b877b0a3e Merge pull request #6426 from openanolis/runtime-rs-resize-pty
bugfix: modify tty_win info in runtime when handling ResizePtyRequest
2023-03-10 14:08:41 -08:00
Sidhartha Mani
a6c67a161e runtime: add support for ephemeral mounts to occupy entire sandbox memory
On hotplug of memory as containers are started, remount all ephemeral mounts with size option set to the total sandbox memory

Fixes: #6417

Signed-off-by: Sidhartha Mani <sidhartha_mani@apple.com>
2023-03-10 13:36:02 -08:00
James O. D. Hunt
99a4eaa898 Merge pull request #6443 from openanolis/runtime-rs-get-netns
bugfix: add get_ns_path API for Hypervisor
2023-03-10 20:16:22 +00:00
Georgina Kinge
eba66de646 Revert "runtime: clh: Re-generate the client code"
Reverting as cloud-hypervisor shouldn't be upgraded in CC.

Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2023-03-10 11:28:04 +00:00
Li Hongyu
844bf053b2 runtime-rs: add the missing default trait
Some structs in the runtime-rs don't implement Default trait.
This commit adds the missing Default.

Fixes: #5463

Signed-off-by: Li Hongyu <lihongyu1999@bupt.edu.cn>
2023-03-10 08:19:56 +00:00
Yushuo
e7bca62c32 bugfix: modify tty_win info in runtime when handling ResizePtyRequest
Currently, we only create the new exec process in runtime, this will cause error
when the following requests needing to be handled:

- Task: exec process
- Task: resize process pty
- ...

The agent do not do_exec_process when we handle ExecProcess, thus we can not find
any process information in the guest when we handle ResizeProcessPty. This will
report an error.

In this commit, the handling process is modified to the:
* Modify process tty_win information in runtime
* If the exec process is not running, we just return. And the truly pty_resize will
happen when start_process

Fixes: #6248

Signed-off-by: Yushuo <y-shuo@linux.alibaba.com>
2023-03-10 14:33:51 +08:00
Tingzhou Yuan
30e235f0a1 runtime-rs: impl volume-resize trait for sandbox
Implements resize-volume handlers in shim-mgmt,
trait for sandbox and add RPC calls to agent.
Note the actual rpc handler for the resize request is currently not
implemented, refer to issue #3694.

Fixes #5369

Signed-off-by: Tingzhou Yuan <tzyuan15@bu.edu>
2023-03-10 01:27:06 -05:00
Yushuo
e029988bc2 bugfix: add get_ns_path API for Hypervisor
For external hypervisors(qemu, cloud-hypervisor, ...), the ns they launch vm in
is different from internal hypervisor(dragonball). And when we doing CreateContainer
hook, we will rely on the netns path. So we add a get_ns_path API.

Fixes: #6442

Signed-off-by: Yushuo <y-shuo@linux.alibaba.com>
2023-03-10 13:57:00 +08:00
Tingzhou Yuan
42b8867148 runtime-rs: impl volume-stats trait for sandbox
Implements get-volume-stats trait for sandbox,
handler for shim-mgmt and add RPC calls to
agent. Also added type conversions in trans.rs

Fixes #5369

Signed-off-by: Tingzhou Yuan <tzyuan15@bu.edu>
2023-03-10 00:48:02 -05:00
Georgina Kinge
ec6ce46e7e CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #6428
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2023-03-09 16:14:53 +00:00