Commit Graph

4890 Commits

Author SHA1 Message Date
Bo Chen
8b5eed70f7 clh: Enable disk block device hotplug support
[ port from runtime commit c5f97b24d7a1eaac216f144b2c5429feb3451553 ]

With this patch, the container image can be shared from host with guest
as a block device when the 'devicemapper' is used as the storage driver
for docker. Note: The 'block_device_driver="virtio-blk"' entry is
required in the hypervisor config file to work properly.

Signed-off-by: Bo Chen <chen.bo@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 19:58:00 -07:00
Xu Wang
c20179ee0e
Merge pull request #353 from bergwolf/runtime-port-2
runtime port -- wave 2
2020-06-30 10:49:39 +08:00
fupan.lfp
883af9c76f agent: set hostname when running as init
it's better to set the right hostname to
guest when run rust-agent as the init process.

Fixes: #355

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-06-29 19:38:48 +08:00
fupan.lfp
899b75f2de agent: fix the issue of missing found right shell
It should iter the shells to find the existing shell
command instead of return an error directly when it
meet an absent shell command.

Fixes: #354

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
2020-06-29 19:38:34 +08:00
Hui Zhu
e761ad318f
Merge pull request #352 from bergwolf/runtime-port-1
port runtime commits -- wave 1
2020-06-29 16:33:02 +08:00
Peng Tao
2a8650baa1 agent-ctl: add Cargo.lock
A binary cargo should go with Cargo.lock

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:27:50 -07:00
Peng Tao
a8430b3791 gitignore: ignore more files
We don't need to track them.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:27:05 -07:00
Christophe de Dinechin
be9ca0d58b qemu: Don't leak file descriptors in case of error
[ port from runtime commit 7b269ff7aa2d62fe12593ff7040798e6c9bd5d65 ]

If we take one of the error paths from setupVirtiofsd() after
opening the fd variable, the fd.Close() function is not called.

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:19:18 -07:00
Jose Carlos Venegas Munoz
60606647de virtiofsd: Improve logging
[ port from runtime commit 882a82393305a4b11a77744b5fc77b98e42d15b9 ]

Send virtiofsd logs to syslog in the same way that qemu implementation
does. This requires not to wait for messages from virtiofsd stdout. This
takes the qemu implementation approach. Give the socket fd to virtiofsd.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:16:08 -07:00
Alex Price
7e250f29e9 shim: exit out of oom polling if unimplemented
[ port from runtime commit 86f581068eb9dc4b6862c7415cdc912e111177dd ]

This exits out of polling for OOM events if the getOOMEvent
method is unimplemented.

Signed-off-by: Alex Price <aprice@atlassian.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:11:54 -07:00
Alex Price
9f8d1baa57 virtcontainers: tests fix, nit fix
[ port from runtime commit b4833a48c81132e5a6b1c25a764cd0ebbdc6afff ]

fix tests and nit

Signed-off-by: Alex Price <aprice@atlassian.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:08:54 -07:00
Liam Merwick
d3b3e8bee6 virtcontainers: x86: Support microvm machine type
[ port from runtime commit 6aff077901021d9a0075c446dfe281b2487e1487 ]

