Commit Graph

2235 Commits

Author SHA1 Message Date
lifupan
c91556aa41 api: add a CleanupContainer api for VC
When shimv2 was killed by accident, containerd would try to
launch a new shimv2 binarry to cleanup the container. In order
to avoid race condition, the cleanup should be done serialized
in a sandbox. Thus adding a new api to do this by locking the
sandbox.

Fixes:#1832

Signed-off-by: lifupan <lifupan@gmail.com>
2019-08-24 08:16:02 +08:00
Li Yuxuan
7c4e479956 vc: Remove bind destination when unmounting
`virtcontainers.ensureDestinationExists` will create the bind
destination directory/file, which should be removed properly when
unmounting.

Fixes: #1974

Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2019-08-24 00:46:30 +08:00
Li Yuxuan
4cf0703c58 v2: Prevent killing all container processes when exec is failed
If an exec is failed(such as executable file not found in $PATH), the
`execs.id` will be empty. This leads to all the container processes
being killed when calling `Kill` on such exec id.

Fixes: #2001
Signed-off-by: Li Yuxuan <liyuxuan04@baidu.com>
2019-08-24 00:25:55 +08:00
Peng Tao
eb0a3d23d9
Merge pull request #1977 from Ace-Tang/network-metric
shim v2: add network stat in metric
2019-08-23 19:57:28 +08:00
Peng Tao
1b2ec4e39e
Merge pull request #1992 from Ace-Tang/fix-error
qemu: fix error message miss
2019-08-23 19:53:19 +08:00
Marco Vedovati
5bfca6e38e test: add arch required kernel modules
Add a test for the checkKernelModules returned error count value.

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2019-08-23 11:48:18 +02:00
Peng Tao
346d96ce4e
Merge pull request #1998 from lifupan/fix_wrongresources
Fix the issue of update resources wrong
2019-08-23 10:11:49 +08:00
Marco Vedovati
c54f00a7ca kata-check: reduce default output verbosity
Update kata-check to print by default only relevant information about
the ability to run / create Kata Containers, and omit the list of checks
performed. Checks can still be printed using the --verbose flag.

Fixes: #1944

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2019-08-22 20:18:26 +02:00
Marco Vedovati
24fcd1b37d test: add a generic function for CLI kata-check command
Add a generic function to run CLI kata-check tests, shared by all the
args.

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2019-08-22 20:18:26 +02:00
lifupan
52e68f5fce virtcontainers: cleanup the container config once failed
When create container failed, it should delete the container
config from sandbox, otherwise, the following new creating container
would get a wrong resources caculating which would contain the previous
failed container resources such as memory and cpu.

Fixes: #1997

Signed-off-by: lifupan <lifupan@gmail.com>
2019-08-22 17:43:04 +08:00
Fupan Li
9a6e299827
Merge pull request #1984 from Ace-Tang/fix-monitor-hang
monitor: enlarge watch buffer
2019-08-22 14:20:06 +08:00
lifupan
5b749a56d8 virtcontainers: remove the redundant sandbox config store
The following storeSandbox() will store the sandbox config
data, thus there is no need to store it specifically before
run storeSandbox().

Signed-off-by: lifupan <lifupan@gmail.com>
2019-08-22 12:48:14 +08:00
Hui Zhu
0db6974ace
Merge pull request #1973 from bergwolf/hypervisor-pid
add virtiofsd to sandbox cgroup
2019-08-22 10:58:50 +08:00
Salvador Fuentes
a5b127b1c4
Merge pull request #1990 from lifupan/fix_consolewatching
virtcontainers: Fix the issue of watching console for firecracker
2019-08-21 14:11:07 -05:00
Ace-Tang
50d4188524 qemu: fix error message miss
strErr is qemu log message, should add err in error message, or if fail
before launch qemu, can not get corrent message.

Fixes: #1991

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-08-21 21:11:08 +08:00
lifupan
0926c8d9b4 virtcontainers: Fix the issue of watching console for firecracker
Since firecracker hasn't support console watching by now, so skip
watching console if the consoleURL is empty.

Fixes: #1970

