Commit Graph

1442 Commits

Author SHA1 Message Date
James O. D. Hunt
2bc03f23e0 katatestutils: Fix version check bug
Fix version comparison bug whereby the specified operator was being
applied to the wrong version number.

The version handling for distro and kernel versions was incorrect. This
was not clear as the internal logic was rather difficult to understand.
Renaming `constraintInvalid()` to `constraintValid()` and updating
`NotValid()` correspondingly makes the logic clearer and exposed the
bug, allowing it to be fixed.

Added two new tests to ensure correct behaviour:

- `TestConstraintNotValidKernelVersion()`
- `TestConstraintNotValidDistroVersion()`

Fixes #1653.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-05-09 15:35:29 +01:00
James O. D. Hunt
1bec735cb6 katatestutils: Fix NeedDistroVersionEquals comment
Previously, the comment on `NeedDistroVersionEquals()` erroneously
referred to `NeedDistroVersionLT()`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-05-09 15:00:21 +01:00
James O. D. Hunt
20b558656d katatestutils: Reset TestConstraints fields on NotValid() call
`TestConstraint.NotValid()` is really designed to be called once per
test. However, there is no reason it should not be possible to call
multiple times. But to allow for that secenario, any settings
from a previous `NotValid()` call need to be cleared.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-05-09 14:56:38 +01:00
Eric Ernst
a7935d419e
Merge pull request #1633 from mcastelino/topic/fc-fixes
firecracker: Setup rootfs to be RO
2019-05-08 09:30:02 -07:00
Graham Whaley
7327f8a77b
Merge pull request #1631 from mcastelino/topic/fc_0_16_0
firecracker: Upgrade firecracker to 0.16.0
2019-05-08 09:54:03 +01:00
Manohar Castelino
5e9cb48b8f firecracker: Setup rootfs to be RO
Setup rootfs to be RO both from the VMM point of view and the
VM point of view.

Fixes: #1632

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2019-05-07 15:03:28 -07:00
Manohar Castelino
93e6ad1f4f firecracker: Upgrade firecracker to 0.16.0
Upgrade firecracker to 0.16.0

Fixes: #1626

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2019-05-07 14:44:02 -07:00
Eric Ernst
9a27ac29bc
Merge pull request #1016 from stefanha/virtio-fs-core
Add virtio-fs support (alternative to virtio-9p)
2019-05-07 11:19:58 -07:00
Salvador Fuentes
4c5527f8a8
Merge pull request #1606 from devimc/topic/virtcontainers/fixCpuTopology
virtcontainers: fix invalid CPU topology
2019-05-07 10:13:27 -05:00
Stefan Hajnoczi
0a69eb8fff kata-env: add SharedFS option to output
It's useful to know whether virtio-9p or virtio-fs is being used.  Add
the status to the kata-env output.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-05-05 11:32:34 -06:00
Dr. David Alan Gilbert
75f75862c2 virtiofs: Add cache option
Several cache modes are supported by virtio-fs.  They affect the
performance and consistency characteristics of the file system.

For the time being cache="none" is recommended, but the other modes can
be experimented with.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-05-05 11:32:34 -06:00
Dr. David Alan Gilbert
6767c1a358 virtiofs: Add cache size option
Add VirtioFSCacheSize aka virtio_fs_cache_size option
to set the size (in MiB) of the DAX cache.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
2019-05-05 11:32:34 -06:00
Stefan Hajnoczi
82d1a9d6f4 kata_agent: use virtio-fs shared dir in CreateSandbox
Use virtio-fs instead of virtio-9p when virtio-fs is enabled.

