Commit 67cc8be3 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

zdtm: mount test cgroup controllers before executing tests

If a controller is mounted during dumping processes, criu may fail with error:
Error (cgroup.c:768): cg: Set 3 is not subset of 2

so lets create all test controllers before executing tests.

Reported-by: Mr Jenkins
Signed-off-by: 's avatarAndrey Vagin <avagin@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 4be6350c
...@@ -315,6 +315,23 @@ exit_callback() ...@@ -315,6 +315,23 @@ exit_callback()
} }
trap exit_callback EXIT trap exit_callback EXIT
# If a controller is mounted during dumping processes, criu may fail with error:
# Error (cgroup.c:768): cg: Set 3 is not subset of 2
# so lets mount all test controllers before executing tests.
mount_cgroups()
{
cat /proc/self/cgroup | grep zdtmtst.defaultroot && return
local tdir
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 $tdir/holder &&
umount $tdir || return 1
done
rmdir $tdir
}
construct_root() construct_root()
{ {
local root=$1 local root=$1
...@@ -903,6 +920,7 @@ while :; do ...@@ -903,6 +920,7 @@ while :; do
# mntns is used to mount /proc # mntns is used to mount /proc
# net is used to avoid conflicts of parasite sockets # net is used to avoid conflicts of parasite sockets
make zdtm_ct && make zdtm_ct &&
mount_cgroups &&
./zdtm_ct ./zdtm.sh "$@" ./zdtm_ct ./zdtm.sh "$@"
exit exit
} }
......
...@@ -15,7 +15,7 @@ char *dirname; ...@@ -15,7 +15,7 @@ char *dirname;
TEST_OPTION(dirname, string, "cgroup directory name", 1); TEST_OPTION(dirname, string, "cgroup directory name", 1);
static const char *cgname = "zdtmtst"; static const char *cgname = "zdtmtst";
static const char *subname = "oldroot"; static const char *subname = "oldroot";
static const char *cgname2 = "defaultroot"; static const char *cgname2 = "zdtmtst.defaultroot";
int mount_and_add(const char *controller, const char *path) int mount_and_add(const char *controller, const char *path)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment