Commit Graph

5325 Commits

Author SHA1 Message Date
Wei Zhang
4a298cb9b7 persist: address comments
Address some comments.

Signed-off-by: Wei Zhang <weizhang555@gmail.com>
2020-01-08 10:03:56 +08:00
Wei Zhang
d33b154dd7 persist: add interface for global read/write
Add two interfaces for fs storage driver for supporting global writing
and reading, which is used by ACRN.

Signed-off-by: Wei Zhang <weizhang555@gmail.com>
2020-01-08 10:03:56 +08:00
Jose Carlos Venegas Munoz
3b6a837664
Merge pull request #115 from jcvenegas/fix-114
version: Add VERSION file
2020-01-07 14:42:55 -06:00
Jose Carlos Venegas Munoz
8d60612052 version: Add VERSION file
Needed by some CI scripts, like release or to verify stable
branches state.

Fixes: #114

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2020-01-07 19:25:33 +00:00
Jose Carlos Venegas Munoz
3ce2d362a3 release: tag and branch kata-containers repository
Now CI depends on this repository, needed to make work stable
branches starting stable-1.10

Fixes: #894

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2020-01-07 15:51:03 +00:00
James O. D. Hunt
e0df9739bf
Merge pull request #110 from GabyCT/topic/addmake
ci: Add minimal makefile to use central go test script
2020-01-06 09:19:59 +00:00
Hui Zhu
bf50d1811c
Merge pull request #112 from yyyeerbo/wip
netlink: pull out netlink as library crate.
2020-01-06 13:44:06 +08:00
Yang Bo
a5192a16e8 netlink: pull out netlink as library crate.
Fixes: #111

Signed-off-by: Yang Bo <yb203166@antfin.com>
2020-01-04 06:45:52 -08:00
Gabriela Cervantes
3881c06578 ci: Add minimal makefile to use central go test script
This adds a basic Makefile where we can use a central go test script
in order to run the tests for the CI.

Fixes #109

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2020-01-03 10:04:09 -06:00
Wei Zhang
ed4a1954e4 persist: remove unused struct
Remove unused struct from persist structures.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
2019-12-30 18:42:15 +08:00
Wei Zhang
8e88859ee4 persist: remove all usage of VCStore
Remove VCStore usage from all modules

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
2019-12-30 18:42:15 +08:00
Wei Zhang
01b4a64be2 persist: remove VCStore from sandbox/apis
Remove VCStore usage from sandbox.

Signed-off-by: Wei Zhang <weizhang555@gmail.com>
2019-12-30 18:41:02 +08:00
Wei Zhang
b63e517f6d persist: replace sandbox lock with newstore.Lock
Replace rLockSandbox and rwLockSandbox with new store lock functions.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
2019-12-30 18:41:02 +08:00
Wei Zhang
508101bc0f persist: fix vmtemplate storage leak
Fix VM template storage leak by adding delete operations, we need to
delete sandbox storage dirs when stop VM.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
2019-12-30 18:41:02 +08:00
Wei Zhang
29b55ab88b persist: remove VCStore from container
Remove VCStore from container struct.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
2019-12-30 18:41:02 +08:00
Wei Zhang
633748aa76 persist: remove VCStore from hypervisor
Remove usage of VCStore from hypervisors.

Signed-off-by: Wei Zhang <weizhang555.zw@gmail.com>
2019-12-30 18:39:39 +08:00
Wei Zhang
687f2dbe84 persist: move "newstore" out of experimental
Fixes #803

Move "newstore" features out of experimental feature list, from this
commit "newstore" will be default enabled.

Signed-off-by: Wei Zhang <weizhang555@gmail.com>
2019-12-30 18:39:39 +08:00
Fupan Li
3ea3d3201b
Merge pull request #2371 from bergwolf/ut
ut: fix make test failures
2019-12-27 08:40:18 +08:00
Peng Tao
3ed472dc8d store: UT tmp path should be random
Otherwise we might end up using the previously created store instead.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-26 00:38:59 -08:00
Peng Tao
5617120649 nsenter: skip ut on non-root
nsenter needs root privilege to run.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-26 00:38:54 -08:00
Peng Tao
e5b04a5bf2 ut: fs test should set RunStoragePath
Otherwise it failes with permission errors.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-26 00:32:37 -08:00
Peng Tao
9bf0d67fdd ut: direct factory needs to set VCStorePrefix
Otherwise it fails with permission errors.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-26 00:32:37 -08:00
Peng Tao
4c35d0911a vc: set store RunVMStoragePath for ut
Otherwise we fail ut on failures like:

