Commit Graph

5612 Commits

Author SHA1 Message Date
Julio Montes
af04d71feb
Merge pull request #1105 from jodh-intel/2.0-dev-fix-kata-check-version-cmp
release: Fix release candidate to major version upgrade check
2020-11-12 09:26:21 -06:00
James O. D. Hunt
8f38265be4 release: Fix release candidate to major version upgrade check
Fix `kata-runtime kata-check`'s network version check which was failing
when the user was running a release candidate build and the latest
release was a major one, two examples of the error being:

- `BUG: unhandled scenario: current version: 1.12.0-rc0, latest version: 1.12.0`
- `BUG: unhandled scenario: current version: 2.0.0-rc0, latest version: 2.0.0`

Fixes: #1104.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-12 10:07:18 +00:00
James O. D. Hunt
2e0bf40adb tests: Ensure semver build metadata is ignored
According to the Semantic Versioning specification, build metadata must
be ignored for version comparisions, so add some explicit tests for this
scenario to `TestGetNewReleaseType()`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-12 10:06:15 +00:00
James O. D. Hunt
4024a8274b release: Make error format string consistent
Use `%s` for both semver parameters.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-12 10:04:00 +00:00
Fupan Li
671a2be313
Merge pull request #1094 from liubin/fix/991
runtime: sleep 1 second after GetOOMEvent failed
2020-11-11 14:33:57 +08:00
Peng Tao
9dbd1007d7
Merge pull request #1070 from jing-wang4/readme
Agent: README updates for build on ppc64le
2020-11-11 10:15:22 +08:00
Peng Tao
3c88106f65
Merge pull request #1084 from liubin/fix/1081-clean-codes
runtime: clean/refactor code
2020-11-11 10:09:10 +08:00
Christophe de Dinechin
9511b17819
Merge pull request #1045 from c3d/issue/1044-forward-port-annotation-doc
Forward port annotation doc
2020-11-10 11:34:23 +01:00
bin liu
cb0e6094ff runtime: sleep 1 second after GetOOMEvent failed
In some cases, for example agent crashed and not marked dead yet, the GetOOMEvent
will return errors like `connection reset by peer` or `ttrpc: closed`. Do a sleep
with 1 second (agent check interval) and let agent health check to do the check.

Fixes: #991

Signed-off-by: bin liu <bin@hyper.sh>
2020-11-10 12:02:31 +08:00
Bo Chen
359ab16a8f
Merge pull request #1090 from likebreath/1106/clh_upgrade_v0.11.0
versions: Update cloud-hypervisor to release v0.11.0
2020-11-09 15:51:09 -08:00
Archana Shinde
5444a31f7b
Merge pull request #1092 from yuchunyu97/patch-1
docs: Add instructions for enabling VM templating
2020-11-09 15:50:12 -08:00
Christophe de Dinechin
4c78814bda docs: Fix pre-existing spelling mistakes caught by the CI
The documentation contains existing spelling mistakes that are caught by the CI
and prevent checking in. The errors include:

    INFO: Spell checking file 'docs/how-to/how-to-load-kernel-modules-with-kata.md'
    WARNING: Word 'configurated': did you mean one of the following?: configuration, reconfigured, Confederate, confederate
    WARNING: Word 'cri': did you mean one of the following?: cir, crib, chi, cry, Fri, crier
    ERROR: Spell check failed for file: 'docs/how-to/how-to-load-kernel-modules-with-kata.md'
    INFO: spell check failed for document docs/how-to/how-to-load-kernel-modules-with-kata.md
    INFO: Spell checking file 'docs/how-to/how-to-set-sandbox-config-kata.md'
    INFO: Spell check successful for file: 'docs/how-to/how-to-set-sandbox-config-kata.md'
    ERROR: spell check failed, See https://github.com/kata-containers/documentation/blob/master/Documentation-Requirements.md#spelling for more information.

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-11-09 16:52:33 +01:00
Christophe de Dinechin
6c083d9410 docs: Add a link to document describing how to use annotations
Add a link to the document listing the available annotations

Fixes: #1044
Forward-port-of: https://github.com/kata-containers/documentation/pull/757

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-11-09 16:50:26 +01:00
Christophe de Dinechin
d67921a2af docs: Document restricted annotations
Document restricted annotations, as implemented in
https://github.com/kata-containers/kata-containers/pull/902

