Commit Graph

2078 Commits

Author SHA1 Message Date
Chelsea Mafrica
9e4932a6e2 runtime: use root span for shimv2 tracing
Add rootCtx to service struct in shimv2 to use as parent of spans
created in shimv2 for a more organized trace ouput.

Fixes #1355

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2021-03-16 17:39:28 -07:00
Chelsea Mafrica
6b0dc60dda runtime: Fix ordering of trace spans
A significant number of trace calls did not use a parent context that
would create proper span ordering in trace output. Add local context to
functions for use in trace calls to facilitate proper span ordering.
Additionally, change whether trace function returns context in some
functions in virtcontainers and use existing context rather than
background context in bindMount() so that span exists as a child of a
parent span.

Fixes #1355

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2021-03-16 17:39:28 -07:00
Fabiano Fidêncio
50f317dcff Merge pull request #1463 from egernst/bindmount-infra
runtime: add support for readonly sandbox bindmounts
2021-03-16 11:34:53 +01:00
Julien Ropé
3a77e4eb8c build: remove unused variables from Makefile
Some variable are initialized in the Makefile, but never used.
Removing them to clean up the Makefile.

Fixes: #1003

Signed-off-by: Julien Ropé <jrope@redhat.com>
2021-03-16 08:51:16 +01:00
Eric Ernsteernst
d7cb3df0d2 cgroups: Add systemd detection when creating cgroup manager
Look at the provided cgroup path to determine whether systemd is being
used to manage the cgroups. With this, systemd cgroups are being detected
and created appropriately for the sandbox.

Fixes: #599

Signed-off-by: Eric Ernsteernst <eric@amperecomputing.com>

