[CRIU] [PATCH 2/2] tests: add a test for --cgroup-root
Andrew Vagin
avagin at parallels.com
Mon Aug 25 08:41:55 PDT 2014
On Mon, Aug 25, 2014 at 07:02:19PM +0400, Pavel Emelyanov wrote:
> On 08/25/2014 06:19 PM, Andrew Vagin wrote:
> > On Fri, Aug 15, 2014 at 05:02:22PM -0500, Tycho Andersen wrote:
> >> diff --git a/test/zdtm/live/static/cgroup02.hook b/test/zdtm/live/static/cgroup02.hook
> >> new file mode 100755
> >> index 0000000..c99f4ea
> >> --- /dev/null
> >> +++ b/test/zdtm/live/static/cgroup02.hook
> >> @@ -0,0 +1,27 @@
> >> +#!/bin/bash
> >> +
> >> +set -e
> >> +
> >> +rmroots() {
> >> + echo "Cleaning $tname"
> >> +
> >> + set +e
> >
> > Tycho, could you explain why do we need "set +e" here? Can we
> > remove it, if we will check existance of a directory?
> >
> > test -d "$tname/oldroot" && rmdir "$tname/oldroot"
> >
> >> + rmdir "$tname/oldroot"
> >> + rmdir "$tname/newroot"
> >
> > And here is one more problem. the newroot directory is created for all
> > controllers, but currently test cleans up it only for the zdtmtst
> > controller. We need to find a way to clean up all other conntrollers.
> > Tests are executed on a node, which is rebooted only for updating
> > kernel, so if we will not clean up all other controllers, we can eat all
> > memory.
>
> How about this? Guys, could you check whether this patch works for you:
Tested-by: Andrew Vagin <avagin at openvz.org>
Thanks.
>
> diff --git a/test/zdtm/live/static/cgroup02.hook b/test/zdtm/live/static/cgroup02.hook
> index c99f4ea..5f4d042 100755
> --- a/test/zdtm/live/static/cgroup02.hook
> +++ b/test/zdtm/live/static/cgroup02.hook
> @@ -3,7 +3,9 @@
> set -e
>
> rmroots() {
> - echo "Cleaning $tname"
> + echo "Cleaning $tname ($1)"
> +
> + mount -t cgroup none $tname -o "$1"
>
> set +e
> rmdir "$tname/oldroot"
> @@ -14,14 +16,12 @@ rmroots() {
> echo "Left there is:"
> ls "$tname"
> umount "$tname"
> - rmdir "$tname"
> }
>
> tname=$(mktemp -d cgclean.XXXXXX)
> -mount -t cgroup none $tname -o "none,name=zdtmtst"
> -rmroots
>
> -tname=$(mktemp -d cgclean.XXXXXX)
> -mount -t cgroup none $tname -o "none,name=defaultroot"
> -rmroots
> +for ctl in $(cat /proc/self/cgroup | cut -d: -f2); do
> + rmroots "$ctl"
> +done
>
> +rmdir $tname
>
> ---
>
More information about the CRIU
mailing list