Commit Graph

4763 Commits

Author SHA1 Message Date
Kir Kolyshkin 636f23dd21 Merge pull request #2674 from AkihiroSuda/graduate-cgroup2-experimental
Move cgroup v2 out of experimental
2020-11-10 15:16:03 -08:00
Michael Crosby f4440f9b89 Merge pull request #2665 from AkihiroSuda/fedora33
CI: update Fedora to 33
2020-11-10 10:47:32 -05:00
Michael Crosby 104c493a9b Merge pull request #2676 from KentaTada/modify-doc-of-passthrough
docs: terminals: modify the example of Pass-Through mode.
2020-11-10 10:46:54 -05:00
Michael Crosby 295e4e0772 Merge pull request #2677 from xiaochenshen/rdt-rename-cat-mba-flags
libcontainer/intelrdt: rename CAT and MBA enabled flags
2020-11-10 10:46:13 -05:00
Akihiro Suda 3f2f06dfe1 Move cgroup v2 out of experimental
After a lot of refactoring, our cgroup v1 and v2 drivers now have same level of implementation quality,
so we can move the v2 driver out of experimental.

Close #2663

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-11-10 17:07:06 +09:00
Xiaochen Shen f62ad4a0de libcontainer/intelrdt: rename CAT and MBA enabled flags
Rename CAT and MBA enabled flags to be consistent with others.
No functional change.

Signed-off-by: Xiaochen Shen <xiaochen.shen@intel.com>
2020-11-10 15:32:01 +08:00
Mrunal Patel 30233a7aea Merge pull request #2675 from AkihiroSuda/vendor-20201109
update vendor
2020-11-09 21:26:49 -08:00
Akihiro Suda fb59e6f726 Merge pull request #2583 from adrianreber/join-more-namespaces
restore: tell CRIU to use existing namespaces
2020-11-10 00:19:40 +09:00
Kenta Tada 896da0b95e docs: terminals: modify the example of Pass-Through mode.
This commit removes the unnecessary ampersand.
Especially, it causes the error of "ambiguous redirect" when use bash.

Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-11-09 17:10:52 +09:00
Akihiro Suda 4690064f05 update vendor
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-11-09 15:14:23 +09:00
Mrunal Patel 27227a9358 Merge pull request #2669 from kolyshkin/systemd-unified
Initial v2 resources.unified systemd support
2020-11-06 12:31:31 -08:00
Akihiro Suda e8498d3ad5 Merge pull request #2672 from giuseppe/fix-remount-readonly
linux: fix remount readonly in a user namespace
2020-11-06 20:40:46 +09:00
Akihiro Suda 9403afd75c CI: Fedora 33: print kernel version, systemd version, and rootfs type
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-11-06 20:30:04 +09:00
Akihiro Suda 0a097615c0 CI: update Fedora to 33
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-11-06 20:30:01 +09:00
Giuseppe Scrivano 41aa764010 linux: drop MS_REC for readonly remount
it has no effect.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-11-06 11:36:50 +01:00
Giuseppe Scrivano a4e6955e31 linux: fix remount readonly in a user namespace
if we are remounting root read only when in a user namespace, make
sure the existing flags (e.g. MS_NOEXEC, MS_NODEV) are maintained
otherwise the mount fails with EPERM.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2020-11-06 11:35:40 +01:00
Akihiro Suda 8591c3364e Merge pull request #2658 from kolyshkin/tests-ex-run
tests/integration: rm excessive run use; fix exec --preserve-fds test
2020-11-06 13:56:21 +09:00
Mrunal Patel 60b2a47b17 Merge pull request #2671 from kolyshkin/shfmt-pin
ci: pin shfmt to v3.2.0
2020-11-05 16:39:18 -08:00
Kir Kolyshkin 2e968a833f libct/cg/sd/v2: "support" (ignore) memory.oom.group
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:05:02 -08:00
Kir Kolyshkin c013be563c libct/cg/sd/v2: support memory.* / Memory* unified
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:05:00 -08:00
Kir Kolyshkin 13afa58d0e libct/cg/sd/v2: support cpuset.* / Allowed*
* cpuset.cpus -> AllowedCPUs
 * cpuset.mems -> AllowedMemoryNodes

No test for cgroup v2 resources.unified override, as this requires a
separate test case, and all the unified resources are handled uniformly
so there's little sense to test all parameters.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:04:57 -08:00
Kir Kolyshkin 5be8b97aec libct/cg/sd/v2: support cpu.weight / CPUWeight
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:04:46 -08:00
Kir Kolyshkin 390a98f3fd runc update: support unified resources
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:04:41 -08:00
Kir Kolyshkin ab80eb32d2 libct/cg/sd/v2: support cpu.max unified resource
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:04:37 -08:00
Kir Kolyshkin 7f24098d9b tests/int: move check_cpu* to helpers
To be used by the following commit.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:04:32 -08:00
Kir Kolyshkin fd5226d0eb libct/cg/sd: add defCPUQuotaPeriod
Un-inline defCPUQuotaPeriod constant. To be used by the next commit.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:04:27 -08:00
Kir Kolyshkin 0cb8bf67a3 Initial v2 resources.unified systemd support
In case systemd is used as cgroups manager, and a user sets some
resources using unified resource map (as per [1]), systemd is not
aware of any parameters, so there will be a discrepancy between
the cgroupfs state and systemd unit state.

