[lxc-devel] Patch: really complain when trying to start already started container

Frederic Crozat fcrozat at suse.com
Tue May 29 09:07:27 UTC 2012


Le vendredi 27 avril 2012 à 10:03 -0500, Serge Hallyn a écrit :
> Quoting Frederic Crozat (fcrozat at suse.com):
> > Hi,
> > 
> > it looks like the current detection of already started container doesn't
> > work properly (cgroups is trying to be moved before socket command is
> > created), making Serge fix (97d3756cbe10) useless.
> 
> I see what was happening.  You're right, more is needed.  It is
> "working" for me, but if I do
> 
> 	lxc-start -n p1 -d
> 	lxc-start -n p1
> 
> Then the second lxc-start does fail, but in the meantime
> /sys/fs/cgroup/cpuset/p1 gets renamed to /sys/fs/cgroup/cpuset/deadxxxx,
> and /sys/fs/cgroup/cpuset/p1 is an empty cgroup.
> 
> > Attached patch adds similar warning when moving / deleting cgroups
> > fails.
> > -- 
> > Frederic Crozat <fcrozat at suse.com>
> > SUSE
> 
> > >From abce2e8ee2cc07c1273dff7786902393a28108de Mon Sep 17 00:00:00 2001
> > From: Frederic Crozat <fcrozat at suse.com>
> > Date: Fri, 27 Apr 2012 15:57:02 +0200
> > Subject: [PATCH] give a hint if old cgroup can't be moved
> > 
> > When cgroup can't be moved, it might be a hint container is already
> > running.
> > ---
> >  src/lxc/cgroup.c |    3 +++
> >  1 files changed, 3 insertions(+), 0 deletions(-)
> > 
> > diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
> > index 9af199d..e5d9dde 100644
> > --- a/src/lxc/cgroup.c
> > +++ b/src/lxc/cgroup.c
> > @@ -369,6 +369,9 @@ static int lxc_one_cgroup_create(const char *name,
> >  	if (!access(cgname, F_OK) && rmdir(cgname)) {
> >  		if (try_to_move_cgname(cgparent, cgname)) {
> 
> We should check whether the tasks file in that directory (and maybe its
> subdirs) is empty.  If not, say tasks in the container are still
> running.   If so, then move the directory out of the way, or if that
> fails (as you do here) give an error.  Meant to do that originally, but
> the multiple-cgroup-mounts-versus-ns-cgroup-mount caused so many issues
> I got distracted.
> 
> Do you mind adding that check here?

Oops, this email dropped from my TODO list. I guess I'll rebase my patch
on Daniel one. 

-- 
Frederic Crozat <fcrozat at suse.com>
SUSE





More information about the lxc-devel mailing list