Commit Graph

1480 Commits

Author SHA1 Message Date
Wei Li
cece49764c
Merge pull request #1436 from bergwolf/vcpu
hypervisor: return cpu->threadID mapping
2019-04-02 20:51:33 +08:00
Hui Zhu
b6f382ef6f VMCache: check if vm_cache_endpoint file exists before VMCache server runs
There is an issue that more than one VMCache server can run with same
vm_cache_endpoint file together.
The cause is factory try to remove vm_cache_endpoint file before VMCache
server runs.
Change it to check if vm_cache_endpoint file exists before VMCache server
runs to handle the issue.

Fixes: #1385

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-04-02 20:33:01 +08:00
Hui Zhu
4993dfffe6 ci: Add a failed execution check for curl
There is no checks for curl get 404 or something else.
Add a check for it.

Fixes: #1411

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-04-02 20:03:43 +08:00
Hui Zhu
7fa03902b4 ci: set $yq_version to 2.3.0
According what I said in https://github.com/kata-containers/tests/issues/1349,
use the last verion is not a good choice.
This commit set it to 2.3.0.

Fixes: #1411

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-04-02 20:03:43 +08:00
Alice Frosi
19458ec473 s390x: fix golangci-lint
Fix lint complains in the s390x files

Fixes: #1453

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
2019-04-02 13:44:12 +02:00
Peng Tao
432eda0f83
Merge pull request #1423 from WeiZhang555/fix-failing-test
tests: do cleanUp() always in the end
2019-04-02 16:21:15 +08:00
Peng Tao
d76eddf41e
Merge pull request #1416 from WeiZhang555/dont-save-cgroups-to-state-file
cgroups: remove duplicate fields from state
2019-04-02 16:09:33 +08:00
Peng Tao
dd6d1e435b fc: return vcpu thread info properly
So that we can apply cgroup constraints to them.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-02 15:51:27 +08:00
Peng Tao
6fda03ec92 hypervisor: make getThreadIDs return vcpu to threadid mapping
We need such mapping information to put vcpus in container cpuset properly.

Fixes: #1435

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-02 15:51:27 +08:00
Peng Tao
ad697cc763 vendor: add prometheus/procfs dependency
So that we can read procfs easily.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-02 15:51:27 +08:00
Peng Tao
0e2be42514 vendor: fix containerd/cgroups dependency
Gopkg.lock says it's "dbea6f2bd41658b84b00417ceefa416b979cbf10"
but it is actually "5017d4e9a9cf2d4381db99eacd9baf84b95bfb14".

We need to make sure Gopkg.lock does not lie otherwise `dep ensure`
would really fetch the locked revision and it causes build failure
due to API changes.

Introduced by: 76d9db3e0b (vendor: Add github.com/gogo/protobuf).

While at it, constraint containerd/cgroups to a working revision.

Fixes: #1447

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-04-02 15:51:27 +08:00
Peng Tao
25d21060e3
Merge pull request #1412 from lifupan/shimv2mount
shimv2: optionally plug rootfs block storage instead of mounting it
2019-04-02 15:30:40 +08:00
Hui Zhu
12437c2ded
Merge pull request #1433 from Pennyzct/nolint/deadcode
linter: remove deadcode linter check for generic item
2019-04-02 14:22:38 +08:00
lifupan
52c66d20dc shimv2: plugin the block backed rootfs directly instead of mount it
When the container's rootfs is block storage backed such as devmapper,
shimv2 will not mount it on the host, instead it insert it into hypervisor
as a block device directly.

If kata's config set "disable_block_device_use" as true, it will mount
the rootfs onto host as before.

Fixes:#1158

Signed-off-by: lifupan <lifupan@gmail.com>
2019-04-02 10:56:03 +08:00
lifupan
628ea46c58 virtcontainers: change container's rootfs from string to mount alike struct
container's rootfs is a string type, which cannot represent a
block storage backed rootfs which hasn't been mounted.
Change it to a mount alike struct as below:
    RootFs struct {
            // Source specify the BlockDevice path
            Source string
            // Target specify where the rootfs is mounted if it has been mounted
            Target string
            // Type specifies the type of filesystem to mount.
            Type string
            // Options specifies zero or more fstab style mount options.
            Options []string
            // Mounted specifies whether the rootfs has be mounted or not
            Mounted bool
     }

If the container's rootfs has been mounted as before, then this struct can be
initialized as: RootFs{Target: <rootfs>, Mounted: true} to be compatible with
previous case.

Fixes:#1158

Signed-off-by: lifupan <lifupan@gmail.com>
2019-04-02 10:54:05 +08:00
Peng Tao
7d0de42d98
Merge pull request #1455 from devimc/topic/fcNoACPI
virtcontainers: firecracker: disable ACPI
2019-04-02 10:17:32 +08:00
Julio Montes
c0aedeb7ee virtcontainers: firecracker: disable ACPI
Disable ACPI to fix ACPI BIOS error in the guest kernel