Fixes: #1542
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-05-05 11:32:34 -06:00
Stefan Hajnoczi
9480978364 qemu: add vhost-user-fs-pci device instead of 9p
When enable_virtio_fs is true, add a vhost-user-fs-pci for the
kataShared volume instead of 9p.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-05-05 11:32:34 -06:00
Hui Zhu
a7e2bbd31c
Merge pull request #1621 from mcastelino/topic/fc_bootparams
Firecracker: Fix kernel command line parameters
2019-05-05 11:05:13 +08:00
Hui Zhu
954d9cea80
Merge pull request #1560 from egernst/fc-bump
Firecracker: update to version v0.15.2
2019-05-04 11:07:09 +08:00
Manohar Castelino
c15577565e Firecracker: Fix kernel command line parameters
Firecracker does not support pci. It also uses kbd to implement reboot/reset.
Fix the kernel boot params to address this.

It also does not have good entropy at startup. Use the hardware random
number generator to support entropy.

Fixes: #1620

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2019-05-03 16:08:56 -07:00
Graham Whaley
ea71133d1a
Merge pull request #1558 from amshinde/ignore-floppy-drives
devices: Skip floppy drives while passing devices to guest
2019-05-03 17:34:11 +01:00
Graham Whaley
b5b1c38bc4
Merge pull request #1587 from jodh-intel/add-test-skip-utils
Add test skip utils
2019-05-03 16:04:26 +01:00
Eric Ernst
fada1e94b0
Merge pull request #1614 from mcastelino/topic/firecracker_015
firecracker: Add support for v0.15.x
2019-05-02 17:37:53 -06:00
Eric Ernst
2051dac527
Merge pull request #1615 from mcastelino/topic/fc_cpu_mem
firecracker: Add support for default VM configuration
2019-05-02 15:22:03 -06:00
Manohar Castelino
b496f3f71d firecracker: Add support for default VM configuration
Kata support specifing the default VM configuration via
configuration.toml. This allows the system or cluster admin
to choose the default (i.e minimum) size of the VM.

Add support in kata to respect the VM configuration for firecracker.

Also refactor some code to make error handling uniform.

Fixes: #1594

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2019-05-02 17:06:11 +00:00
Manohar Castelino
f75b7fed7e firecracker: Add support for v0.15.x
Add support for v0.15.x. Change the drive naming scheme to match
the requirement of v0.15.x

Fixes: #1598

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2019-05-02 16:47:15 +00:00
James O. D. Hunt
23f7cfa9f4 tests: Update test code to use test constraints
Updated the test code to use the new test constraints feature.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-05-02 15:42:35 +01:00
James O. D. Hunt
8e144e08e6 pkg: Add test constraints feature
Enhance the `katatestutils` package to provide the ability to skip
tests based on either user or distro the tests are running on.

Fixes #1586.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-05-02 15:42:33 +01:00
James O. D. Hunt
570eff653f
Merge pull request #1610 from jodh-intel/fix-virtcontainers-makefile
build: Fix virtcontainers static check make target
2019-05-01 17:11:59 +01:00
Stefan Hajnoczi
d690dff164 config: add virtio_fs_daemon string
Add a config option for the virtio-fs vhost-user daemon path.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-05-01 10:55:31 -04:00
Stefan Hajnoczi
9e87fa21cf config: add shared_fs option
Add a config option to select between virtio-9p and virtiofs.  This
option currently has no effect and will be used in a later patch.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-05-01 10:55:31 -04:00
Stefan Hajnoczi
0217077a36 vendor: update govmm
Shortlog:
b3e7a9e Merge pull request #91 from stefanha/virtio-fs-cache-size-mb
058cda0 qemu: use MiB instead of Gib for virtio-fs cache size

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2019-05-01 09:59:53 -04:00
James O. D. Hunt
2f020f5a52
Merge pull request #1597 from devimc/topic/virtcontainers/ShimPrintsAgentLogs
virtcontainers: Use shim to print the agent logs if there is no proxy
2019-05-01 14:47:48 +01:00
Fupan Li
98d60532ec
Merge pull request #1601 from Ace-Tang/exit_status
shim v2: fix set status when container exit
2019-05-01 19:51:29 +08:00
James O. D. Hunt
9f87e7870c build: Fix virtcontainers static check make target
The virtcontainers `Makefile` was referencing an old script to handle
static checks. Although these are still run if `make` is invoked at the
top-level, correct the error.