=== RUN   TestCloudHypervisorCleanupVM
--- FAIL: TestCloudHypervisorCleanupVM (0.00s)
    clh_test.go:191: cloudHypervisor.cleanupVM() expected error != open /run/vc/vm: permission denied
    clh_test.go:200: Unexpected error = stat /run/vc/vm/cleanVMID: permission denied
=== RUN   TestClhCreateSandbox
--- PASS: TestClhCreateSandbox (0.00s)
=== RUN   TestClooudHypervisorStartSandbox
time="2019-12-25T00:48:47-08:00" level=error msg="trace called before context set" source=virtcontainers subsystem=cloudHypervisor type=bug
--- FAIL: TestClooudHypervisorStartSandbox (0.00s)
        Error Trace:    clh_test.go:266
        Error:          Received unexpected error:
                        mkdir /run/vc/vm: permission denied

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-26 00:32:37 -08:00
Peng Tao
3deb24e5de cli: flush coverage report in defer function
Do not flush it atexit(), where the test report file might be already
closed and it causes go test failure like:

PASS
testing: can't write /tmp/go-build146132196/b001/testlog.txt: close /tmp/go-build146132196/b001/testlog.txt: file already closed
FAIL    github.com/kata-containers/runtime/cli  4.256s

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-26 00:32:37 -08:00
Peng Tao
f56d70ccd6 vc: UT should set VCStorePrefix
Otherwise we fail to run it with non-root user with errors like:
`mkdir /var/lib/vc/uuid: permission denied`

