Commit Graph

1241 Commits

Author SHA1 Message Date
Bo Chen
c33ee54a21 clh: Support VFIO device unplug
This patch adds the support of VFIO device unplug when using
cloud-hypervisor.

Fixes: #860

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-05 12:20:13 -07:00
Bo Chen
1f4dfa3166 clh: Remove unnecessary VmmPing
We can rely on the error handling of the actual HTTP API calls to catch
errors, and don't need to call VmmPing explicitly in advance.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-05 12:17:45 -07:00
Bo Chen
cc80ae0afb versions: cloud-hypervisor: Bump to version 6d30fe05
The cloud-hypervisor commit `6d30fe05` introduced a fix on its API for
VFIO device hotplug (`VmAddDevice`), which is required for supporting
VFIO unplug through openAPI calls in kata.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-10-05 12:13:36 -07:00
Julio Montes
ea1cb37b59 versions: cloud-hypervisor: bump version
Use commit c54452c08a467a3e35d8d72f2a91d424e9718c57 as
version for cloud-hypervisor.
Bring openapi fix cloud-hypervisor/cloud-hypervisor#1760 to
support SGX.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-01 08:24:29 -05:00
Julio Montes
0ebffdf29f runtime: cloud-hypervisor: tag openapi-generator-cli container
Tag openapi-generator-cli container to v4.3.1 that is the latest
stable, this way we can have reproducible builds and the same
generated code in all the systems

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-01 08:24:29 -05:00
Julio Montes
6df165c19d runtime: add support for SGX
Support the `sgx.intel.com/epc` annotation that is defined by the intel
k8s plugin. This annotation enables SGX. Hardware-based isolation and
memory encryption.

For example, use `sgx.intel.com/epc = "64Mi"` to create a container
with 1 EPC section with pre-allocated memory.

At the time of writing this patch, SGX patches have not landed on the
linux kernel project.
The following github kernel fork contains all the SGX patches for the
host and guest: https://github.com/intel/kvm-sgx

fixes #483

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-10-01 08:24:29 -05:00
Peng Tao
414b906e9c Merge pull request #747 from Kvasscn/fix-warning-in-device-manager-test
devices: fix go test warning in manager_test.go
2020-09-30 20:37:20 +08:00
Peng Tao
496ac0a4f5 Merge pull request #516 from liubin/feature/472-integrate-fc-metrics
fc: integrate Firecracker's metrics
2020-09-29 21:30:37 +08:00
bin liu
757dfa70e6 fc: integrate Firecracker's metrics
Firecracker expose metrics through fifo file
and using a JSON format. This PR will parse the
Firecracker's metrics and convert to Prometheus metrics.

Fixes: #472

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-28 15:20:02 +08:00
Peng Tao
5611283ec5 runtime: fix golint errors
Need to run gofmt -s on them.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-28 11:01:07 +08:00
Peng Tao
1569b3b32a docs: fix static check errors
Somehow we are not running static checks for a long time.
And that ended up with a lot for errors.

* Ensure debug options are valid is dropped
* fix snap links
* drop extra CONTRIBUTING.md
* reference kata-pkgsync
* move CODEOWNERS to proper place
* remove extra CODE_OF_CONDUCT.md.
* fix spell checker error on Developer-Guide.md

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-09-28 11:01:03 +08:00
Peng Tao
5596eaa31d Merge pull request #441 from liubin/feature/245-add-debug-console
kata 2.0: add debug console service
2020-09-28 10:06:13 +08:00
Peng Tao
ac6f020c6c Merge pull request #697 from keloyang/destroy
runtime: Call s.newStore.Destroy if globalSandboxList.addSandbox
2020-09-27 16:30:24 +08:00
bin liu
484a595f1a runtime: add enable_debug_console configuration item for agent
Set enable_debug_console=true in Kata's congiguration file,
runtime will pass `agent.debug_console`
and `agent.debug_console_vport=1026` to agent.

Fixes: #245

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-27 15:04:59 +08:00
bin liu
febdf8f68c runtime: add debug console service
Add `kata-runtime exec` to enter guest OS
through shell started by agent

Fixes: #245

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-27 10:57:17 +08:00
zhanghj
07d339c788 devices: fix go test warning in manager_test.go
Create "class" and "config" file in temporary device BDF dir,
and remove dir created  by ioutil.TempDir() when test finished.

