3879 Commits

Author SHA1 Message Date
Julio Montes
c7745a3350 Merge pull request #662 from dgibson/fix611
drivers: Correct isPCIeDevice logic
2020-09-03 08:06:23 -05:00
David Gibson
92dfa4634b drivers: Correct isPCIeDevice logic
Currently, isPCIeDevice() attempts to determine if a (host) device is
PCI-Express capable by looking up its link speed via the PCI slots
information in sysfs.  This is a) complicated and b) wrong.  PCI-e
devices don't have to have slots information, so this frequently fails.

Instead determine if devices are PCI-e by checking for the presence of
PCIe extended configuration space by looking at the size of the "config"
file in sysfs.

Forward ported from 6bf93b23 in the Kata 1.x runtime repository.

Fixes: #611

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-09-03 14:32:00 +10:00
Jakob-Naucke
cf3ac9f72a docs: Add documentation for VFIO-AP passthrough
Add guide on how to pass a VFIO-AP device, such as Crypto Express cards
on IBM Z mainframes, to a Kata container. Like the documentation for
VFIO-PCI, this was put in the virtcontainers README.

Fixes: #658

Signed-off-by: Jakob-Naucke <jakob.naucke@ibm.com>
2020-09-02 15:22:52 +02:00
Julio Montes
d20ea14c8a Merge pull request #578 from Jakob-Naucke/vfio-ap-passthrough
runtime: Add support for VFIO-AP pass-through
2020-09-01 07:23:26 -05:00
Fupan Li
e429f79d36 Merge pull request #644 from devimc/2020-08-28/agent/updateCargoToml
agent: update Cargo files authors
2020-09-01 17:33:58 +08:00
Jakob-Naucke
1236e22475 runtime: Add support for VFIO-AP pass-through
Recognise when a device to be hot-plugged is an IBM Adjunct Processor
(AP) device and execute VFIO AP hot-plug accordingly. Includes unittest
for recognising and uses CCW for addDeviceToBridge in hotplugVFIODevice
if appropriate.

Fixes: #491

Signed-off-by: Jakob-Naucke <jakob.naucke@ibm.com>
Co-authored-by: Julio Montes <julio.montes@intel.com>
Reviewed-by: Alice Frosi <afrosi@redhat.com>
2020-09-01 10:41:49 +02:00
Peng Tao
76c18aa345 osbuilder: fix alpine agent build
Since we always build musl kata-agent, there is no need to build
it inside a musl container. We can just build on the host and then
copy the binary to the target rootfs.

There are still a lot to clean up and it should be made so for ALL
target distros instead of just alpine. But this is at least working
for alpine first.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-08-31 22:09:37 +08:00
Julio Montes
60245a83fa agent: update Cargo files authors
Anyone can collaborate in the Kata Containers project, so instead of
adding her/his name and email to the Cargo.toml files, use
`The Kata Containers community` as name and
`kata-dev@lists.katacontainers.io` as email.

fixes #643

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-08-31 08:47:10 -05:00
Julio Montes
7b54ef69f9 Merge pull request #645 from lifupan/fix_epthemeral_mount
Fix epthemeral mount issue
2020-08-31 08:14:54 -05:00
Peng Tao
a145f22ddf Merge pull request #615 from likebreath/disable_clh_seccomp
clh: Disable the 'seccomp' option temporarily
2020-08-31 18:34:36 +08:00
fupan.lfp
544219d9ad mount: fix the issue of epthemeral storage handler
For ephemeral storage handler, it should return an
empty string instead of the mount destination.

Fixes: #635

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-08-31 10:05:25 +08:00
fupan.lfp
fd8f3ee951 mount: add much more error info using chain_err
Make the return error  much more specifically by
chain much more error info.

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-08-31 10:05:12 +08:00
Qi Feng Huo
f5598a1bc2 Subject: [PATCH] qemu: add annotations for iommu_platform
for s390x virtio devices

Add iommu_platform annotations for qemu for ccw,
other supported devices can also make use of that.

  Fixes #603

Signed-off-by: Qi Feng Huo <huoqif@cn.ibm.com>
2020-08-28 11:25:14 +08:00
Julio Montes
ad7dce47ca Merge pull request #625 from Tim-Zhang/update-makefile
agent: Add target optimize for Makefile
2020-08-27 07:58:50 -05:00
Tim Zhang
32b86a8d8b agent: Add target optimize for Makefile
Run `make optimize` will strip the binary.

Fixes: #626