Signed-off-by: lifupan <lifupan@gmail.com>
2019-08-21 20:19:42 +08:00
Peng Tao
0075bf85ba hypervisor: allow to return a slice of pids
so that for qemu, we can save and export virtiofsd pid,
and put it to the same cgroup as the qemu process.

Fixes: #1972
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-21 11:37:01 +08:00
Ace-Tang
88e281cb14 monitor: enlarge watch buffer
enlarge watch buffer, or no one consume monitor watcher if shim.Wait and shim.watchSandbox
simultaneously receive signal

goroutine 60 [semacquire, 641 minutes]:
sync.runtime_SemacquireMutex(0xc00037a144, 0x42cd00)
/usr/local/go/src/runtime/sema.go:71 +0x3d
sync.(*Mutex).Lock(0xc00037a140)
/usr/local/go/src/sync/mutex.go:134 +0x109
github.com/kata-containers/runtime/virtcontainers.(*monitor).stop(0xc00037a140)
/go/src/github.com/kata-containers/runtime/virtcontainers/monitor.go:95 +0x5f
github.com/kata-containers/runtime/virtcontainers.(*Sandbox).Delete(0xc0003c8160, 0x78effdc01, 0x0)
/go/src/github.com/kata-containers/runtime/virtcontainers/sandbox.go:773 +0x4fb
github.com/kata-containers/runtime/containerd-shim-v2.wait(0xc000478b80, 0xc000338240, 0x0, 0x0, 0x107d540, 0xc0000100f0, 0x107d520)
/go/src/github.com/kata-containers/runtime/containerd-shim-v2/wait.go:60 +0x3e5
created by github.com/kata-containers/runtime/containerd-shim-v2.startContainer
/go/src/github.com/kata-containers/runtime/containerd-shim-v2/start.go:74 +0x3e5

goroutine 53 [chan send, 641 minutes]:
github.com/kata-containers/runtime/virtcontainers.(*monitor).notify(0xc00037a140, 0x107cfe0, 0xc0001ec160)
/go/src/github.com/kata-containers/runtime/virtcontainers/monitor.go:87 +0xed
github.com/kata-containers/runtime/virtcontainers.(*monitor).watchAgent(0xc00037a140)
/go/src/github.com/kata-containers/runtime/virtcontainers/monitor.go:125 +0xab
github.com/kata-containers/runtime/virtcontainers.(*monitor).newWatcher.func1(0xc00037a140)
/go/src/github.com/kata-containers/runtime/virtcontainers/monitor.go:59 +0x72
created by github.com/kata-containers/runtime/virtcontainers.(*monitor).newWatcher
/go/src/github.com/kata-containers/runtime/virtcontainers/monitor.go:49 +0x125

Fixes: #1981

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-08-21 11:35:48 +08:00
Marco Vedovati
db5097835a kata-check: require kvm/vhost modules for amd64
KVM/vhost modules are required when using QEMU or firecracker.

Fixes: #1985

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
2019-08-20 17:58:11 +02:00
Salvador Fuentes
1935bf193c
Merge pull request #1979 from devimc/topic/versions/bumpQemu
versions: update version of qemu to 4.1.0
2019-08-20 09:25:54 -05:00
Julio Montes
4deeb058db versions: update version of qemu to 4.1.0
Update qemu version to bring the latest fixes and improvements:
* migration: allow private destination ram with x-ignore-shared
* hw/i386: Fix linker error when ISAPC is disabled
* hw/i386: turn off vmport if CONFIG_VMPORT is disabled

Depends-on: github.com/kata-containers/packaging#680

fixes #1978

Signed-off-by: Julio Montes <julio.montes@intel.com>
2019-08-19 15:39:47 +00:00
Ace-Tang
4a28b52553 test: add test for network metric
add test for metric interface

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-08-19 19:42:54 +08:00
Ace-Tang
dc38ba77bd test: fix cgroup mock test
fix cgroup mock test because of containerd/cgroup vendor update

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-08-19 18:15:06 +08:00
Ace-Tang
6534357925 shim-v2: add network stat in metric
improve metric message, add network stat, base on agent PR: #538 and
containerd/cgroup PR #81

Fixes: #1976

