[lxc-devel] [PATCH] unpriv tests: also move caller into unbound cgroups

Stéphane Graber stgraber at ubuntu.com
Wed May 21 19:21:16 UTC 2014


On Wed, May 21, 2014 at 11:33:57AM -0500, Serge Hallyn wrote:
> Otherwise the name=systemd cgroup isn't changed to one which
> the lxc-unpriv user can write to, causing the test to fail.
> 
> This allows lxc-test-unpriv and lxc-test-usernic to pass when run in an
> unprivileged container with cgmanager.
> 
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/tests/lxc-test-unpriv     | 2 +-
>  src/tests/lxc-test-usernic.in | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/tests/lxc-test-unpriv b/src/tests/lxc-test-unpriv
> index bbe1e08..139b080 100755
> --- a/src/tests/lxc-test-unpriv
> +++ b/src/tests/lxc-test-unpriv
> @@ -92,7 +92,7 @@ chown -R $TUSER /run/user/$(id -u $TUSER)
>  cd $HDIR
>  
>  if [ -e /sys/fs/cgroup/cgmanager/sock ]; then
> -	for d in $(grep -v ^# /proc/cgroups | awk '{print $1}'); do
> +	for d in $(cut -d : -f 2 /proc/self/cgroup); do
>  		dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \
>  			--type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Create \
>  			string:$d string:$TUSER >/dev/null
> diff --git a/src/tests/lxc-test-usernic.in b/src/tests/lxc-test-usernic.in
> index 93af623..ad11f0a 100755
> --- a/src/tests/lxc-test-usernic.in
> +++ b/src/tests/lxc-test-usernic.in
> @@ -85,7 +85,7 @@ lxc.id_map = g 0 910000 10000
>  EOF
>  
>  if [ -e /sys/fs/cgroup/cgmanager/sock ]; then
> -	for d in $(grep -v ^# /proc/cgroups | awk '{print $1}'); do
> +	for d in $(cut -d : -f 2 /proc/self/cgroup); do
>  		dbus-send --print-reply --address=unix:path=/sys/fs/cgroup/cgmanager/sock \
>  			--type=method_call /org/linuxcontainers/cgmanager org.linuxcontainers.cgmanager0_0.Create \
>  			string:$d string:usernic-user >/dev/null
> -- 
> 1.9.1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140521/770e9c40/attachment.sig>


More information about the lxc-devel mailing list