Let's try to fix that by converting known unified resources to systemd
properties.

Currently, this is only implemented for pids.max as a POC.

Some other parameters (that might or might not have systemd unit
property equivalents) are:

$ ls -l | grep w-
-rw-r--r--. 1 root root 0 Oct 10 13:57 cgroup.freeze
-rw-r--r--. 1 root root 0 Oct 10 13:57 cgroup.max.depth
-rw-r--r--. 1 root root 0 Oct 10 13:57 cgroup.max.descendants
-rw-r--r--. 1 root root 0 Oct 10 13:57 cgroup.procs
-rw-r--r--. 1 root root 0 Oct 21 09:43 cgroup.subtree_control
-rw-r--r--. 1 root root 0 Oct 10 13:57 cgroup.threads
-rw-r--r--. 1 root root 0 Oct 10 13:57 cgroup.type
-rw-r--r--. 1 root root 0 Oct 22 10:30 cpu.max
-rw-r--r--. 1 root root 0 Oct 10 13:57 cpu.pressure
-rw-r--r--. 1 root root 0 Oct 22 10:30 cpuset.cpus
-rw-r--r--. 1 root root 0 Oct 22 10:30 cpuset.cpus.partition
-rw-r--r--. 1 root root 0 Oct 22 10:30 cpuset.mems
-rw-r--r--. 1 root root 0 Oct 22 10:30 cpu.weight
-rw-r--r--. 1 root root 0 Oct 22 10:30 cpu.weight.nice
-rw-r--r--. 1 root root 0 Oct 22 10:30 hugetlb.1GB.max
-rw-r--r--. 1 root root 0 Oct 22 10:30 hugetlb.1GB.rsvd.max
-rw-r--r--. 1 root root 0 Oct 22 10:30 hugetlb.2MB.max
-rw-r--r--. 1 root root 0 Oct 22 10:30 hugetlb.2MB.rsvd.max
-rw-r--r--. 1 root root 0 Oct 22 10:30 io.bfq.weight
-rw-r--r--. 1 root root 0 Oct 22 10:30 io.latency
-rw-r--r--. 1 root root 0 Oct 22 10:30 io.max
-rw-r--r--. 1 root root 0 Oct 10 13:57 io.pressure
-rw-r--r--. 1 root root 0 Oct 22 10:30 io.weight
-rw-r--r--. 1 root root 0 Oct 10 13:57 memory.high
-rw-r--r--. 1 root root 0 Oct 10 13:57 memory.low
-rw-r--r--. 1 root root 0 Oct 10 13:57 memory.max
-rw-r--r--. 1 root root 0 Oct 10 13:57 memory.min
-rw-r--r--. 1 root root 0 Oct 10 13:57 memory.oom.group
-rw-r--r--. 1 root root 0 Oct 10 13:57 memory.pressure
-rw-r--r--. 1 root root 0 Oct 10 13:57 memory.swap.high
-rw-r--r--. 1 root root 0 Oct 10 13:57 memory.swap.max

Surely, it is a manual conversion for every such case...

[1] https://github.com/opencontainers/runtime-spec/pull/1040

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:04:19 -08:00
Kir Kolyshkin ed54837690 tests/int/update.bats: add checks for runc status
Those were missing for some reason, so we did not fail the test in case
"runc update" returned an error.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:03:21 -08:00
Kir Kolyshkin d0991db2e7 tests/int/cgroups.bats: reformatting
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-05 16:02:53 -08:00
Kir Kolyshkin a66a823812 ci: pin shfmt to v3.2.0
We had to use shfmt from git master/HEAD in commit 069fddfa1 as at the
time there was no released/tagged version that supports bats syntax.