(forward port of https://github.com/kata-containers/runtime/pull/2817)
Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
2021-03-16 08:27:14 +01:00
Eric Ernsteernst
f659871f55 cgroups: remove unused SystemdCgroup variable and accessor/mutators
Since we are now detecting, no longer to keep this state.

Signed-off-by: Eric Ernsteernst <eric@amperecomputing.com>

(forward port of https://github.com/kata-containers/runtime/pull/2817)
Signed-off-by: Francesco Giudici <fgiudici@redhat.com>
2021-03-16 08:26:15 +01:00
Fupan Li
62d30ca2b6 Merge pull request #1498 from liubin/fix/1497-task-exit-pid
runtime: return hypervisor Pid in TaskExit event
2021-03-11 12:58:28 +08:00
Eric Ernst
f0d49851db exec: ensure sup groups are added to agent request
Extra groups were not being handled when exec'ing. Ensure
that these are handled.

Before this, running a pod with:
```
 ...snippet...
 securityContext:
   fsGroup: 266
   runAsGroup: 51020
   runAsUser: 264
```

And then exec'ing would not supply the fsGroup:
```
$ kubectl exec -it kata-bb  -- sh -c id
uid=264 gid=51020
```

Fixes: #1500

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-03-09 17:17:55 -08:00
bin
b034458960 runtime: return hypervisor Pid in TaskExit event
Other RPC calls return Pid of hypervisor, the TaskExit should
return the same Pid.

Fixes: #1497

Signed-off-by: bin <bin@hyper.sh>
2021-03-09 17:41:44 +08:00
Eric Ernst
48ed8f3c4a runtime: add support for readonly sandbox bindmounts
If specified, sandbox_bind_mounts identifies host paths to be
mounted (ro) into the sandboxes shared path. This is only valid
if filesystem sharing is utilized.

The provided path(s) will be bindmounted (ro) into the shared fs directory on
the host, and thus mapped into the guest. If defaults are utilized,
these mounts should be available in the guest at
`/var/run/kata-containers/shared/containers/sandbox-mounts`

These will not be exposed to the container workloads, and are only
added for potential guest-services to consume (example: expose certs
into the guest that are available on the host).

Fixes: #1464

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-03-04 10:04:25 -08:00
Wainer dos Santos Moschetta
21bdaaf84f runtime: Fix missing 'name' field on containerd-shim-v2 logs
Each Kata Containers application should generate log records with a specified
structure. Currently on containerd-shim-v2's logs, the required 'name' field
is missing. This changed its logger to append the application name on each
and every emitted entries.

Fixes #1479
Related-to: github.com/kata-containers/tests/issues/3260
Suggested-by: James O. D. Hunt <james.o.hunt@intel.com>
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2021-03-01 16:52:24 -05:00
Bin Liu
61f0291d63 Merge pull request #1452 from lifupan/main
shimv2: return the hypervisor's pid as the container pid
2021-03-01 15:48:01 +08:00
Eric Ernst
ddb283dd43 Merge pull request #1475 from egernst/yiiiiikes
runtime: check if error loading runtime config
2021-02-26 15:01:22 -08:00
Eric Ernst
0f7098339b runtime: check if error loading runtime config
Looks like we inadvertantly removed the check on the loadRuntimeConfig
error return value. Adding back...

Fixes: #1474

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-02-26 10:51:38 -08:00
fupan.lfp
bc0ac526a2 shimv2: return the hypervisor's pid as the container pid
Since the kata's hypervisor process is in the network namespace,
which is close to container's process, and some host metrics
such as cadvisor can use this pid to access the network namespace
to get some network metrics. Thus this commit replace the shim's
pid with the hypervisor's pid.

Fixes: #1451

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2021-02-24 13:26:05 +08:00
Fabiano Fidêncio
4e494e34c9 packaging: Remove NEMU mentions
There's no more NEMU, for some time already.  Considering this, let's
just remove any mention to it as part of our project.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-02-23 14:24:54 +01:00
Fabiano Fidêncio
f21c54a985 kata-deploy: QEMU, for 2.x, already includes virtiofs
There's no reason to ship qemu & qemu-virtiofs when the former already
includes vitiofs support (and that's the default for 2.x deployments).

In case we will enable experimental qemu DAX support, we should add a
new target, a "qemu-experimental" target, as Carlos has been working on.

Fixes: #1424

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-02-23 14:24:48 +01:00
Eric Ernst
4f67bf919d Merge pull request #1344 from liubin/fix/1329-improvements-for-console-access
runtime: connect guest debug console bypass kata-monitor
2021-02-18 17:59:32 -08:00
David Gibson
72cb9287a0 vhost-user-blk: Use PciPath type for vhost user devices
VhostUserDeviceAttrs::PCIAddr didn't actually store a PCI address
(DDDD:BB:DD.F), but rather a PCI path.  Use the PciPath type and
rename things to make that clearer.

TestHandleBlockVolume previously used the bizarre value "0001:01"
which is neither a PCI address nor a PCI path for this value.  Change
it to a valid PCI path - it appears the actual value didn't matter for
that test, as long as it was consistent.

Forward port of
3596058c67

fixes #1040

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-19 09:56:08 +11:00
David Gibson
74f5b5febe runtime/block: Use PciPath type through block code
BlockDrive::PCIAddr doesn't actually store a PCI address
(DDDD:BB:DD.F) but a PCI path.  Use the PciPath type and rename things
to make that clearer.

TestHandleBlockVolume() previously used a bizarre value "0002:01" for
the "PCI address" which was neither an actual PCI address, nor a PCI
path.  Update it to use a PCI path - the actual value appears not to
matter in this test, as long as its consistent throughout.

Forward port of
64751f377b

fixes #1040

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-19 09:56:08 +11:00
David Gibson
32b40f5fe4 runtime/network: Use PciPath type through network handling
The "PCI address" returned by Endpoint::PciPath() isn't actually a PCI
address (DDDD:BB:DD.F), but rather a PCI path.  Rename and use the
PciPath type to clean this up and the various parts of the network
code connected to it.

Forward port of
3e589713cf

fixes #1040

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-19 09:56:08 +11:00
David Gibson
7e92831c7a protocols: Update PCI path names / terminology in agent protocol def
Now that we have types to represent PCI paths on both the agent and
runtime sides, we can update the protocol definitionto use clearer
terminology.

Note that this doesn't actually change the agent protocol, because it just
renames a field without changing its field ID or type.

While we're there fix a trivial rustfmt error in
src/agent/protocols/build.rs

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-19 09:56:08 +11:00
David Gibson
8e5fd8ee84 runtime: Introduce PciSlot and PciPath types
This is a dedicated data type for representing PCI paths, that is, PCI
devices described by the slot numbers of the bridges we need to reach
them.

There are a number of places that uses strings with that structure for
things.  The plan is to use this data type to consolidate their
handling.  These are essentially Go equivalents of the pci::Slot and
pci::Path types introduced in the Rust agent.

Forward port of
185b3ab044

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-02-19 09:56:05 +11:00
Chelsea Mafrica
a44b27291c runtime: Create tracer later in shimv2
Remove loading of configuration from New() because we do not know the
correct configuration file for the runtime until Create() and so that it
is not loaded more than once. Start tracer in create() so that it is
created after the runtime config is loaded in its original location.

Fixes #1411

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2021-02-17 19:45:48 -08:00
Eric Ernst
78a5958a81 Merge pull request #1402 from egernst/clh-hooks
runtime: clh-config: add runtime hooks to the clh toml
2021-02-17 12:49:58 -08:00
Eric Ernst
2e2749ad3f runtime: clh-config: add runtime hooks to the clh toml
Today hooks are only described in the QEMU toml. This shouldn't be VMM
specific -- let's make sure these are advertised for Cloud Hypervisor as
well.

Fixes: #1401

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-02-14 20:26:02 -08:00
Eric Ernst
3721351324 runtime: cpuset: when creating container, don't pass cpuset details
Today we only clear out the cpuset details when doing an update call on
existing container/pods. This works in the case of Kubernetes, but not
in the case where we are explicitly setting the cpuset details at boot
time. For example, if you are running a single container via docker ala:

docker run --cpuset-cpus 0-3 -it alpine sh

What would happen is the cpuset info would be passed in with the
container spec for create container request to the agent. At that point
in time, there'd only be the defualt number of CPUs available in the
guest (1), so you'd be left with cpusets set to 0. Next, we'd hotplug
the vCPUs, providing 0-4 CPUs in the guest, but the cpuset would never
be updated, leaving the application tied to CPU 0.

Ouch.

Until the day we support cpusets in the guest, let's make sure that we
start off clearing the cpuset fields.

Fixes: #1405

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-02-11 17:38:15 -08:00
Fabiano Fidêncio
e2c8c7e603 Merge pull request #1031 from knittl/feature/kata-option-aliases
cli: Add aliases for `kata-` options
2021-02-10 16:22:13 +01:00
Daniel Knittl-Frank
056d742c17 docs: Update documentation with new prefixless config options
Remove the old config options from the documentation and replace them
with the new form (without the redundant `kata-` prefix).

Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>
2021-02-10 07:55:18 +01:00
Daniel Knittl-Frank
02ee8b0b8a cli: Add aliases for kata- options
Remove `kata-` prefix from options `kata-config` and
`kata-show-default-config-paths`.

Fixes #1011

Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com>
2021-02-10 07:55:18 +01:00
bin
10f1c30f3d kata-runtime: use filepath.Join() to compose file path
Use filepath.Join() will be safer than format string directly.

Signed-off-by: bin <bin@hyper.sh>
2021-02-09 19:37:20 +08:00
bin
44cde6e464 runtime: connect guest debug console bypass kata-monitor
Parse agent socket address by conversation to improve usability of
using guest debug console.

Fixes: #1329

Signed-off-by: bin <bin@hyper.sh>
2021-02-09 19:36:48 +08:00
Fupan Li
5d1432210c Merge pull request #1352 from liubin/fix/migrate-opentracing-to-opentelemetry
runtime: migrate from opentracing to opentelemetry
2021-02-09 10:18:10 +08:00
bin
3406502706 runtime: add jaeger configuration items
add configuration items in Kata Containers
configuration file to let users specify jaeger
collector address, and user/password.

Signed-off-by: bin <bin@hyper.sh>
2021-02-09 08:02:05 +08:00
Chelsea Mafrica
38b5a43267 Merge pull request #1318 from jongwu/acpi
arm64: enable acpi for qemu/virt.
2021-02-03 16:37:49 -08:00
bin
17df9b119d runtime: migrate from opentracing to opentelemetry
This commit includes two changes:
- migrate from opentracing to opentelemetry
- add jaeger configuration items

Fixes: #1351

Signed-off-by: bin <bin@hyper.sh>
2021-02-03 17:30:49 +08:00
bin
b6c2a60509 kata-monitor: set buildmode to exe to avoid build failing
CGO_ENABLED=0 and -buildmode=pie are not compatible and may lead build failing in some OS.
Specify buildmode=exe to overwrite the value set in BUILDFLAGS

Fixes: #1343

Signed-off-by: bin <bin@hyper.sh>
2021-02-02 14:47:21 +08:00
Chelsea Mafrica
6be910bdc1 Merge pull request #1134 from egernst/kata-monitor-cleanup
kata-monitor: allow for building for alpine
2021-02-01 16:19:36 -08:00
James O. D. Hunt
de9487744f Merge pull request #1253 from snir911/fix-poststop
shimv2: log a warning and continue on post-stop hook failure
2021-02-01 14:44:39 +00:00
Jianyong Wu
b7a1f752c0 arm64: enable acpi for qemu/virt.
acpi is enabled for kata 1.x, port and rebase code for 2.x
including:
runtime: enable pflash;
agent: add acpi support for pci bus path;
packaging: enable CONFIG_RTC_DRV_EFI;

Fixes: #1317
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2021-01-29 22:12:43 +08:00
Carlos Venegas
3e3bfb9a42 Merge pull request #1321 from likebreath/clh_v0.12.0
versions: Update cloud-hypervisor to release v0.12.0
2021-01-26 17:07:02 -06:00
Bo Chen
c2d14cdeea versions: Update cloud-hypervisor to release v0.12.0
Highlights for cloud-hypervisor version v0.12.0 include: removal of
`vhost-user-net` and `vhost-user-block` self spawning, migration of
`vhost-user-fs` backend, ARM64 enhancements with full support of
`--watchdog` for rebooting, and enhanced `info` HTTP API to include the
details of devices used by the VM including VFIO devices.

Fixes: #1315

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-01-25 10:58:19 -08:00
Snir Sheriber
0e57393fcc shimv2: log a warning and continue on post-start hook failure
According to runtime-spec:
The poststart hooks MUST be invoked by the runtime. If any poststart
hook fails, the runtime MUST log a warning, but the remaining hooks
and lifecycle continue as if the hook had succeeded

Fixes: #1252

Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
2021-01-25 16:29:55 +02:00
Snir Sheriber
e7043fe284 shimv2: log a warning and continue on post-stop hook failure
According to runtime-spec:
The poststop hooks MUST be invoked by the runtime. If any
poststop hook fails, the runtime MUST log a warning, but
the remaining hooks and lifecycle continue as if the hook
had succeeded.

Fixes: #1252

Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
2021-01-25 16:29:47 +02:00
Carlos Venegas
6f3d591763 clh: Use vanilla kernel.
Qemu config alredy use vanilla kernel build for virtiofs.

Lets make cosisntent the usage of kernel.

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

Fixes: #1302

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-01-22 20:00:20 +00:00
Chelsea Mafrica
b24a2d2e48 Merge pull request #904 from cmaf/tracing-shimv2
shimv2: Add tracing to shimv2
2021-01-14 16:38:28 -08:00
Eric Ernst
789fd7c1c6 blk-dev: hotplug readonly if applicable
If a block based volume is read only, let's make sure we add as a RO
device

Fixes: #1246

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-01-12 14:50:54 -08:00
Eric Ernst
12777b26e4 volumes: cleanup / minor refactoring
Update some headers, very minor refactoring

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-01-12 14:50:47 -08:00
Eric Ernst
fbc1d123e8 vendor: revendor govmm
Update govmm to add RO blk hotplug support.

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-01-11 18:11:50 -08:00
GabyCT
a6d52d3da1 Merge pull request #1208 from GabyCT/topic/addgithu
github: Add github actions
2021-01-08 14:27:19 -06:00