Commit Graph

6012 Commits

Author SHA1 Message Date
Eric Ernst
a4c125a8b9 trace: move gRPC requests from debug to trace
There are many requests to the agent that happen with relatively
high frequency when a workload is running (checkRequest, as an example).

Let's move from Debug to Trace to avoid bombarding journal.

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-04-01 09:03:26 -07:00
Eric Ernst
50fff97753 trace: move trace span chatter to trace rather than info
No human should ever read that ouptut. Let's at least move it to trace for now.

Fixes: #1615

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-04-01 09:02:56 -07:00
Bin Liu
5b5b5cc611
Merge pull request #1539 from bergwolf/ut
fix runtime UTs and enable static check
2021-03-25 16:29:45 +08:00
Fabiano Fidêncio
deca207608
Merge pull request #1542 from fidencio/wip/kata-deploy-use-the-correct-image-for-alpha
kata-deploy: Use the correct tag for 2.1-alpha1 release
2021-03-25 08:32:06 +01:00
Carlos Venegas
753c7270ed
Merge pull request #1422 from jcvenegas/2021-02-17/experimental-virtiofs
ci: fix virtiofs-experimental build
2021-03-24 14:47:27 -06:00
Carlos Venegas
5a3ee7d7e9 snap: Use qemu.version to build snap
Use only one key to refer the version used by kata.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-24 17:52:52 +00:00
Carlos Venegas
0f78a5dc96 kernel: rename exeperimental kernel symlink.
use -experimental suffix instead of virtiofs

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-24 17:52:52 +00:00
Carlos Venegas
f79105231c qemu: Build experimental qemu.
Split qemu script to build qemu experimental using
same dockerfile.

Fixes: #1421

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

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-24 17:52:07 +00:00
James O. D. Hunt
2fc7f75724
Merge pull request #1521 from jodh-intel/verify-cid
Verify container ID
2021-03-24 13:27:58 +00:00
Peng Tao
fc0f93aef9 actions: enable unit tests in PR check
Right now we only run UTs for agent. We need to run it for *ALL*
components.

Fixes: #1538
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-24 20:12:14 +08:00
Peng Tao
74192d179d runtime: fix static check errors
It turns out we have managed to break the static checker in many
difference places with the absence of static checker in github action.
Let's fix them while enabling static checker in github actions...

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-24 20:10:19 +08:00
Peng Tao
a2dee1f6a0 runtime: fix vm factory UT failure
We need to use different mocked socket otherwise they conflict with each
other.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-24 18:21:21 +08:00
Peng Tao
076bc5075f agent-ctl: update Cargo.lock
Just build would result in these diffs. Let's include them in git.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-24 15:03:52 +08:00
Peng Tao
0153f76b07 runtime: gofmt code
Looks like we have merged a lot of code that is not properly formated.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-24 14:37:46 +08:00
Bin Liu
018454be44
Merge pull request #1534 from Tim-Zhang/rework-execute_hook
rustjail: rework execute_hook
2021-03-24 14:09:09 +08:00
Fabiano Fidêncio
60f6315b2d kata-deploy: Use the correct tag for 2.1-alpha1 release
Let's ensure we use the appropriate tag for the release, even before it
was actually created.