Fixes: #1044
Forward-port-of: https://github.com/kata-containers/documentation/pull/755

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-11-09 16:50:26 +01:00
Christophe de Dinechin
1fc7b7641d docs: Repair inconsistencies between 2.0 and 1.x
The documentation `how-to/how-to-set-sandbox-config-kata.md` contains a number
of differences relative to the 1.x variant, which do not seem to correspond to
missing features in the actual code.

Fixes: #1046

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
2020-11-09 16:50:26 +01:00
Peng Tao
2e65a48a11
Merge pull request #1093 from fidencio/wip/reverting-revert-cri-o-bump
Revert "version: revert back to crio 1.8.3"
2020-11-09 22:43:22 +08:00
Fabiano Fidêncio
21801a11a7 versions: Revert "version: revert back to crio 1.8.3"
This reverts commit ff13bde3c1, which
moved back CRI-O to v1.18.3.

The was, IMHO, a little bit premature.  We want to know exactly what are
the issues on v1.18.4, solve those, and be prepared for a v1.18.5 bump
(or even a bump to a specific commit, if needed).

Just for the sake of the completeness, v1.18.4 caused a regression on
"k8s-copy-file" tests, which is tracked on CRI-O side as
https://github.com/cri-o/cri-o/issues/4353.

Fixes: #1080

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2020-11-09 13:45:01 +01:00
bin liu
b8414045bf runtime: remove nsenter
remove code for nsenter

Fixes: #1081

Signed-off-by: bin liu <bin@hyper.sh>
2020-11-09 11:42:51 +08:00
bin liu
e3510be867 runtime: use one line if statement to check if err is nil for qemu.go
Use `if err := q.qmpSetup(); err != nil` to reduce code and make it easy
to read. And remove checking err if last function call also return an error,
return the function call directly.

Fixes: #1081

Signed-off-by: bin liu <bin@hyper.sh>
2020-11-09 11:42:45 +08:00
Fupan Li
d22c7cf00b
Merge pull request #1013 from liubin/feature/1012-dump-guest-memroy-on-panic
Dump guest memory when kernel panic for QEMU
2020-11-09 09:46:28 +08:00
AIsland
378308e205 docs: Add instructions for enabling VM templating
Kata 2.0 uses virtio-fs as the shared_fs by default,

bug VM templating cannot be used with virtio-fs.

Fixes: #1091

Signed-off-by: AIsland <yuchunyu01@inspur.com>
2020-11-07 14:20:01 +08:00
Bo Chen
92c1c4c690 versions: Update cloud-hypervisor to release v0.11.0
The release v0.11.0 of cloud-hypervisor features the following changes:
1) Improved Linux Boot Time, 2) `SIGTERM/SIGINT` Interrupt Signal,
Handling 3) Default Log Level Changed, 4) `io_uring` support by default
for `virtio-block` (on host kernel version 5.8+), 5) Windows Guest
Support, 6) New `--balloon` Parameter Added, 7) Experimental
`virtio-watchdog` Support, 8) Bug fixes.

Fixes: #1089

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-11-06 16:19:31 -08:00
Archana Shinde
6160043c01
Merge pull request #1077 from likebreath/1103/clh_refactor_device_unplug
clh: Consolidate the code path for device unplug
2020-11-06 16:00:56 -08:00
James O. D. Hunt
b85914c960
Merge pull request #979 from jodh-intel/2.0-dev-show-ttrpc-logs
agent: Log ttrpc messages
2020-11-06 13:45:48 +00:00
James O. D. Hunt
8907a33907 agent: Only show ttrpc logs for trace log level
Only display the `ttrpc` crate log output when full logging
(trace level) is enabled.

This is a slight abuse of log levels but provides developers and testers
what they need whilst also keeping the logs relatively quiet for the
default info log level (the `ttrpc` crate logging is a bit "chatty").

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-06 10:45:05 +00:00
James O. D. Hunt
21cd7ad172 agent: Log ttrpc messages
The `ttrpc` crate uses the `log` crate for logging. But the agent uses
the `slog` crate. This means that currently, all `ttrpc` log messages
are being discarded.