Fixes #1609.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-04-30 09:18:22 +01:00
Hui Zhu
4cc8e1a2d0
Merge pull request #1599 from Ace-Tang/list
cli: do not fail on list when some containers bust
2019-04-30 16:01:16 +08:00
Julio Montes
fa5de87d84 virtcontainers: fix invalid CPU topology
sockets * cores * threads should be equal to maxcpus otherwise a
warning is thrown: 'warning: Invalid CPU topology deprecated:
    sockets * cores * threads != maxcpus'

This warning in the future will be an error and won't be possible to run
kata containers.

fixes #1605

Signed-off-by: Julio Montes <julio.montes@intel.com>
2019-04-29 15:13:53 -05:00
Ace-Tang
b7f51be8ce cli: do not fail on list when some containers bust
kata-runtime list command should list all valid container, not fail
when some containers information uncorrent, like rootfs not found.

Fixes: #1592

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-04-29 17:04:15 +08:00
Ace-Tang
854cc86e8d shimv2: fix set status when container exit
in wait function, should send msg to exit channel after task status has
updated, since shim.Wait() is running in another goroutine, when it
receive msg from exit channel, it will stop waiting and return, then
someone who hold this Wait() get return, it can delete task, if exit msg
is send first, the container status may still be running.

Fixes: #1600

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-04-29 13:22:26 +08:00
Julio Montes
582f20f489 virtcontainers: Use shim to print the agent logs if there is no proxy
The proxy is in charge to print the agent logs, but when `use_vsocks` is true
the runtime doesn't start the proxy, because it's not needed, hence the agent
logs are ignored. To mitigate this limitation and to make the debugging
processes easier, the fist shim started (the one who monitors the sandbox)
will read the console.sock and print the agent logs.

Depends-on: github.com/kata-containers/shim#172

fixes #1596

Signed-off-by: Julio Montes <julio.montes@intel.com>
2019-04-26 13:15:44 -05:00
Eric Ernst
437b3cb2f7
Merge pull request #1585 from rbradford/nemu-release-with-virtiofs
versions: Bump NEMU version to latest release
2019-04-25 21:12:55 -07:00
Archana Shinde
b5aa8d4f67
Merge pull request #1577 from chavafg/topic/revert-mount-pr
Revert "vc: change container rootfs to be a mount"
2019-04-25 09:41:15 -07:00
Graham Whaley
f4fe31e74d
Merge pull request #1442 from jodh-intel/add-agent-trace-support
Add agent trace support
2019-04-25 14:12:54 +01:00
Rob Bradford
da0ae03222 versions: Bump NEMU version to latest release
This release is based off of QEMU 4.0 and also includes support for
virtio-fs.

Fixes: #1580

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-04-25 12:35:10 +01:00
James O. D. Hunt
ed64240df2 agent: Support Kata agent tracing
Add configuration options to support the various Kata agent tracing
modes and types. See the comments in the built configuration files for
details:

- `cli/config/configuration-fc.toml`
- `cli/config/configuration-qemu.toml`

Fixes #1369.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-04-25 09:41:13 +01:00
James O. D. Hunt
b573d9bcb9 vendor: Update for agent tracing and fix issues
Updated the agent vendoring for `StartTracing` and `StopTracing`. This
only changed a single file - the auto-generated gRPC protocol
buffer file.

This change resolves four vendoring issues:

- The github.com/kubernetes-incubator/cri-o project was renamed to
  github.com/cri-o/cri-o. Although github redirects, `dep` complains that
  it cannot find the old `github.com/kubernetes-incubator/cri-o` files
  under `vendor/` so remove the old config, relying on the existing (and
  in other respects identical) `dep` config.

