[lxc-devel] [PATCH 1/1] Initial support for cgmanager

Serge Hallyn serge.hallyn at ubuntu.com
Thu Jan 16 14:44:00 UTC 2014


Quoting S.Çağlar Onur (caglar at 10ur.org):
> Hi Serge,
> 
> On Wed, Jan 15, 2014 at 12:19 PM, Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> > Quoting Stéphane Graber (stgraber at ubuntu.com):
> >> On Tue, Jan 14, 2014 at 04:41:36PM -0600, Serge Hallyn wrote:
> >> > This patch splits out most of the cgroupfs-specific code, so that
> >> > cgroup-manager versions can be plugged in.  The case I did
> >> > not handle is cgroup_enter at lxc_attach.  I'm hoping that case can
> >> > be greatly simplified, but will worry about it after fleshing out the
> >> > cgroup manager handlers.
> >> >
> >> > This also simplify the freezer functions.
> >> >
> >> > This seems to not regress my common tests when running without
> >> > cgmanager, but I'd like to do a bit more testing before pushing.
> >> > However I was hoping to get some more eyes on this so am sending it
> >> > out now.
> >> >
> >> > Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
> >>
> >> So I haven't spotted anything obviously wrong with it, besides the few
> >> functions that are currently marked as unimplemented.
> >
> >> I also confirmed that the code still builds on all supported platforms
> >> (without cgmanager), so if it breaks the existing code path, it doesn't
> >> do so in any obvious way.
> >
> > All my testing currently seems to be passing (using cgroupfs driver).
> > Ideally I'd like to get wider testing.  Can anyone suggest a better way
> > than for me to simply push the patch upstream?
> 
> Haven't looked at the new code but seems like freezer code is broken
> on master (or something else changed), this is _without_ cgmanager
> https://gist.github.com/caglar10ur/8450091

Ah you had me worried - broken is a strong word there :)  It's just a
bit overly verbose.

The following patch should fix it:

>From e8d07ef2058baa04f42561533e121bf37c886e29 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge.hallyn at ubuntu.com>
Date: Thu, 16 Jan 2014 08:41:44 -0600
Subject: [PATCH 1/1] shut up freezer_state

Not being able to get freezer state is perfectly valid - if the
container does not exist.  The old version of freezer_state
only reported an error on actually reading the cgroup file,
but not on not finding a cgroup file.  Leave it to the caller
to report the error if it is important, since we don't actually
know any useful info here anyway.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/cgroup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
index c4022af..8ea347d 100644
--- a/src/lxc/cgroup.c
+++ b/src/lxc/cgroup.c
@@ -2090,10 +2090,8 @@ int freeze_unfreeze(const char *name, int freeze, const char *lxcpath)
 lxc_state_t freezer_state(const char *name, const char *lxcpath)
 {
 	char v[100];
-	if (lxc_cgroup_get("freezer.state", v, 100, name, lxcpath) < 0) {
-		ERROR("Failed to get freezer state for %s:%s", lxcpath, name);
+	if (lxc_cgroup_get("freezer.state", v, 100, name, lxcpath) < 0)
 		return -1;
-	}
 
 	if (v[strlen(v)-1] == '\n')
 		v[strlen(v)-1] = '\0';
-- 
1.8.5.2



More information about the lxc-devel mailing list