Use the `slog-stdlog` create to redirect `log` crate logging calls into
`slog` so they are visible in the agents log output.

Fixes: #978.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-06 10:05:02 +00:00
James O. D. Hunt
286eebf087 agent: Add env var to set log level
Add support for a `KATA_AGENT_LOG_LEVEL` environment variable for testing.
This is the equivalent to the `agent.log=` kernel command line option.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-06 10:05:02 +00:00
James O. D. Hunt
b9c6db4bb8 agent: Add env var tests
Add some tests for the existing `KATA_AGENT_SERVER_ADDR` environment
variable feature.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-06 10:05:02 +00:00
James O. D. Hunt
705e995589 agent: Add env var comment
Add a comment stating what the server address environment variable is
for.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-06 10:05:02 +00:00
Peng Tao
c7a2b12fab
Merge pull request #1086 from jodh-intel/2.0-dev-fix-annotations
annotations: Improve asset annotation handling
2020-11-06 10:29:22 +08:00
Bin Liu
a68e200462
Merge pull request #1062 from bergwolf/ro-volume
runtime: readonly volume should be bind mounted readonly on the host
2020-11-06 10:26:57 +08:00
James O. D. Hunt
5ced96e96d hypervisor: Remove unused methods
Deleted `HypervisorConfig`'s unused  `CustomFirmwareAsset()` and
`JailerAssetPath()` methods.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-05 12:15:47 +00:00
James O. D. Hunt
e82c9daec3 annotations: Improve asset annotation handling
Make `asset.go` the arbiter of asset annotations by removing all asset
annotations lists from other parts of the codebase.

This makes the code simpler, easier to maintain, and more robust.

Specifically, the previous behaviour was inconsistent as the following
ways:

- `createAssets()` in `sandbox.go` was not handling the following asset
  annotations:

    - firmware:
      - `io.katacontainers.config.hypervisor.firmware`
      - `io.katacontainers.config.hypervisor.firmware_hash`

    - hypervisor:
      - `io.katacontainers.config.hypervisor.path`
      - `io.katacontainers.config.hypervisor.hypervisor_hash`

    - hypervisor control binary:
      - `io.katacontainers.config.hypervisor.ctlpath`
      - `io.katacontainers.config.hypervisor.hypervisorctl_hash`

    - jailer:
      - `io.katacontainers.config.hypervisor.jailer_path`
      - `io.katacontainers.config.hypervisor.jailer_hash`

- `addAssetAnnotations()` in the `oci` package was not handling the
  following asset annotations:

    - hypervisor:
      - `io.katacontainers.config.hypervisor.path`
      - `io.katacontainers.config.hypervisor.hypervisor_hash`

    - hypervisor control binary:
      - `io.katacontainers.config.hypervisor.ctlpath`
      - `io.katacontainers.config.hypervisor.hypervisorctl_hash`

    - jailer:
      - `io.katacontainers.config.hypervisor.jailer_path`
      - `io.katacontainers.config.hypervisor.jailer_hash`

This change fixes the bug where specifying a custom hypervisor path via an
asset annotation was having no effect.

Fixes: #1085.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-05 12:15:42 +00:00
James O. D. Hunt
0f26f1cd6f annotations: Add missing hypervisor control annotation
Add missing annotation definitions for a hypervisor control binary:

- `io.katacontainers.config.hypervisor.ctlpath`
- `io.katacontainers.config.hypervisor.hypervisorctl_hash`

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-05 12:12:58 +00:00
James O. D. Hunt
76064e3e2d asset: Formatting, grammar and whitespace
Improve formatting, grammar and whitespace.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-05 12:12:51 +00:00
bin liu
40418f6d88 runtime: add geust memory dump
When guest panic, dump guest kernel memory to host filesystem.
And also includes:
- hypervisor config
- hypervisor version
- and state of sandbox

Fixes: #1012

Signed-off-by: bin liu <bin@hyper.sh>
2020-11-05 16:04:21 +08:00
Peng Tao
ff13bde3c1 version: revert back to crio 1.8.3
This reverts commit 87848e874e as it is
breaking the k8s configMap test.

Fixex: #1080
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-11-05 14:48:32 +08:00
Peng Tao
a958eaa8d3 runtime: mount shared mountpoint readonly
bindmount remount events are not propagated through mount subtrees,
so we have to remount the shared dir mountpoint directly.