- There was a stale dependency on `github.com/clearcontainers/proxy`
  which should have been removed when the Clear Containers code was
  excised.

- The latest version of the agent code vendored into the runtime prior
  to this commit was a merge commit (commit
  `48dd1c031530fce9bf16b0f6a7305979cedd8fc9`). This somehow confused `dep`
  which did *not* correctly pull in the latest version of the
  auto-generated gRPC code
  (`vendor/github.com/kata-containers/agent/protocols/grpc/agent.pb.go`).
  This is clear because commit `48dd1c031530fce9bf16b0f6a7305979cedd8fc9`
  is newer than the agent commit that introduced the `StartTracing` and
  `StopTracing` APIs (`00cf907afcb7c8e56f077cf45ae3615f612fdc9d`).

  Resolving the other two issues above seems to have resolved this issue
  as the correct version of this file has now been included in the
  vendoring, however note there is no change to the `dep` files as this
  version of `agent.pb.go` should already have been included (!)

- Updating `agent.pb.go` also removed the `AddInterface` and
  `RemoveInterface` API calls which should again also have been removed
  already.

  Updated tests to remove these redundant calls.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-04-25 09:40:02 +01:00
James O. D. Hunt
b309dc5480 agent: Provide explicit config options for the agent
Previously, the agent behaviour was controlled entirely using the
`kernel_params=` config option. This mechanism suffers from a subtle
problem - the runtime is not aware of how the agent will behave.

From now on, all significant agent options will be controlled from the
agent section in the configuration file. This allows the runtime to be
more aware of -- and in control of -- such agent settings. It would also
allow the underlying kernel CLI options to be modified in the future if
required.

This PR adds the only useful agent option as an explicit option by
adding an `enable_debug=true` option to the Kata agent section in
`configuration.toml`. This allows controlling agent debug to be handled
in the same manner as the other debug options.

This change is somewhat foundational: it permits the agent to be handled
consistently with other config file sections which is useful, but
arguably not essential (the old way worked). However, the new way of
handling agent options will be essential when introducing agent tracing
control as the runtime must be aware of the agent trace mode to allow
the runtime to modify its behaviour accordingly.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-04-24 17:14:01 +01:00
James O. D. Hunt
87d91710b9 utils: Remove code duplication
Replace the two versions of `makeRuntimeConfigFileData()` with a single
`MakeRuntimeConfigFileData()` in a new `katatestutils` package and a new
`katautils.GetDefaultHypervisorConfig()` to query the default hypervisor
details.

This isn't ideal but a new package had to be created to avoid circular
dependencies. It was also required since test code cannot be exported
from a package.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-04-24 17:14:01 +01:00
James O. D. Hunt
ed248cef3b shim: Removed unused type and correct error message
Removed the unused `KataShimConfig` type and updated an error message
that incorrectly mentioned it.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-04-24 17:14:01 +01:00
James O. D. Hunt
97beb2b2d4 errors: Create a new standard error for invalid config
Refactor a common error into a new standard error object.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-04-24 17:14:01 +01:00
James O. D. Hunt
e803a7f870 agent: Return an error, not just an interface
Make `newAgentConfig()` return an explicit error rather than handling
the error scenario by simply returning the `error` object in the
`interface{}` return type. The old behaviour was confusing and
inconsistent with the other functions creating a new config type (shim,
proxy, etc).

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-04-24 17:14:01 +01:00
Julio Montes
63e1c440a1
Merge pull request #1393 from zhabinecho/noarp-feature
network: pass network interface RawFlags to agent
2019-04-23 12:14:49 -05:00
Salvador Fuentes
bc9b9e2af6 vc: Revert "vc: change container rootfs to be a mount"
This reverts commit 196661bc0d.

Reverting because cri-o with devicemapper started
to fail after this commit was merged.

Fixes: #1574.

Signed-off-by: Salvador Fuentes <salvador.fuentes@intel.com>
2019-04-23 08:56:36 -05:00