Signed-off-by: ZeroMagic <anthonyliu@zju.edu.cn>
Signed-off-by: Ace-Tang <aceapril@126.com>
2019-08-19 18:15:06 +08:00
Ace-Tang
21698aadc1 vendor: update cgroup
detail commit change

$ git log --no-merges --abbrev-commit --pretty=oneline "5017d4e9a9cf2d4381db99eacd9baf84b95bfb14..c4b9ac5c7601384c965b9646fc515884e091ebb9" | sed 's/^/    /g'
    f627015 avoid adding io_serviced and io_service_bytes duplicately
    13a3ac4  fixed an issue with invalid soft memory limits
    215221e Add makefile for go and protos
    0ecd2b6 cgroups: fix MoveTo function fail problem
    38dc3ac Correct forked Travis builds
    a9a304a Add Go 1.12 to Travis
    51dcf5f Fix cgroup hugetlb size prefix for kB
    1741ae0 add network stats
    453efe3 Return ErrCgroupDeleted when no subsystems
    4a9f0f7 Add SkipOpts for handling how subsystems are registered
    4dacf2b Check for non-active/supported cgroups
    2fd912c Add tests for pids
    afd5981 Gofmt cgroup_test
    f48bd85 Fixs return error message
    64bade4 Take value instead of pointer value
    b49c471 Correct ineffassign warning
    6b552a8 Fix net_prio typo
    a31a0ff Add functionality for retrieving all tasks of a cgroup
    7d825b2 Add test for cgroups load when missing hierarchy in one subsystem
    f6cbfb4 Change Load function in order to be more lenient on subsystems' checking
    ab9ec0e Add go-systemd dep for CI testing
    9a09e58 Fix gofmt of systemd.go
    e13f6cc Add GoReportCard badge to README
    d124595 Add Go 1.11 to Travis
    d961ab9 Correct typo
    e4cf832 Add project references and use common project travis
    9de57ff Add godoc badge to README.md

Signed-off-by: Ace-Tang <aceapril@126.com>
2019-08-19 16:31:15 +08:00
Hui Zhu
7019ce5c9b
Merge pull request #1964 from bergwolf/qemu-improvements
qemu interaction improvements
2019-08-19 11:08:36 +08:00
Peng Tao
e7457e6248 qemu: add logfile when debug is on
So that we can check qemu log to see if something goes wrong.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-16 12:58:25 +00:00
Peng Tao
aebc49692b qemu: fix memory prealloc option handling
Memory preallocation is just a property that hugepage, file backed
memory and memory-backend-ram can each choose to configure.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-16 12:58:25 +00:00
Peng Tao
6c77d76f24 qemu: check guest status with qmp query-status
When guest panics or stops with unexpected internal
error, qemu process might still be running but we can
find out such situation with qmp. Then monitor can still
report such failures to watchers.

Fixes: #1963
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-16 12:58:25 +00:00
Peng Tao
5b50b34df4 shimv2: cancel monitor before stopping sandbox
So that we don't trigger sandbox watcher on our own.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-16 12:58:25 +00:00
Peng Tao
49184ee562 vendor: update govmm
164bd8c test/fmt: drop extra newlines
73555a4 qmp: add query-status API
234e0ed qemu: fix memory prealloc handling
30bfcaa qemu: add debug logfile

dep now checks for dependency recersively.
runtime-spec and gogo protobuf are also updated as being required by kata agent.

Solving failure: No versions of github.com/kata-containers/agent met constraints:
        94e2a254a94a77c02280f4f84d7f82269be163ce: Could not introduce github.com/kata-containers/agent@94e2a254a94a77c02280f4f84d7f82269be163ce, as it has a dependency on github.com/opencontainers/runtime-spec with constraint a1b50f621a48ad13f8f696a162f684a241307db0, which has no overlap with existing constraint 5806c35637336642129d03657419829569abc5aa from (root)

