mirror of
https://github.com/opencontainers/runc.git
synced 2026-06-24 08:48:44 +00:00
Merge pull request #5318 from xujihui1985/fix/checkpoint-cgroup2-mount-options
ci: workaround to avoid mutate cgroupv2 mount options
This commit is contained in:
@@ -83,9 +83,10 @@ func testCheckpoint(t *testing.T, userns bool) {
|
|||||||
parentImage = "../criu-parent"
|
parentImage = "../criu-parent"
|
||||||
parentDir := filepath.Join(tmp, "criu-parent")
|
parentDir := filepath.Join(tmp, "criu-parent")
|
||||||
preDumpOpts := &libcontainer.CriuOpts{
|
preDumpOpts := &libcontainer.CriuOpts{
|
||||||
ImagesDirectory: parentDir,
|
ImagesDirectory: parentDir,
|
||||||
WorkDirectory: parentDir,
|
WorkDirectory: parentDir,
|
||||||
PreDump: true,
|
PreDump: true,
|
||||||
|
ManageCgroupsMode: "ignore",
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := container.Checkpoint(preDumpOpts); err != nil {
|
if err := container.Checkpoint(preDumpOpts); err != nil {
|
||||||
@@ -103,9 +104,10 @@ func testCheckpoint(t *testing.T, userns bool) {
|
|||||||
imagesDir := filepath.Join(tmp, "criu")
|
imagesDir := filepath.Join(tmp, "criu")
|
||||||
|
|
||||||
checkpointOpts := &libcontainer.CriuOpts{
|
checkpointOpts := &libcontainer.CriuOpts{
|
||||||
ImagesDirectory: imagesDir,
|
ImagesDirectory: imagesDir,
|
||||||
WorkDirectory: imagesDir,
|
WorkDirectory: imagesDir,
|
||||||
ParentImage: parentImage,
|
ParentImage: parentImage,
|
||||||
|
ManageCgroupsMode: "ignore",
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := container.Checkpoint(checkpointOpts); err != nil {
|
if err := container.Checkpoint(checkpointOpts); err != nil {
|
||||||
|
|||||||
@@ -126,12 +126,14 @@ function simple_cr() {
|
|||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
|
|
||||||
for _ in $(seq 2); do
|
for _ in $(seq 2); do
|
||||||
runc "$@" checkpoint --work-path ./work-dir test_busybox
|
# Use --manage-cgroups-mode=ignore as a workaround to prevent CRIU from mutating cgroup v2 superblock options.
|
||||||
|
# See: https://github.com/checkpoint-restore/criu/issues/3029
|
||||||
|
runc "$@" checkpoint --work-path ./work-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox checkpointed
|
testcontainer test_busybox checkpointed
|
||||||
|
|
||||||
runc "$@" restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
runc "$@" restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
@@ -163,12 +165,12 @@ function simple_cr() {
|
|||||||
[[ "$output" == *"mtu $mtu_value "* ]]
|
[[ "$output" == *"mtu $mtu_value "* ]]
|
||||||
|
|
||||||
for _ in $(seq 2); do
|
for _ in $(seq 2); do
|
||||||
runc checkpoint --work-path ./work-dir test_busybox_netdevice
|
runc checkpoint --work-path ./work-dir --manage-cgroups-mode ignore test_busybox_netdevice
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox_netdevice checkpointed
|
testcontainer test_busybox_netdevice checkpointed
|
||||||
|
|
||||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox_netdevice
|
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" --manage-cgroups-mode ignore test_busybox_netdevice
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox_netdevice running
|
testcontainer test_busybox_netdevice running
|
||||||
@@ -216,12 +218,12 @@ function simple_cr() {
|
|||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
|
|
||||||
# runc should fail with absolute parent image path.
|
# runc should fail with absolute parent image path.
|
||||||
runc checkpoint --parent-path "$(pwd)"/parent-dir --work-path ./work-dir --image-path ./image-dir test_busybox
|
runc checkpoint --parent-path "$(pwd)"/parent-dir --work-path ./work-dir --image-path ./image-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[[ "${output}" == *"--parent-path"* ]]
|
[[ "${output}" == *"--parent-path"* ]]
|
||||||
[ "$status" -ne 0 ]
|
[ "$status" -ne 0 ]
|
||||||
|
|
||||||
# runc should fail with invalid parent image path.
|
# runc should fail with invalid parent image path.
|
||||||
runc checkpoint --parent-path ./parent-dir --work-path ./work-dir --image-path ./image-dir test_busybox
|
runc checkpoint --parent-path ./parent-dir --work-path ./work-dir --image-path ./image-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[[ "${output}" == *"--parent-path"* ]]
|
[[ "${output}" == *"--parent-path"* ]]
|
||||||
[ "$status" -ne 0 ]
|
[ "$status" -ne 0 ]
|
||||||
}
|
}
|
||||||
@@ -235,14 +237,14 @@ function simple_cr() {
|
|||||||
runc_run_with_pipes test_busybox
|
runc_run_with_pipes test_busybox
|
||||||
|
|
||||||
mkdir parent-dir
|
mkdir parent-dir
|
||||||
runc checkpoint --pre-dump --image-path ./parent-dir test_busybox
|
runc checkpoint --pre-dump --image-path ./parent-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
|
|
||||||
mkdir image-dir
|
mkdir image-dir
|
||||||
mkdir work-dir
|
mkdir work-dir
|
||||||
runc checkpoint --parent-path ../parent-dir --work-path ./work-dir --image-path ./image-dir test_busybox
|
runc checkpoint --parent-path ../parent-dir --work-path ./work-dir --image-path ./image-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
# check parent path is valid
|
# check parent path is valid
|
||||||
@@ -250,7 +252,7 @@ function simple_cr() {
|
|||||||
|
|
||||||
testcontainer test_busybox checkpointed
|
testcontainer test_busybox checkpointed
|
||||||
|
|
||||||
runc_restore_with_pipes ./work-dir test_busybox
|
runc_restore_with_pipes ./work-dir test_busybox --manage-cgroups-mode ignore
|
||||||
check_pipes
|
check_pipes
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,13 +348,13 @@ function simple_cr() {
|
|||||||
for _ in $(seq 2); do
|
for _ in $(seq 2); do
|
||||||
# checkpoint the running container; this automatically tells CRIU to
|
# checkpoint the running container; this automatically tells CRIU to
|
||||||
# handle the network namespace defined in config.json as an external
|
# handle the network namespace defined in config.json as an external
|
||||||
runc checkpoint --work-path ./work-dir test_busybox
|
runc checkpoint --work-path ./work-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox checkpointed
|
testcontainer test_busybox checkpointed
|
||||||
|
|
||||||
# restore from checkpoint; this should restore the container into the existing network namespace
|
# restore from checkpoint; this should restore the container into the existing network namespace
|
||||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
@@ -394,7 +396,7 @@ function simple_cr() {
|
|||||||
|
|
||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
|
|
||||||
runc checkpoint --work-path ./work-dir test_busybox
|
runc checkpoint --work-path ./work-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
run ! test -f ./work-dir/"$tmplog1"
|
run ! test -f ./work-dir/"$tmplog1"
|
||||||
test -f ./work-dir/"$tmplog2"
|
test -f ./work-dir/"$tmplog2"
|
||||||
@@ -403,7 +405,7 @@ function simple_cr() {
|
|||||||
|
|
||||||
test -f ./work-dir/"$tmplog2" && unlink ./work-dir/"$tmplog2"
|
test -f ./work-dir/"$tmplog2" && unlink ./work-dir/"$tmplog2"
|
||||||
|
|
||||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
run ! test -f ./work-dir/"$tmplog1"
|
run ! test -f ./work-dir/"$tmplog1"
|
||||||
test -f ./work-dir/"$tmplog2"
|
test -f ./work-dir/"$tmplog2"
|
||||||
@@ -434,7 +436,7 @@ function simple_cr() {
|
|||||||
|
|
||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
|
|
||||||
runc checkpoint --work-path ./work-dir test_busybox
|
runc checkpoint --work-path ./work-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox checkpointed
|
testcontainer test_busybox checkpointed
|
||||||
@@ -443,7 +445,7 @@ function simple_cr() {
|
|||||||
# the mountpoints should be recreated during restore - that is the actual thing tested here
|
# the mountpoints should be recreated during restore - that is the actual thing tested here
|
||||||
rm -rf "${bind1:?}"/*
|
rm -rf "${bind1:?}"/*
|
||||||
|
|
||||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
@@ -496,12 +498,12 @@ function simple_cr() {
|
|||||||
|
|
||||||
local execed_pid=""
|
local execed_pid=""
|
||||||
for _ in $(seq 2); do
|
for _ in $(seq 2); do
|
||||||
runc checkpoint --work-path ./work-dir test_busybox
|
runc checkpoint --work-path ./work-dir --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox checkpointed
|
testcontainer test_busybox checkpointed
|
||||||
|
|
||||||
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" test_busybox
|
runc restore -d --work-path ./work-dir --console-socket "$CONSOLE_SOCKET" --manage-cgroups-mode ignore test_busybox
|
||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
|
|
||||||
testcontainer test_busybox running
|
testcontainer test_busybox running
|
||||||
|
|||||||
Reference in New Issue
Block a user