[lxc-devel] [PATCH 1/2] c/r: refactor the way we pass data to criu/scripts

Tycho Andersen tycho.andersen at canonical.com
Thu Oct 16 23:45:33 UTC 2014


On Thu, Oct 16, 2014 at 08:53:03PM +0000, Serge Hallyn wrote:
> Quoting Tycho Andersen (tycho.andersen at canonical.com):
> > We previously wrote a bunch of files (eth*, veth*, and bridge*) as hard coded
> > files which we used as the names of interfaces to restore via criu's
> > --veth-pair. This meant that if people, e.g. gave a different bridge on their
> > new host, we would use our saved bridge in bridge* and try to restore to the
> > wrong bridge. Instead, we can just generate a new veth id (if the user hasn't
> > provided one), and use whatever the user configured values for the interface
> > name and bridge are.
> > 
> > This allows people to switch the bridge that they restore onto simply by
> > migrating the rootfs and config, and then changing the bridge name in the
> > container's configuration before running lxc-checkpoint.
> > 
> > Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
> 
> Mostly looks good, but two things.
> 
> Should we be concerned about API version .vs. criu?  I'm not sure how
> we can coordinate it (maybe a 'criu --get-apiversion' before we do an
> actual checkpoint/restore), and I'm not sure it's worth doing so as
> persumably serious api changes will stop when we get at all stable...
> but I'm not certain.

We could do a criu --version, but I don't think that any of the
changes here actually care about what version of criu is being used;
these are all internal changes on how we manage the network restore.

Anyway, if you don't mind the extra fork() and criu --version call, I
am happy to send a patch that checks it.

> > ---
> >  src/lxc/lxc-restore-net |  16 +++---
> >  src/lxc/lxccontainer.c  | 126 +++++++++++++++++++++++-------------------------
> >  2 files changed, 68 insertions(+), 74 deletions(-)
> > 
> 
> ...
> 
> > @@ -3874,6 +3866,11 @@ static bool lxcapi_restore(struct lxc_container *c, char *directory, bool verbos
> >  		goto out_fini_handler;
> >  	}
> >  
> > +	if (!restore_net_info(c)) {
> > +		ERROR("failed restoring network info");
> > +		goto out_fini_handler;
> > +	}
> > +
> >  	pid = fork();
> >  	if (pid < 0)
> >  		goto out_fini_handler;
> > @@ -3944,11 +3941,6 @@ static bool lxcapi_restore(struct lxc_container *c, char *directory, bool verbos
> >  					goto out_fini_handler;
> >  				}
> >  
> > -				if (!restore_net_info(c, directory)) {
> > -					ERROR("failed restoring network info");
> 
> I'm confused here.  This doesn't show up in the git HEAD src/lxc/lxccontainer.c.

Sorry, I should have mentioned these are on top of my earlier patch,

https://lists.linuxcontainers.org/pipermail/lxc-devel/2014-October/010648.html

Tycho


More information about the lxc-devel mailing list