E.g.,
```
mkdir -p source dest foo source/foo

mount -o bind --make-shared source dest

mount -o bind foo source/foo
echo bind mount rw
mount | grep foo
echo remount ro
mount -o remount,bind,ro source/foo
mount | grep foo
```
would result in:
```
bind mount rw
/dev/xvda1 on /home/ubuntu/source/foo type ext4 (rw,relatime,discard,data=ordered)
/dev/xvda1 on /home/ubuntu/dest/foo type ext4 (rw,relatime,discard,data=ordered)
remount ro
/dev/xvda1 on /home/ubuntu/source/foo type ext4 (ro,relatime,discard,data=ordered)
/dev/xvda1 on /home/ubuntu/dest/foo type ext4 (rw,relatime,discard,data=ordered)
```

The reason is that bind mount creats new mount structs and attaches them to different mount subtrees.
However, MS_REMOUNT only looks for existing mount structs to modify and does not try to propagate the
change to mount structs in other subtrees.

Fixes: #1061
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-11-04 17:51:49 +08:00
Peng Tao
125e21cea3 runtime: readonly mounts should be readonly bindmount on the host
So that we get protected at the VM boundary not just the guest kernel.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-11-04 17:51:49 +08:00
Bin Liu
259589ad89
Merge pull request #1051 from yuchunyu97/patch-1
docs: Fix incorrect docs in config file
2020-11-04 17:46:21 +08:00
Bin Liu
045fc2f7a2
Merge pull request #1052 from yuchunyu97/patch-2
CI: Fix incorrect URL
2020-11-04 16:53:56 +08:00
AIsland
5f0abc20f0 CI: Fix incorrect URL
Correct the link in the GitHub action commit message check showing users how to format all commits.

Fixes: #1053

Signed-off-by: AIsland <yuchunyu01@inspur.com>
2020-11-04 10:05:20 +08:00
AIsland
b6f8a1d5af docs: Fix incorrect docs in config file
Correct the default configuration of [hypervisor.qemu] shared_fs in configuration-qemu.toml to virtio-fs in kata 2.0.

Fixes: #1054

Signed-off-by: AIsland <yuchunyu01@inspur.com>
2020-11-04 09:58:02 +08:00
Bo Chen
93d7962510 clh: Consolidate the code path for device unplug
In cloud-hypervisor, it provides a single unified way of unplugging
devices, e.g. the `/vm.RemoveDevice` HTTP API. Taking advantage of this
API, we can simplify our implementation of `hotplugRemoveDevice` in
`clh.go`, where we can consolidate similar code paths for different
device unplug (e.g. no need to implement `hotplugRemoveBlockDevice` and
`hotplugRemoveVfioDevice` separately). We will only need to retrieve the
right `deviceID` based on the type of devices, and use the single
unified HTTP API for device unplug.

Fixes: #1076

Signed-off-by: Bo Chen <chen.bo@intel.com>
2020-11-03 15:46:38 -08:00
James O. D. Hunt
43ec107d94
Merge pull request #1066 from jodh-intel/2.0-dev-update-readme
docs: Update top-level README
2020-11-03 16:05:55 +00:00
Jing Wang
18a2245986 Agent: README updates for build on ppc64le
README updates for agent build on ppc64le

  Fixes: #1069

Signed-off-by: Jing Wang <jing.wang4@ibm.com>
2020-11-03 15:29:43 +00:00
Jing Wang
655f2649b3 Agent: README updates for build on ppc64le
README updates for agent build on ppc64le

  Fixes: #1069

Signed-off-by: Jing Wang <jing.wang4@ibm.com>
2020-11-03 15:24:08 +00:00
James O. D. Hunt
62c7e09405 docs: Remove credits
Removed the packagecloud credits since we no longer produce distro
packages for Kata 2.x.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-03 11:38:59 +00:00
James O. D. Hunt
679df0fb77 docs: Update top-level README
Rework the top-level README to reflect the current use of this
repository.

Fixes: #1064.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-11-03 11:38:57 +00:00
Chelsea Mafrica
32505af7bb
Merge pull request #1037 from GabyCT/topic/updatecrio
versions: Update crio version
2020-11-02 16:58:22 -08:00