Signed-off-by: Tim Zhang <tim@hyper.sh>
2020-08-27 18:44:27 +08:00
James O. D. Hunt
fd3b9ff9ed Merge pull request #553 from jodh-intel/2.0-dev-agent-support-unix-address
server: Allow address to be specified
2020-08-27 11:43:34 +01:00
Bo Chen
4b62fc165e clh: Disable the 'seccomp' option temporarily
We kept observing instabilities from CLH CI jobs periodically (kata
1.x). To separate the random failures caused by `seccomp` from other
failures, this patch disables the 'seccomp' option from clh in kata for
now. We will bring this option back after completing the 'seccomp'
filter lists based on Kata's CI workload. Details are tracked in the
following two issues:
https://github.com/kata-containers/runtime/issues/2899 and
https://github.com/kata-containers/runtime/issues/2901

We are facing the similar challenge to stabilize CI jobs related to
cloud-hypervisor in Kata 2.0. We are disabling the `seccomp` option here
for the same reason. Related issue:
https://github.com/kata-containers/tests/issues/2813

Fixes: #614

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-26 12:31:51 -07:00
Eryu Guan
0a9b8e0ae2 rustjail: default permission of device node should be 666
Otherwise file owner in container may not read/write such devices.

Fixes: #570
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
2020-08-26 20:43:12 +08:00
Fupan Li
6f2eab40d3 Merge pull request #555 from jodh-intel/2.0-dev-agent-fix-shutdown-crash
console: Fix crash if debug console disabled
2020-08-26 19:59:27 +08:00
Bin Liu
b4c105336e Merge pull request #563 from bergwolf/guest-hooks
agent: support guest hooks
2020-08-26 17:36:32 +08:00
James O. D. Hunt
81644003eb server: Allow address to be specified
Allow the default (VSOCK) ttRPC server address to be changed using a new
`KATA_AGENT_SERVER_ADDR` environment variable (for testing and
debugging).

Fixes: #552.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-26 10:19:31 +01:00
Peng Tao
8e18cec804 Merge pull request #504 from cmaf/unit-virtcontainers-utils-utils
virtcontainers: Add to utils unit tests
2020-08-26 13:52:05 +08:00
Peng Tao
5fbac0a380 Merge pull request #556 from evanfoster/shutdown-agent
sandbox: Disconnect from agent after VM shutdown
2020-08-26 13:47:36 +08:00
Peng Tao
bb30759e4e agent: add guest hooks UT
To test the guest hooks implementation.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-08-26 13:35:01 +08:00
Peng Tao
095ebb8ca3 agent: fix OCI hook handling
We should call write_sync with proper arguments.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-08-26 11:18:02 +08:00
Peng Tao
03a4d107ba agent: support guest hooks
Scan guest hooks upon creating new sandbox and append
them to guest OCI spec before running containers.

