Skip to content

Commit 3e99aa3

Browse files
committed
Fix checkpoint/restore tests on Fedora 31
The Travis tests running on Fedora 31 with cgroup2 on Vagrant had the CRIU parts disabled because of a couple of problems. One problem was a bug in runc and CRIU handling that Andrei fixed. In addition four patches from the upcoming CRIU 3.14 are needed for minimal cgroup2 support (freezer and mounting of cgroup2). With Andrei's fix and the CRIU cgroup2 support and the runc CRIU cgroup2 integration it is now possible the checkpoint integration tests again on the Fedora Vagrant cgroup2 based integration test. To run CRIU based tests the modules of Fedora 31 (the test host system) are mounted inside of the container used to test runc in the buster based container with -v /lib/modules:/lib/modules. Signed-off-by: Adrian Reber <areber@redhat.com>
1 parent 9a0184b commit 3e99aa3

File tree

3 files changed

+23
-11
lines changed

3 files changed

+23
-11
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ matrix:
3232
- ssh default sudo dnf install -y podman
3333
script:
3434
- ssh default sudo podman build -t test /vagrant
35-
- ssh default sudo podman run --privileged --cgroupns=private test make localunittest
35+
# Mounting /lib/modules into the container is necessary as CRIU wants to load (via iptables) additional modules
36+
- ssh default sudo podman run --privileged --cgroupns=private -v /lib/modules:/lib/modules:ro test make localunittest
3637
allow_failures:
3738
- go: tip
3839
- name: "cgroup-v2"

Dockerfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG GO_VERSION=1.13
22
ARG BATS_VERSION=03608115df2071fff4eaaff1605768c275e5f81f
3-
ARG CRIU_VERSION=v3.12
3+
ARG CRIU_VERSION=v3.13
44

55
FROM golang:${GO_VERSION}-buster
66
ARG DEBIAN_FRONTEND=noninteractive
@@ -62,7 +62,13 @@ ARG CRIU_VERSION
6262
RUN mkdir -p /usr/src/criu \
6363
&& curl -fsSL https://github.com/checkpoint-restore/criu/archive/${CRIU_VERSION}.tar.gz | tar -C /usr/src/criu/ -xz --strip-components=1 \
6464
&& cd /usr/src/criu \
65+
&& echo 1 > .gitid \
66+
&& curl -sSL https://github.com/checkpoint-restore/criu/commit/4c27b3db4f4325a311d8bfa9a50ea3efb4d6e377.patch | patch -p1 \
67+
&& curl -sSL https://github.com/checkpoint-restore/criu/commit/aac41164b2cd7f0d2047f207b32844524682e43f.patch | patch -p1 \
68+
&& curl -sSL https://github.com/checkpoint-restore/criu/commit/6f19249b2565f3f7c0a1f8f65b4ae180e8f7f34b.patch | patch -p1 \
69+
&& curl -sSL https://github.com/checkpoint-restore/criu/commit/378337a496ca759848180bc5411e4446298c5e4e.patch | patch -p1 \
6570
&& make install-criu \
71+
&& cd - \
6672
&& rm -rf /usr/src/criu
6773

6874
COPY script/tmpmount /

libcontainer/integration/checkpoint_test.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,6 @@ func testCheckpoint(t *testing.T, userns bool) {
6060
if testing.Short() {
6161
return
6262
}
63-
if cgroups.IsCgroup2UnifiedMode() {
64-
t.Skip("cgroup v2 is not supported")
65-
}
6663

6764
root, err := newTestRoot()
6865
if err != nil {
@@ -78,16 +75,24 @@ func testCheckpoint(t *testing.T, userns bool) {
7875

7976
config := newTemplateConfig(rootfs)
8077

81-
config.Mounts = append(config.Mounts, &configs.Mount{
82-
Destination: "/sys/fs/cgroup",
83-
Device: "cgroup",
84-
Flags: defaultMountFlags | unix.MS_RDONLY,
85-
})
86-
8778
if userns {
8879
config.UidMappings = []configs.IDMap{{HostID: 0, ContainerID: 0, Size: 1000}}
8980
config.GidMappings = []configs.IDMap{{HostID: 0, ContainerID: 0, Size: 1000}}
9081
config.Namespaces = append(config.Namespaces, configs.Namespace{Type: configs.NEWUSER})
82+
} else {
83+
var cgroupDevice string
84+
85+
if cgroups.IsCgroup2UnifiedMode() {
86+
cgroupDevice = "cgroup2"
87+
} else {
88+
cgroupDevice = "cgroup"
89+
}
90+
91+
config.Mounts = append(config.Mounts, &configs.Mount{
92+
Destination: "/sys/fs/cgroup",
93+
Device: cgroupDevice,
94+
Flags: defaultMountFlags | unix.MS_RDONLY,
95+
})
9196
}
9297

9398
factory, err := libcontainer.New(root, libcontainer.Cgroupfs)

0 commit comments

Comments
 (0)