mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-22 01:51:51 +00:00
zdtm: use unique holder for cgroups
The idea that each zdtm.py should have own helder, so that two zdtm.py that are running on the same host don't effect each other. Fixes: #1774 Signed-off-by: Andrei Vagin <avagin@google.com>
This commit is contained in:
parent
73a783ac17
commit
ab6191ccd3
@ -27,6 +27,7 @@ import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import time
|
||||
import uuid
|
||||
from builtins import input, int, open, range, str, zip
|
||||
|
||||
import yaml
|
||||
@ -38,6 +39,7 @@ from zdtm.criu_config import criu_config
|
||||
STREAMED_IMG_FILE_NAME = "img.criu"
|
||||
|
||||
prev_line = None
|
||||
uuid = uuid.uuid4()
|
||||
|
||||
|
||||
def alarm(*args):
|
||||
@ -617,12 +619,12 @@ class zdtm_test:
|
||||
if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK):
|
||||
subprocess.check_call(["make", "-C", "zdtm/"])
|
||||
subprocess.check_call(
|
||||
["flock", "zdtm_mount_cgroups.lock", "./zdtm_mount_cgroups"])
|
||||
["flock", "zdtm_mount_cgroups.lock", "./zdtm_mount_cgroups", str(uuid)])
|
||||
|
||||
@staticmethod
|
||||
def cleanup():
|
||||
subprocess.check_call(
|
||||
["flock", "zdtm_mount_cgroups.lock", "./zdtm_umount_cgroups"])
|
||||
["flock", "zdtm_mount_cgroups.lock", "./zdtm_umount_cgroups", str(uuid)])
|
||||
|
||||
|
||||
def load_module_from_file(name, path):
|
||||
|
@ -4,13 +4,15 @@
|
||||
# Error (cgroup.c:768): cg: Set 3 is not subset of 2
|
||||
# so lets create all test controllers before executing tests.
|
||||
|
||||
uuid=$1
|
||||
|
||||
cat /proc/self/cgroup | grep -q zdtmtst.defaultroot && exit
|
||||
|
||||
tdir=`mktemp -d zdtm.XXXXXX`
|
||||
for i in "zdtmtst" "zdtmtst.defaultroot"; do
|
||||
mount -t cgroup -o none,name=$i zdtm $tdir &&
|
||||
# a fake group prevents destroying of a controller
|
||||
mkdir -p $tdir/holder &&
|
||||
mkdir -p $tdir/holder.$uuid &&
|
||||
umount -l $tdir || exit 1
|
||||
done
|
||||
rmdir $tdir
|
||||
|
@ -4,12 +4,14 @@
|
||||
|
||||
cat /proc/self/cgroup | grep -q zdtmtst.defaultroot || exit 0
|
||||
|
||||
uuid=$1
|
||||
|
||||
tdir=`mktemp -d zdtm.XXXXXX`
|
||||
for i in "zdtmtst" "zdtmtst.defaultroot"; do
|
||||
mount -t cgroup -o none,name=$i zdtm $tdir || { rmdir $tdir; exit 1; }
|
||||
# remove a fake group if exists
|
||||
if [ -d "$tdir/holder" ]; then
|
||||
rmdir $tdir/holder || { umount -l $tdir && rmdir $tdir; exit 1; }
|
||||
if [ -d "$tdir/holder.$uuid" ]; then
|
||||
rmdir $tdir/holder.$uuid || { umount -l $tdir && rmdir $tdir; exit 1; }
|
||||
fi
|
||||
umount -l $tdir || exit 1;
|
||||
done
|
||||
|
Loading…
x
Reference in New Issue
Block a user