With the addition of support to govmm for multiple transports (intel/govmm#111)
and microvm (intel/govmm#121) we can now enable support for the 'microvm'
machine type in kata-runtime.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 01:06:30 -07:00
Alex Price
198339367b virtcontainers: add support for getOOMEvent agent endpoint to sandbox
[ port from runtime commit 86686b56a2bf7f6dd62f620278ae289564da51d0 ]

This adds support for the getOOMEvent agent endpoint to retrieve OOM
events from the agent.

Signed-off-by: Alex Price <aprice@atlassian.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 00:51:23 -07:00
Alex Price
7c205be27d virtcontainers: add support for getOOMEvent agent endpoint to sandbox
[ port from runtime commit 86686b56a2bf7f6dd62f620278ae289564da51d0 ]

This adds support for the getOOMEvent agent endpoint to retrieve OOM
events from the agent.

Signed-off-by: Alex Price <aprice@atlassian.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 00:42:08 -07:00
Peng Tao
380f07ec4b proto: update agent protocol
To add GetOOMEvent API.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-29 00:34:38 -07:00
James O. D. Hunt
dbc1c30d9e versions: Remove golangci-lint and gometalinter entries
Removed the `golangci-lint` and `gometalinter` entries from the versions database:

- The `golangci-lint` package is now tracked in the `tests` versions database:

  https://github.com/kata-containers/tests/blob/master/versions.yaml

- The `gometalinter` package is no longer used.

See:

- https://github.com/kata-containers/tests/issues/1323
- d676140510

Fixes: #2636.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-06-28 20:51:51 -07:00
Jia He
6e7dd435a2 qemu: arm64: Set defaultGICVersion to 3 to limit the max vCPU number
[ port from runtime commit ee985a608015d81772901c1d9999190495fc9a0a ]

After removing dectect of host gic version, we need to limit the max vCPU
in different cases.

Given that in most cases, Kata is running on gicv3 host, set it as default
value. If the user really want to run Kata on gicv2 host, he/she need to
set default_maxvcpus in toml file to 8 instead of 0.

In summary, If the user uses host gicv3 gicv4, everything is fine
            If the user uses host gicv2, set default_maxvcpus=8

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:48:48 -07:00
Wainer dos Santos Moschetta
93d1f7b4e3 Subject: [PATCH] versions: Misc changes to descriptions
[ port from runtime commit c4b5922df2 ]

Most of the description fields have capitalized text,
some of those that don't are then converted on this
change.

Fixed spelling of 'required'.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:45:21 -07:00
Jia He
17b3021b54 Subject: [PATCH] qemu: arm64: Don't detect gic version by /proc/interrupts
[ port from runtime repository commit 4d4a153af5cb145215cb6e6e386eac2bcb8c3e32 ]

Commit b4385901da ("qemu/arm64: Detect host GIC version to configure guest
GIC") reads /proc/interrupts to detect the host gic version.

But on a ThunderX2 host with 224 cpus, the /proc/interrupts is ~762K bytes.
Hence it will costs ~900K bytes memory overhead.
From the go tool pprof results:
      flat  flat%   sum%        cum   cum%
  976.89kB   100%   100%   976.89kB   100%  github.com/kata-containers/runtime/virtcontainers.getHostGICVersion
Although the allocated memory will be freed, seems it worthy removing that
for speed up the runtime.

As per [1], there is no perfect way to detect the gic version on host.
At qemu side, if we use "gic-version=host", qemu will automatically detect
the verion by kvm ioctl. So we'd better let qemu determine the gic version.

If the user really want to start vm with gic-verion=2, he/she can set it
in machine_accelerators option.

[1]https://lists.cs.columbia.edu/pipermail/kvmarm/2014-October/011690.html

Signed-off-by: Jia He <justin.he@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:43:16 -07:00
Penny Zheng
4cda90abcb dax: enable dax on arm64
[ port from runtime repository commit e36389e25e ]

After backporting patch series of enabling memory hot remove on aarch64
to v5.4.x, we finally could enable nvdimm/dax on aarch64.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:40:41 -07:00
Peng Tao
7a44025464 Makefile: add trace-forwarder/agent-ctl missing targets
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:36:33 -07:00
Ted Yu
61e011e86b vc: Version support check is ineffective in createSandbox
[ port from runtime repository commit 7e47046111 ]

If major version matches max supported major, we continue comparing the minor version.

Signed-off-by: Ted Yu <yuzhihong@gmail.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-28 20:32:55 -07:00
Fupan Li
0c5ace57d5
Merge pull request #346 from bergwolf/builder
osbuilder: use newest golang
2020-06-28 17:16:55 +08:00
Fupan Li
acab606f98
Merge pull request #344 from bergwolf/build
Fix make file and trace-forwarder build failure
2020-06-28 17:16:00 +08:00
Peng Tao
ebfbca031b osbuilder: use newest golang
Instead of the oldest one.

Fixes: #345
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-27 20:42:30 -07:00
Peng Tao
0fd1eb59a4 Makefile: add default rule
Otherwise `make` would only build the agent.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-27 20:16:53 -07:00
Peng Tao
3f8d4b6822 trace-forwarder: add Cargo.lock
And rely on protobuf 2.14.0. Otherwise build fails as protobuf 2.15.0
requires unstable cargo.

error[E0658]: non-builtin inner attributes are unstable

Fixes: #343
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-27 20:16:40 -07:00
Peng Tao
e587abe6b4
Merge pull request #333 from jodh-intel/improve-toplevel-makefile
build: Improve top-level Makefile
2020-06-26 16:20:01 +08:00
Peng Tao
a3d77bc0d1
Merge pull request #338 from amshinde/remove-workaround-sharedpid
shimv2 : Remove workaround for sharedPidNs
2020-06-26 16:18:48 +08:00
Peng Tao
9d90906546
Merge pull request #320 from dgibson/cleanups
Clean up some unnecessary data structures
2020-06-26 16:18:16 +08:00
Xu Wang
af4d85c257
Merge pull request #339 from bergwolf/2.0.0-alpha2
release: Kata Containers 2.0.0-alpha2
2020-06-26 15:50:29 +08:00
Peng Tao
fe5b54b38d release: Kata Containers 2.0.0-alpha2
Version bump no changes.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-25 19:02:52 -07:00
Xu Wang
f1945a4680
Merge pull request #335 from bergwolf/cleanup
cleanup: remove redundant files
2020-06-26 10:00:52 +08:00
Archana Shinde
b68d4e45ee shimv2: Removing function as no longer used
Function removeNamespace is no longer used. Get rid of
it.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2020-06-25 16:50:56 -07:00
Archana Shinde
f570a2cd40 shimv2 : Remove workaround for sharedPidNs
Removing code that existed as a workaround for a bug in
how shared process namespaces were handled in the agent.
That has been long fixed in the agent.
With this, sharedPidNs will now work with shimv2.

Fixes #337

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2020-06-25 16:50:39 -07:00
James O. D. Hunt
b2cc403eca build: Improve top-level Makefile
Define a set of functions that support the standard rules (build,
install, test, *etc*). Then simply add new components and tools to the
appropriate variable to support all the standard build semantics.

Fixes #331.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-06-25 11:19:12 +01:00
James O. D. Hunt
f2a19966b2 agent: Rename check rule to test
Changed the name of the rule that runs the tests to "test" for
consistency, but retained `check` for backwards compatibility
for now.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2020-06-25 11:18:23 +01:00
Peng Tao
a1ef594d2a cleanup: remove redundant files
And use top level VERSION for all components.

Fixes: #334
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-24 15:57:23 -07:00
Peng Tao
3bbb97add3
Merge pull request #312 from Pennyzct/network_throttle_on_qemu
rate-limiter: network I/O throttling on VM level
2020-06-25 04:59:44 +08:00
Peng Tao
bee02d47ed
Merge pull request #310 from fidencio/wip/forward_port_c3d_and_ted_yu_patches
[forward port] Bring to the development branch fixes provided by Christophe De Dinechin and Ted Yu.
2020-06-25 04:57:48 +08:00
Salvador Fuentes
5925ed491a
Merge pull request #330 from bergwolf/add-docs
merge documentation and packaging repository
2020-06-24 09:57:32 -05:00
David Gibson
ea1d799f79 qemu: Only one element of qemuPaths map is relevant
The qemuPaths field in qemuArchBase maps from machine type to the default
qemu path.  But, by the time we construct it, we already know the machine
type, so that entry ends up being the only one we care about.

So, collapse the map into a single path.  As a bonus, the qemuPath()
method can no longer fail.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-06-24 21:26:43 +10:00
David Gibson
5dffffd432 qemu: Remove useless table from qemuArchBase
The supportedQemuMachines array in qemuArchBase has a list of all the
qemu machine types supported for the architecture, with the options
for each.  But, the machineType field already tells us which of the
machine types we're actually using, and that's the only entry we
actually care about.

So, drop the table, and just have a single value with the machine type
we're actually using.  As a bonus that means the machine() method can
no longer fail, so no longer needs an error return.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-06-24 21:26:38 +10:00
David Gibson
97a02131c6 qemu: Detect and fail a bad machine type earlier
Currently, newQemuArch() doesn't return an error.  So, if passed an invalid
machine type, it will return a technically valid, but unusable qemuArch
object, which will probably fail with other errors shortly down the track.

Change this, to more cleanly fail the newQemuArch itself, letting us
detect a bad machine type earlier.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-06-24 21:07:33 +10:00
David Gibson
d6e7a58ac9 qemu: Clarify test with bad machine type
The last stanza of TestQemuAmd64Bridges is rather odd.  It tries to create
a qemu instance with a machine type of (QemuQ35 + QemuPC), or in other
words "q35pc", which isn't a thing.

What it's asserting about this is that the returned bridges list is empty
despite asking for bridges, so it looks like what this is really trying to
test is for sane behaviour when given a bad machine type.

So, split this out into a separate test, and make it explicit for clarity.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2020-06-24 21:02:17 +10:00
Peng Tao
e29546016e readme: fix reference to packaging tools
As we have merged it here.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-24 03:32:15 -07:00
Hui Zhu
b1a1d8e500
Merge pull request #328 from bergwolf/bump-golang
Bump golang version to 1.14.4
2020-06-24 17:52:46 +08:00
Penny Zheng
541fd58791 rate-limiter: add rate limiter unit test
add TestRxRateLimiter and TestTxRateLimiter unit tests

Fixes: #250

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2020-06-24 06:17:07 +00:00
Penny Zheng
d3098c56f6 rate-limiter: remove tc-based rate limiter
Removing tc-based rate limiter includes removing htb qdiscs, ifb
interfaces if created, etc.

Fixes: #250

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2020-06-24 06:17:07 +00:00
Penny Zheng
08551287b1 rate-limiter: add tc-based tx rate limiter
Implement tc-based tx rate limiter to control network I/O outbound traffic
on VM level for hypervisors which don't support built-in rate limiter.
We take different actions, based on various inter-networking models.
For tcfilters as inter-networking model, we simply apply htb
qdisc discipline on the virtual netpair.
For other inter-networking models, such as macvtap, we resort to ifb,
by redirecting interface ingress traffic to ifb egress, and then apply htb
to ifb egress.

Fixes: #250

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2020-06-24 06:17:07 +00:00