fixes #1454

Signed-off-by: Julio Montes <julio.montes@intel.com>
2019-04-01 14:23:49 -06:00
Alice Frosi
49be8ee21c s390x: not set socketID and threadID
For cpu hotplug, the options socketID and threadID are not used.

Fixes: #1448

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
2019-04-01 17:29:24 +02:00
Ace-Tang
096fa046f8 qemu: fix qemu leak when failed to start container
do cleanup inside startVM() if start vm get error

Fixes: #1426

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-03-28 19:38:56 +08:00
Ace-Tang
1b6affe498 config: fix panic in type assertion
when use shim v2 interface to run container, no need to use kata-proxy
and kata-shim, remove kata-proxy and kata-shim in config file will cause
panic since type assertion. add check to avoid panic

Fixes: #1440

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-03-28 19:28:51 +08:00
Xie Yongji
2d422a845b agent: pass correct mount type to agent for ephemeral volumes
The "ephemeral" is just used to indicate ephemeral volumes in
runtime. We should not pass it to agent. Instead, "bind" should be
the correct mount type to be passed.

Fixes: #1438

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
2019-03-28 18:40:59 +08:00
Penny Zheng
2e5194e279 linter: remove deadcode linter check for generic item
After we switched golang linter to golangci-lint, we has extra 'deadcode'
linter check, and we need to remove this linter check for all
generic items.

Fixes: #1432

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
2019-03-28 14:05:38 +08:00
zhangwei_cs
c89eb81dec
Merge pull request #1425 from bergwolf/proxy-path
config: validate proxy path
2019-03-27 11:31:39 +08:00
Peng Tao
dca7a6f98b config: validate proxy path
Like shim, we should validate the proxy path if it is provided.

Fixes: #1424

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-03-26 03:46:36 -07:00
Wei Zhang
dd6e8eb82c tests: do cleanUp() always in the end
Fixes: #1422

Detect failing test case:

```
....
=== RUN   TestEnterContainerFailingContNotStarted
--- PASS: TestEnterContainerFailingContNotStarted (0.01s)
=== RUN   TestEnterContainer
--- FAIL: TestEnterContainer (0.00s)
 Error Trace: sandbox_test.go:1154
 Error:      	Expected value not to be nil.
 Messages:   	Entering non-running container should fail
 Error Trace: sandbox_test.go:1157
 Error:      	Expected nil, but got: &errors.errorString{s:"Can not
move from running to running"}
 Messages:   	Failed to start sandbox: Can not move from running to
running
FAIL
```

`TestEnterContainerFailingContNotStarted` calls `cleanUp` at function
begging but it doesn't clean its garbage after it ends.
`TestEnterContainer` only call `cleanUp` in the end but it doesn't do
cleanUp in the begging, that gives first test case a chance to impact
latter one.

This commit modifies all the test cases, let them all do the cleanUp()
in the end.

The policy here is: "everyone needs to take their garbage away when they
leave" :)

Signed-off-by: Wei Zhang <zhangwei555@huawei.com>
2019-03-26 16:29:39 +08:00
Hui Zhu
c6804c8e2b
Merge pull request #1372 from ganeshmaharaj/go-linter-change
lint: Change go linter from gometalinter to golangci-lint
2019-03-26 12:32:38 +08:00
Wei Zhang
ad7d9b7bab cgroups: remove duplicate fields from state
Fixes: #1415

Container resources have been saved to ContainerConfig so there's no
need to save it again in state.json.

Signed-off-by: Wei Zhang <zhangwei555@huawei.com>
2019-03-26 10:34:03 +08:00
Archana Shinde
228d1512d9 mount: Add check for k8s host empty directory
k8s host empty-dir is equivalent to docker volumes.
For this case, we should just use the host directory even
for system directories.

Move the isEphemeral function to virtcontainers to not
introduce cyclic dependency.

Fixes #1417

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-03-25 14:06:23 -07:00
Archana Shinde
70c193132d mounts: Add check for system volumes
We handle system directories differently, if its a bind mount
we mount the guest system directory to the container mount and
skip the 9p share mount.
However, we should not do this for docker volumes which are directories
created by Docker.

This introduces a Docker specific check, but that is the only
information available to us at the OCI layer.

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-03-25 10:49:27 -07:00
Ganesh Maharaj Mahalingam
f4428761cb lint: Update go linter from gometalinter to golangci-lint.
gometalinter is deprecated and will be archived April '19. The
suggestion is to switch to golangci-lint which is apparently 5x faster
than gometalinter.