Fixes: #1493

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2021-03-24 00:29:03 +01:00
Carlos Venegas
b0e51e59fa qemu: Improve cache build
Add arguments and files as needed, if only of them
changes the build will start from the change and
not from scratch.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-23 20:52:39 +00:00
Carlos Venegas
bc587da9f5 qemu: Add suffix for qemu binaries.
To build different qemu versions with the
same qemu code add a prefix on install.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-23 20:52:39 +00:00
Carlos Venegas
5493517b4f qemu: add CACHE_TIMEOUT
Add docker ARG to provide a date to invalid cache, if the date changes
the image will be rebuild. This is required to keep build dependencies
with security fixes, but still take advantage of build qemu faster using
docker cache.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-23 20:52:39 +00:00
Carlos Venegas
98d01ce6b9 qemu: Apply patches for specific versions.
Today we apply patches per base branch. Having
two qemu versions in a similar base version can make
can have problems if one of the trees already has a patch.
If a patch is needed only for one specific tag/commit
add only the patch to that version.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-23 20:52:39 +00:00
Tim Zhang
40861fbab5
Merge pull request #1517 from jodh-intel/agent-server-address-cmdline
agent: Allow server address to be specified on kernel command-line
2021-03-23 19:33:25 +08:00
Peng Tao
190f813427 runtime/katautils: PFlash should be initialized
newQemuHypervisorConfig() sets it to an empty slice. We have to set the
same in the test config otherwise it is nil and reflect DeepEqual would
fail.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-23 17:49:47 +08:00
Peng Tao
b2ec5a43d5 runtime: fix cleanupSandboxBindMounts panic
Found in UT:
--- FAIL: TestKataCleanupSandbox (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-23 16:44:47 +08:00
Peng Tao
9b689ea1d7 runtime/cli: fix TestMainBeforeSubCommandsLoadConfigurationFail failure
Now that it is `kata-config`...

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-23 16:40:38 +08:00
Peng Tao
8e71c4fc7a runtime: fix missing context argument in mocked sandbox APIs
Missing context.Context in several APIs.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-23 16:19:46 +08:00
Peng Tao
8ff62beeb4 runtime: fix vcmock build failure
github.com/kata-containers/kata-containers/src/runtime/virtcontainers/pkg/vcmock
virtcontainers/pkg/vcmock/container.go:19:10: cannot use c.MockSandbox
(type *Sandbox) as type virtcontainers.VCSandbox in return argument:
        *Sandbox does not implement virtcontainers.VCSandbox (missing
	GetHypervisorPid method)
github.com/kata-containers/kata-containers/src/runtime/pkg/katautils

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-03-23 15:57:07 +08:00
Tim Zhang
0e4b28e838 rustjail: rework execute_hook
Fixes: #1532

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-03-22 20:20:30 +08:00
Bin Liu
dd6da22a11
Merge pull request #1525 from Tim-Zhang/disconnect-get-oom
agent: disconnect rpc get_oom_event when destroy_sandbox.
2021-03-22 15:19:31 +08:00
Chelsea Mafrica
7da3bdc68e
Merge pull request #1363 from eadamsintel/qat-docs
docs: Update QAT instructions to work with Kata 2.0 repos
2021-03-19 18:33:19 -07:00
David Gibson
89e5fa7a2f
Merge pull request #1506 from dgibson/bug1505
agent: Update Cargo.lock for earlier dependency change
2021-03-20 11:34:32 +11:00
Chelsea Mafrica
8c1abc3b57
Merge pull request #1418 from Amulyam24/fix-docker-ppc64le
osbuiler: fixing USE_DOCKER for ppc64le
2021-03-19 17:22:12 -07:00
Chelsea Mafrica
f26db684c8
Merge pull request #1508 from dgibson/bug1507
agent: Fix unused import warning in unit tests
2021-03-19 14:20:00 -07:00
Chelsea Mafrica
3369fc8b4b
Merge pull request #1514 from fgiudici/port_cgroup_fix
[forwardport] Fixup systemd cgroup handling
2021-03-19 14:18:03 -07:00
Chelsea Mafrica
16c6c1e272
Merge pull request #1389 from cmaf/fix-span-ordering
runtime: Fix ordering of trace spans
2021-03-19 13:07:42 -07:00
Carlos Venegas
a09e58fa80 packaging: Use local file for assets.
When kata used multiple repositories, versions file was
downloaded. This is not needed anymore as the file is part
of the same repository.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-19 15:50:41 +00:00
James O. D. Hunt
451b45f9d7 agent: Make use of test consts for error messages
Make use of the `const` values for error messages that were previously
only used for the unit tests. This guarantees consistency.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-03-19 09:17:31 +00:00
Tim Zhang
8c4d3346d4 agent: disconnect rpc get_oom_event when destroy_sandbox.
Otherwise it would block the shutdown of ttrpc.

Fixes: #1524

Signed-off-by: Tim Zhang <tim@hyper.sh>
2021-03-19 16:42:37 +08:00
Carlos Venegas
07cfa4ce22 qemu: patches: Fail if not patches directory
Fail if not patches directory is found.  Help to prevent
build a new qemu version with missing patches.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-18 20:07:40 +00:00
Carlos Venegas
e221c45d7a versions: Update qemu database
Only use 'version' key to build qemu..

The version could be used as any valid target:
branch, tag or commit.

Using different keys to build is confusing.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-18 19:37:35 +00:00
Carlos Venegas
5abdd2aaf0 qemu: move 5.0.0 patches to its own dir.
Some patches has conflicts with old experimental kernel. Move patches to its own specific version.

Signed-off-by: Carlos Venegas <jos.c.venegas.munoz@intel.com>
2021-03-18 19:25:55 +00:00
Adams, Eric
259c179162 docs: Update QAT instructions to work with Kata 2.0 repos
This fixes the guide to work with the Kata 2.0 repos and provide more
details on how to verify with ctr and kubernetes.

Fixes: #1362

Signed-off-by: Adams, Eric <eric.adams@intel.com>
2021-03-18 11:19:46 -07:00
James O. D. Hunt
34e7d5ed97 agent: Validate CID
Validate the container ID as we cannot / should not rely on the
container manager / runtime to do this.

Fixes: #1520.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-03-18 11:19:34 +00:00
James O. D. Hunt
b265870997 runtime: Validate CID
Validate the container ID as we cannot rely on the container manager
doing this.

Fixes: #1520.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-03-18 11:19:32 +00:00
James O. D. Hunt
12e9f7f82c runtime: Add missing test mock function
Added a missing `vcmock.Sandbox.GetHypervisorPid()` function.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-03-17 10:37:47 +00:00
James O. D. Hunt
ea51c17b64 agent: Allow server address to be specified on kernel command-line
To make debugging and testing easier, allow the ttRPC server address to
be specified via `/proc/cmdline` as `agent.server_addr=`.

Fixes: #1516.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2021-03-17 08:22:03 +00:00
Chelsea Mafrica
4bf84b4b2f runtime: Add contexts to calls in unit tests
Modify calls in unit tests to use context since many functions were
updated to accept local context to fix trace span ordering.

Fixes #1355

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2021-03-16 17:39:28 -07:00
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
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