fixes: #746

Signed-off-by: zhanghj <zhanghj.lc@inspur.com>
2020-09-26 20:46:12 -04:00
Bo Chen
a34478ffa5 runtime: Update cloud-hypervisor client pkg to version v0.10.0
The latest release of cloud-hypervisor v0.10.0 contains the following
updates: 1) `virtio-block` Support for Multiple Descriptors; 2) Memory
Zones; 3) `Seccomp` Sandbox Improvements; 4) Preliminary KVM HyperV
Emulation Control; 5) various bug fixes and refactoring.

Note that this patch updates the client code of clh's HTTP API in kata,
while the 'versions.yaml' file was updated in an earlier PR.

Fixes: #789

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-09-23 17:37:34 -07:00
Shukui Yang
3523167d20 runtime: Call s.newStore.Destroy if globalSandboxList.addSandbox
Fixes: #696

Signed-off-by: Shukui Yang <keloyangsk@gmail.com>
2020-09-22 22:47:57 +08:00
Ychau Wang
1839dfd95a runtime: Clear the VCMock 1.x API Methods from 2.0
Clear the 1.x branch api methods in the 2.0. Keep the same methods to
the VC interface, like the VCImpl struct.

Fixes: #751

Signed-off-by: Ychau Wang <wangyongchao.bj@inspur.com>
2020-09-18 16:30:12 +08:00
Peng Tao
7e33e36f4a Merge pull request #698 from liubin/feature/146-add-cgroup-v2-for-agent
agent: add cgroup v2 support
2020-09-18 14:45:38 +08:00
bin liu
d7c77b69dc runtime: write oom file to notify CRI-O tha OOM occurred
CRI-O is not use event like containerd, it's depending on
file name `oom` to dectect if an OOM occurred.

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-16 10:35:28 +08:00
bin liu
15065e4472 agent: add cgroup v2 support
This PR add basic cgroup v2 support for agent.

Fixes: #146, #357

Signed-off-by: bin liu <bin@hyper.sh>
2020-09-15 10:38:55 +08:00
zhanghj
2ce97ec680 virtiofsd: fix typo in test code
fix typo in virtiofsd_test.go

Fixes: #712

Signed-off-by: zhanghj <zhanghj.lc@inspur.com>
2020-09-14 05:35:10 -04:00
James O. D. Hunt
1a734bbb79 Merge pull request #668 from cmaf/unit-virtcontainers-utils-compare
virtcontainers: Add unit test for utils/compare.go
2020-09-08 11:35:28 +01:00
Chelsea Mafrica
fd3ce81518 Merge pull request #672 from c3d/200903-spelling
trivial: Fix spelling of "privilege"
2020-09-04 12:58:18 -07:00
Christophe de Dinechin
dd60e56f28 trivial: Fix spelling of "privilege"
I noticed the spelling mistake while reviewing another change and
doing a "grep" for "privilege" that turned up nothing.

Fixes: #671

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-09-04 11:31:09 +02:00
Christophe de Dinechin
6e54767344 Merge pull request #663 from dgibson/machinne
runtime: Fix typo in hotplugVFIODevice()
2020-09-04 09:58:34 +02:00
David Gibson
cb9993759b runtime: Fix typo in hotplugVFIODevice()
"machineType" is misspelled as "machinneType".

Fixes: #670

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-09-04 14:28:51 +10:00
Chelsea Mafrica
0d198f930e virtcontainers: Add unit test for utils/compare.go
Add unit test for virtcontainers/utils/compare.go to increase overall
coverage.

Fixes #661

Signed-off-by: Chelsea Mafrica <chelsea.e.mafrica@intel.com>
2020-09-03 13:38:43 -07:00
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
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
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
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
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
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
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
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
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
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
Li Ning
2511cabbc3 virtcontainers: fix outdated example code in api document
Some type declarations were changed. The example code here is outdated
according to the example_pod_run_test.go under virtcontainers directory.
And add the imports to make where the types from clear.

Fixes: #507

Signed-off-by: Li Ning <lining_yewu@cmss.chinamobile.com>
2020-08-18 17:42:18 +08:00
bin liu
e7d3ba12d0 virtcontainers: cleanup codes, delete not used APIs
Some APIs are not used anymore.

Fixes: #517

Signed-off-by: bin liu <bin@hyper.sh>
2020-08-13 15:28:09 +08:00