Partially Fixes: #1377

Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
2019-03-25 08:48:13 -07:00
Hui Zhu
814e5de224
Merge pull request #1334 from jongwu/factory
Factory: Fix fake return value issue on creating template
2019-03-25 11:58:30 +08:00
Xu Wang
de9c42e80f
Merge pull request #1227 from WeiZhang555/experimental-support
config: Add config flag "experimental"
2019-03-23 08:59:45 +08:00
James O. D. Hunt
1f52f5e7bd
Merge pull request #1403 from jodh-intel/add-more-build-targets
Add more build targets
2019-03-22 11:52:32 +00:00
James O. D. Hunt
0d146738de
Merge pull request #1405 from jodh-intel/update-collect-script-for-dax-nvdimm-images
Update collect script for dax nvdimm images
2019-03-22 09:54:03 +00:00
James O. D. Hunt
36fce98517
Merge pull request #1387 from jodh-intel/allow-data-collection-to-be-hidden
Allow data collection to be hidden
2019-03-22 09:53:44 +00:00
Xu Wang
4f712b0657
Merge pull request #1401 from teawater/vmcache_vsock
config: Make VMCache can work with vsock
2019-03-22 10:51:35 +08:00
Julio Montes
a7ccc24c80
Merge pull request #1398 from teawater/curl
ci: check curl before use it
2019-03-21 08:17:38 -06:00
James O. D. Hunt
5d761cec76 scripts: Handle images with a DAX/NVDIMM header
osbuilder recently added the ability to create images with a DAX/NVDIMM
header [1], however this change broke the data collection script. Update
that script to handle images with and without this header.

The data collection script will now assume a header is present. However,
if it fails to find the required partition data, it will try again, this
time assuming the image does not have a DAX/NVDIMM header.

Fixes #1404.

[1] - https://github.com/kata-containers/osbuilder/pull/236

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-03-21 12:35:28 +00:00
James O. D. Hunt
bdf6b2d49d scripts: Handle missing partitions in collect script
Add an extra check in the data collection script to ensure partitions
are found in the image.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-03-21 12:28:58 +00:00
James O. D. Hunt
ad228e3c3b build: Add missing targets to show-usage
Add a number of useful build and install targets to the `show-usage`
target which are visible when the user runs `make help`.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-03-21 11:30:19 +00:00
James O. D. Hunt
e6a7091981 build: Allow runtime to be built+installed without shim
Add `install-runtime` and `install-netmon` targets. This allows the
`install` target to be simplified and also allows the runtime to be
built without having to build the `containerd-shim-v2` binary which is
slow to build:

```
$ make runtime && sudo -E PATH=$PATH make install-runtime
```

Fixes #1402.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-03-21 11:30:12 +00:00
James O. D. Hunt
206ffc66aa build: Don't build the runtime when building shim binary
The `containerd-shim-v2` binary does not need the `kata-runtime` binary
to be built first, so remove the dependency.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
2019-03-21 11:30:07 +00:00
Graham Whaley
c70ba4844f
Merge pull request #1390 from devimc/topic/roFS
virtcontainers: improve security and mount the rootfs as read-only fs
2019-03-21 09:33:04 +00:00
Hui Zhu
639e8271de config: Make VMCache can work with vsock
After code check and test, found VMCache can work with vsock.
Remove the code that prohibit them from working together.

Fixes: #1400

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-03-21 17:13:03 +08:00
Hui Zhu
aec0d263fa ci: check curl before use it
install-yq.sh use curl but not check if curl is available or not.
Add code to check curl before use it.

Fixes: #1379

Signed-off-by: Hui Zhu <teawater@hyper.sh>
2019-03-21 10:52:33 +08:00
Sebastien Boeuf
f1ef63e5c6
Merge pull request #1394 from WeiZhang555/improve-readability
refactor: improve readability of `bumpAttachCount`
2019-03-20 08:13:45 -07:00
Julio Montes
9b73900ba6 katautils: mask systemd-random-seed
systemd-random-seed service fails if the rootfs is a read-only fs.
systemd-random-seed restores the random seed of the system at early
boot and saves it at shutdown, since kata containers are one boot machines
this service is not needed.

Signed-off-by: Julio Montes <julio.montes@intel.com>
2019-03-20 09:02:20 -06:00
Julio Montes
64984667ad virtcontainers: improve security and mount the rootfs as read-only fs
Mounting the rootfs as read-only fs the binaries can't be modified.

fixes #1389

Signed-off-by: Julio Montes <julio.montes@intel.com>
2019-03-20 07:50:20 -06:00
Wei Zhang
26a9b72c34 refactor: improve readability of bumpAttachCount
Fixes #1392

Improve code readability of function `device.bumpAttachCount`

Signed-off-by: Wei Zhang <zhangwei555@huawei.com>
2019-03-20 11:38:49 +08:00
Julio Montes
8e72cf15e6
Merge pull request #1381 from alicefr/bridges_func
s390x: add bridges function
2019-03-19 10:38:38 -06:00