Fixes: #2370
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-26 00:32:37 -08:00
Penny
b9120b2bb1
Merge pull request #2373 from bergwolf/image
qemu: add disable_image_nvdimm option
2019-12-26 10:17:52 +08:00
Peng Tao
7c7a4a3b11 annotations: add disable_image_nvdimm
So that users can use annotations to set it.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-25 00:39:37 -08:00
Peng Tao
652bb76dde cli: syscall return value check is wrong
ret is uintptr and always >= 0. errno is enough for error checking.
This is causing lint error:
/home/vagrant/workplace/golang/src/github.com/kata-containers/runtime/virtcontainers/utils
cli/kata-check.go:446:20: SA4003: no value of type uintptr is less than 0 (staticcheck)
                if errno != 0 || ret <= 0 {
                                 ^

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-24 23:53:29 -08:00
Peng Tao
a8717286ca qemu: add disalbe_image_nvdimm option
To control whether an image rootfs is used as nvdimm device or just
plain virtio-block device.

Fixes: #2372
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-24 23:16:48 -08:00
Peng Tao
dd5b446997 qemu: refactor appendImage
Do not implement in each arch code. We should have a generic
implementation instead.

-. amd64 and arm64 uses nvdimm
-. ppc64le and s390x uses virtio-blk

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-12-24 20:13:50 -08:00
GabyCT
4084b7d130
Merge pull request #574 from amshinde/update-priv-doc-crio
privileged: Update docs for privileged mode with crio
2019-12-23 10:15:55 -06:00
Jose Carlos Venegas Munoz
687a524a05
Merge pull request #876 from jongwu/dmesg
config: enable printk_time for arm64.
2019-12-23 09:57:13 -06:00
James O. D. Hunt
8488286937
Merge pull request #883 from Pennyzct/LTS_v5.4.3
kernel: Enable new LTS 5.4.3 on AArch64
2019-12-23 08:44:10 +00:00
Julio Montes
1296f6f1ad
Merge pull request #2368 from jcvenegas/clh-unit-test
clh: Increase unit test using mock testing
2019-12-20 12:58:18 -06:00
Jose Carlos Venegas Munoz
a2d3f9f32d vitiofsd: Add virtiofsd interaface
In oderder to make unit testing simpler,
lets add an interface that could be mocked.

Let hypervisor have a instance of virtiofsd interface,
and this makes a loose dependency to allow mock testing.

With the inteface is possible to add startSandbox unit test:

- use utils.StartCmd to mock call to start hypervisor process.

- Add unit test for startSandbox.

Fixes: #2367

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-12-20 17:21:03 +00:00
Jose Carlos Venegas Munoz
2a085ee67b clh: virtiofsd: check path is not empty
Check if path is not empty this makes, this help
unit test know why the function failed.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-12-20 17:21:03 +00:00
Jose Carlos Venegas Munoz
af5c9c2320 clh: hypervisor: Do not set 9p values for virtiofs
9p values are ignored by virtiofs, but this should be
not changed on validation to allow have unit test with
virtiofs config.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-12-20 17:21:03 +00:00
Jose Carlos Venegas Munoz
6a10cd960d clh: test: add unit test
Add unit test for clh.

- Check endpoint has valid values for CH.
- Add unit tests
- Add force flag to ignore cleanup errors.
- Add unit tests.
- Fail if hypervisor ID is empty.
- Add createSandbox uni test

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-12-20 17:19:52 +00:00
Jose Carlos Venegas Munoz
8a439eab9d clh: add Client Interface and bootVM test
Add interface with the same methods of client,
this will help to decouple the implementation
and help use to do mock testing.

Add Mock client and add bootVM unit test

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
2019-12-20 17:19:19 +00:00
Julio Montes
2572cbd7eb
Merge pull request #887 from Pennyzct/build_fc_kernel
FC: ELF format kernel image unsupported with firecracker on AArch64
2019-12-20 06:57:22 -06:00
Penny Zheng
09198eed84 FC: jailer failed when importing new flag "--config-file"
When we used jailer to launch firecracker, kata container failed due
to the following causes:
1. new flag `--config-file` belongs to the jailed firecracker,
so, adhering to the `end of command options` convention, we need to
give `--config-file` a prefix `--`.
2. The path of the config file(`fcConfig.json`) should be also
relative to the jailed firecracker.
3. Since we do the configuration before func `fcInit` now, we also need
to bring `jailer check` ahead.
4. The config file should be umounted and cleaned up.

Fixes: #2362

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2019-12-19 05:47:43 +00:00
Jose Carlos Venegas Munoz
a198efcf1d
Merge pull request #2366 from GabyCT/topic/updateurl
versions: Update cloud hypervisor url
2019-12-18 14:45:19 -06:00
Gabriela Cervantes
661956f5bc versions: Update cloud hypervisor url
This updates the cloud hypervisor url.

Fixes #2365

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2019-12-18 12:46:42 -06:00
James O. D. Hunt
98059586a0
Merge pull request #890 from GabyCT/topic/fixclh
kata-static: Add sudo while building cloud hypervisor docker image
2019-12-18 10:10:28 +00:00
Penny Zheng
2ef9bbc16a FC: ELF format kernel image unsupported with firecracker on AArch64
The bootloader in firecracker on ARM platform only supports kernel
in Portable Executable(PE) format.
So we need `build-kernel.sh` to provide correct kernel image format
when parameter `hypervisor_target`, `-t`, defined with firecracker.

Fixes: #886

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2019-12-18 09:44:56 +08:00
Gabriela Cervantes
ca6df8510c kata-static: Add sudo while building cloud hypervisor docker image
If we want to run the build.sh by using a user this is failing by saying
that `failed to dial gRPC: cannot connect to the Docker daemon...
/var/run/docker.sock: connect: permission denied`. This PR fixes that issue.

Fixes #889

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2019-12-17 16:44:54 -06:00
Archana Shinde
3ea682d6e0
Merge pull request #2320 from amshinde/fix-rootless-net-none
rootless: fix rootless for case net=none
2019-12-16 14:21:38 -08:00
Archana Shinde
b96c7e5abe rootless: fix rootless for case net=none
When kata-runtime was invoked as rootless by podman with
net=none, an empty net namespace path is provided.
kata-runtime was then trying to create a new network namespace
and bind-mounting it under /var/run/netns, resulting in a permission error.

Instead, with this commit, the runtime checks if it is
running rootless and instead creates network namespace bind mount
under rootless directory instead.

Fixes #2319

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-12-16 12:26:57 -08:00
Peng Tao
3de4bdd508
Merge pull request #2285 from teawater/update_a
vendor: Update github.com/kata-containers/agent
2019-12-16 20:21:23 +08:00
Penny Zheng
59dc61df5b kernel: Enable new LTS 5.4.3 on AArch64
Linux has embraced another LTS kernel version v5.4.x.
If we, AArch64, update stable guest kernel version
to v5.4.x, we could get rid of huge chunkes of backport
patches under patches/4.19.x/.
Except following configs are penny-defined turned on/off,
all the other are sort of `built-in` defined or inherited
from v4.19.x.
1. CONFIG_IO_URING = y
This option enables support for the io_uring interface.
2. CONFIG_RODATA_FULL_DEFAULT_ENABLED = n
Apply read-only attributes of VM areas to the linear
alias of the backing pages as well.
3. CONFIG_ARM64_TAGGED_ADDR_ABI = n
When this option is enabled, user applications can opt in to
a relaxed ABI allow virtual tagged addresses to be passed to
system calls as pointer arguments.
4. CONFIG_ARM64_PTR_AUTH = n
Pointer authentication provides instructions for signing and
authenticating pointers against secret keys, which can be used to
mitigate Return Oriented Programming (ROP) and other attacks.

Fixes: #882

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2019-12-16 17:41:07 +08:00