Now there is (https://github.com/mvdan/sh/releases/tag/v3.2.0),
so let's pin it to avoid sudden regressions caused by changes in master
branch.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-11-04 19:33:29 -08:00
Kir Kolyshkin 2ceb97196e tests/integration: rm excessive run use
Bats' run should only be used when we want to check both the command
output and its non-zero exit status.

Otherwise, we can rely on implicit exit code check (as the tests are
run with set -e), or use if, etc.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-29 16:49:43 -07:00
Kir Kolyshkin e32716d3da tests/int: simplify teardown_running_container
In its current form, it is complicated, unreliable, and error prone.

Using runc delete -f will kill and remove any container, running or not,
and it won't error if a container with a given name does not exist.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-29 16:49:43 -07:00
Kir Kolyshkin c114919fd3 tests/int: fix "runc exec --preserve-fds"
1. Fix the check, mostly by changing `cat hello` to `echo hello`,
   and checking for "hello" rather than *"hello"*.

   Previously, `cat hello` generated `cat: hello: no such file or
   directory` error message, which `run` added to `$output` and
   so the check for $output containing `hello` worked!

2. Simplify the test by not using the subshell and the `run`.
   The only catch is, fd 3 is used by bats itself, so we have to use
   fd 4 and thus --preserve-fds 2.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-29 16:49:43 -07:00
Mrunal Patel cf6c074115 Merge pull request #2666 from AkihiroSuda/shfmt-20201029
shfmt mounts.bats to pass `make validate`
2020-10-29 16:40:06 -07:00
Akihiro Suda 7b8c4e980a shfmt mounts.bats to pass make validate
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-10-29 15:56:21 +09:00
Aleksa Sarai 8d860c69ad merge branch 'pr-2634'
Cory Bennett (1):
  don't panic when /sys/fs/cgroup is missing for rootless

LGTMs: @AkihiroSuda @cyphar
Closes #2634
2020-10-29 15:59:01 +11:00
Akihiro Suda 9d4c02cf29 Merge pull request #2570 from EduardoVega/2246-fix-chmod-ro-tmpfs-mount
Fix mount error when chmod RO tmpfs
2020-10-26 18:19:16 +09:00
Akihiro Suda 6a28ca3eb4 Merge pull request #2661 from kinvolk/mauricio/fix-unit-test-in-libcontainer-exec
libcontainer/integration: fix unit test
2020-10-26 16:12:59 +09:00
Akihiro Suda 75201f34ed Merge pull request #2653 from xiaochenshen/rdt-IntelRdtManager-refactoring
libcontainer/intelrdt: IntelRdtManager refactoring
2020-10-25 19:00:31 +09:00
Mauricio Vásquez ac5ec5e32f libcontainer/integration: fix unit test
Fix a merge issue between 0aa0fae393 ("Kill all processes in cgroup even if init process Wait fails")
& 73d93eeb01 ("libct/int: make newTemplateConfig argument a struct") that
resulted in passing the wrong datatype to newTemplateConfig in
TestPIDHostInitProcessWait.

Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
2020-10-23 07:56:11 -05:00
Mrunal Patel 07e35a7a40 Merge pull request #2600 from kolyshkin/libct-int-wut
libcontainer/integration: fix cgroupv1 + systemd tests
2020-10-22 21:05:15 -07:00
Mrunal Patel 10e5ab7966 Merge pull request #2635 from kolyshkin/fscommon-III
libct/cg: introduce and use fscommon.OpenFile
2020-10-22 20:59:56 -07:00
Aleksa Sarai 4633f7bef8 merge branch 'pr-2657' into master
Kir Kolyshkin (2)
  test: add "runc run --no-pivot must not expose bare /proc"
  vendor: bump mountinfo to v0.4.0

LGTMs: @AkihiroSuda @cyphar
Closes #2657
2020-10-22 18:39:05 +11:00
Akihiro Suda 94eded3bf7 Merge pull request #2656 from KentaTada/add-systemd-cgroup-completion
Update bash completion to support systemd-cgroup
2020-10-22 13:44:36 +09:00
Akihiro Suda f5c345c30c test: add "runc run --no-pivot must not expose bare /proc"
For preventing regression like #2647

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-21 21:42:59 -07:00
Kir Kolyshkin 17de6f803d vendor: bump mountinfo to v0.4.0
Release notes:
 - https://github.com/moby/sys/releases/tag/mountinfo%2Fv0.4.0

In particular, this fixes a regression introduced in commit b8bf572812
which checked the mountinfo.Root field in a FilterFunc, while Root was
not set when calling a filter.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-10-21 21:41:13 -07:00
Kir Kolyshkin 8631de4132 Merge pull request #2652 from SataQiu/fix-20201016
Fix some typos about libcontainer
2020-10-21 10:15:21 -07:00
Kenta Tada 70538b39de Update bash completion to support systemd-cgroup
Signed-off-by: Kenta Tada <Kenta.Tada@sony.com>
2020-10-21 21:15:30 +09:00
Mrunal Patel 411e4132e1 Merge pull request #2642 from kolyshkin/shfmt-bats
Add shfmt for sh and bats
2020-10-20 12:05:46 -07:00
Kir Kolyshkin 623d66e950 Merge pull request #2648 from KentaTada/add-new-caps
Update bash completion to support new capabilities
2020-10-20 11:48:18 -07:00