Solving failure: No versions of github.com/kata-containers/agent met constraints:
        94e2a254a94a77c02280f4f84d7f82269be163ce: Could not introduce github.com/kata-containers/agent@94e2a254a94a77c02280f4f84d7f82269be163ce, as it has a dependency on github.com/gogo/protobuf with constraint 4cbf7e384e768b4e01799441fdf2a706a5635ae7, which has no overlap with existing constraint 342cbe0a04158f6dcb03ca0079991a51a4248c02 from (root)

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-16 12:55:10 +00:00
Peng Tao
b3987e4786
Merge pull request #1933 from lifupan/noproxywatchconsole
add watchconsole for no_proxy type
2019-08-16 11:06:02 +08:00
Julio Montes
de4582eda3
Merge pull request #1959 from bergwolf/stopvm
qemu: do not try to stop qemu multiple times
2019-08-15 08:50:17 -05:00
Julio Montes
0bf48dca65
Merge pull request #1969 from bergwolf/detach
do not hotplug network device when stopping sandbox
2019-08-15 08:46:06 -05:00
Peng Tao
d90eba8593 network: always cold unplug network devices
We don't really need to unplug it from guest because we have
already stopped it. Just detach it and clean it up.

Fixes: #1968
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-15 00:02:52 -07:00
Peng Tao
d26ff71201 Revert: "sandbox: remove network before stopping vm"
This reverts commit 794e08e243.

It breaks vfio device passthru as we need to bind the device
back to host when removing the endpoint. And that is not possible
when qemu is still running (thus holding reference to the device).

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-15 00:02:44 -07:00
Eric Ernst
a5c7e6b934
Merge pull request #1962 from bergwolf/grpc-timeout
agent: add default timeout for grpc requests
2019-08-14 21:04:20 -07:00
Fupan Li
99e04ac8cd
Merge pull request #1961 from bergwolf/pause-ready
container: do not pause a StateReady container
2019-08-14 08:54:59 +08:00
Eric Ernst
263f64829d
Merge pull request #1957 from bergwolf/network-removal
sandbox: remove network before stopping vm
2019-08-13 09:32:21 -07:00
Julio Montes
5e631391bf
Merge pull request #1942 from woshijpf/fix-hotplug-exceed-problem
virtcontainers: fix hotplug block/net devices execeed pciBridgeMaxCap…
2019-08-13 08:45:24 -05:00
Peng Tao
debc7d93ad agent: add default timeout for grpc requests
If guest is malfunctioning, we need a way to bail out. Add
a default timeout for most of the grpc requests so that the
runtime does not wait indefinitely.

Fixes: #1952
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-13 01:22:05 -07:00
Peng Tao
9d4050e0b1 container: do not pause a StateReady container
We can only pause a running container.

Fixes: #1960
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-13 01:19:36 -07:00
Peng Tao
b58ab66f05 qemu: do not try to stop qemu multiple times
We've cleaned it up the first time. Future stop will
only fail.

Fixes: #1958
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-13 01:13:06 -07:00
Peng Tao
794e08e243 sandbox: remove network before stopping vm
We might need to call hypervisor hotunplug to really remove
a network device. We cannot do it after stopping the VM.

Fixes: #1956
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2019-08-13 01:04:07 -07:00
lifupan
31ddb4d452 virtcontainers: add watchconsole for no_proxy type
For no proxy type, we also need the feature
of watch hypervisor's console to help debug.

Fixes:#1932

Signed-off-by: lifupan <lifupan@gmail.com>
2019-08-13 09:09:23 +08:00
Archana Shinde
9ea469bcfa
Merge pull request #1954 from amshinde/propagate-vsock-error
vsock: Propogate error for vsock ioctl
2019-08-12 17:22:25 -07:00
Archana Shinde
3fc17e96fc vsock: Propogate error for vsock ioctl
Make error handling better by propogating error.

Fixes #1953

Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
2019-08-12 12:13:52 -07:00
Jose Carlos Venegas Munoz
4cf1fa687d
Merge pull request #1948 from egernst/kernel-4.19-65
versions: kernel: update to 4.19.65
2019-08-12 11:39:56 -05:00
Eric Ernst
cfedb06a19
Merge pull request #1936 from amshinde/ignore-routes-with-kernel-proto
network: Ignore routes with proto as "kernel"
2019-08-12 07:08:34 -07:00
Eric Ernst
d9a7780514
Merge pull request #1951 from amshinde/deprecate-bridged-mode
network: Deprecate bridged networking mode.
2019-08-12 07:06:45 -07:00