Fixes: #485
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-08-26 11:18:02 +08:00
Peng Tao
e7bfeb418a agent: construct container bundle in tmpfs location
Save container spec under bundle path and bind mount container rootfs
under bundle path.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-08-26 11:18:02 +08:00
Julio Montes
60770f4629 Merge pull request #566 from Jakob-Naucke/revendor-govmm-vfio-ap
runtime: Re-vendor GoVMM for hotplugging IBM Adjunct Processor (AP) devices over VFIO
2020-08-25 08:46:25 -05:00
Julio Montes
e6757de2ac Merge pull request #543 from likebreath/clh_backporting
clh: Port cloud-hypervisor related changes from kata-runtime
2020-08-25 08:42:03 -05:00
Jakob-Naucke
4c30b2554f runtime: Re-vendor GoVMM for VFIO-AP support
This is a re-vendor of intel/govmm, with support for hot-plugging IBM
Adjunct Processor (AP) devices over VFIO. This is necessary for
enabling AP device pass-through in Kata (see #491).

    39c372a Add support for hot-plugging IBM VFIO-AP devices
    f5bdd53 travis: disable amd64 jobs
    1af1c0d github: enable github actions
    4831c6e travis: Run coveralls after success
    cf0f05d qemu: add iommu_platform knob for qemuParams
    175ac49 typo fix

Fixes: #565

Signed-off-by: Jakob-Naucke <jakob.naucke@ibm.com>
2020-08-25 10:35:11 +02:00
Evan Foster
282bff9f94 sandbox: Disconnect from agent after VM shutdown
When a one-shot pod dies in CRI-O, the shimv2 process isn't killed until
the pod is actually deleted, even though the VM is shut down. In this
case, the shim appears to busyloop when attempting to talk to the (now
dead) agent via VSOCK. To address this, we disconnect from the agent
after the VM is shut down.

This is especially catastrophic for one-shot pods that may persist for
hours or days, but it also applies to any shimv2 pod where Kata is
configured to use VSOCK for communication.

See github.com/kata-containers/runtime#2719 for details.
Fixes #2719

Signed-off-by: Evan Foster <efoster@adobe.com>
2020-08-24 09:53:28 -06:00
Peng Tao
ccfb73cb8c agent/agent-ctl: update Cargo.lock
rustc 1.45.2 would just ask for these depenedencies.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-08-24 19:31:08 +08:00
Chelsea Mafrica
fd13c93c6a virtcontainers: Add msg to existing utils unit tests
Add message to existing unit tests that use arrays and loops for easier
debugging.

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-08-23 19:49:40 -07:00
Chelsea Mafrica
c3fc09b95b virtcontainers: Add to utils unit tests
Expand unit tests for virtcontainers/utils/utils.go to include testing
CleanupFds, CPU calculations, ID string creation, and memory alignment
functions.

Fixes #490

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-08-23 19:49:40 -07:00
Snir Sheriber
965825564d docs: remove outdated dependencies from agent docs
switched from grpc to ttrpc (a7041c27d)

Fixes: #558

Signed-off-by: Snir Sheriber <snir911@gmail.com>
2020-08-23 14:26:40 +03:00
James O. D. Hunt
d12f920b3f console: Fix crash if debug console disabled
The logic for the debug console meant that if the debug console was
_disabled_, the agent was guaranteed to crash on function exit due to
the unsafe code block. Fixed by simplifying the code to use the standard
`Option` idiom for optional values.

Fixes: #554.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:58 +01:00
James O. D. Hunt
572de288f0 sandbox: Remove unnecessary thread
Don't create a thread to wait for the ttRPC server to end - it isn't
required as the operation should be blocked on.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:58 +01:00
James O. D. Hunt
d5fbba3b0a main: Remove commented out and redundant code
Remove confusing commented out code and some stray testing code.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:58 +01:00
James O. D. Hunt
1b2fe4a5be agent: Refactor main function
Move the sandbox creation into a new function.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:58 +01:00
James O. D. Hunt
bac79eeef0 main: Display config in announce
Add the configuration details in the announcement log call.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:58 +01:00
James O. D. Hunt
e2952b5354 main: Simplify version handling
Print a simple version string rather than delaying the output
to display a structured version string. The structured output
is potentially more useful but:

- This output is not consistent with other components.

- Delaying the output makes `--version` unusable in some
  environments (since a lot of setup is called before the
  version string can be output).

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-08-21 17:52:15 +01:00
Bo Chen
3ec05a9f95 clh: Add support to unplug block devices
[ Port from runtime commit 44b58e4151d1fc7debed41274b65c37233a437e3 ]

This patch enables kata+clh to unplug block devices, which is required
to pass cri-o integration tests.

Fixes: #461

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 14:00:24 -07:00
Bo Chen
45e32e1b77 clh: Set 'Id' explicitly while hotplugging block device
[ Port from runtime commit 03fb9c50c180d3359178c30e06f1122df312ae76 ]

To support unplug block device, we need to set the 'Id' explicitly while
hotplugging devices with cloud-hypervisor HTTP API.

Fixes: #461

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 14:00:21 -07:00
Jose Carlos Venegas Munoz
895959d007 clh: Provide cpu topology to API
[ Port from runtime commit 39897867bc89667daaafdd141367ec4a5fdc9247 ]

API now requires cpu topology.

Fixes: #461

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 14:00:18 -07:00
Jose Carlos Venegas Munoz
3159438701 clh: opeanapi: update api for cloud hypervisor
[ Port from runtime commit 40f49312a4881c904a1cbdace04c4c697bd2d429 ]

Update api geneated by openapi.

Fixes: #461

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 14:00:15 -07:00
Bo Chen
76a64667d5 clh: Remove the use of deprecated '--memory file=' parameter
[ Port from runtime commit 30b40f5505fd46d23b89eb5fb38301d2f7454f35 ]

Along with the release of cloud-hypervisor v0.8.0, this option has been
deprecated. clh now enforces to use the alternative controls,
e.g. "shared" and "hugepages", which can infer the backing file
paths. Also, we don't use "hugepages" in kata, so we are fine now as the
"shared" control  is already enabled.

Fixes: #461

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-08-20 13:51:43 -07:00
Yang Bo
03b7bc17de Merge pull request #499 from lifupan/2.0-dev
rustjail: add the "HOME" env for process
2020-08-19 09:35:06 +08:00
Yang Bo
485fc8ddc8 Merge pull request #531 from lifupan/propagation
rustjail: fix the issue of missing set propagation for bind mount
2020-08-19 09:33:53 +08:00
Julio Montes
2d28043cb2 Merge pull request #527 from devimc/2020-08-13/unittest/rustjail-process
agent: add unit tests for rustjail/process.rs
2020-08-18 12:08:31 -05:00
Bin Liu
37a331a1e8 Merge pull request #506 from lining2020/2.0-dev
virtcontainers: fix outdated example code in api document
2020-08-18 19:36:51 +08:00