[lxc-devel] [RFC 0/2] Feature: --start-frozen

Wolfgang Bumiller w.bumiller at proxmox.com
Thu Jan 14 13:30:18 UTC 2016


Patch 1:

This adds the possibility to start a container in a frozen state via
a --start-frozen parameter added to lxc-start.

I'm not sure the implementation is ideal. There's probably some
reusable cgroup code somewhere, but as far as I could tell it is
mostly meant for the monitor, so I don't know which parts I can use
within the child process.

This can be useful for when you want to get a fully prepared and
mounted namespace without running the container itself while having
the changes happening in hooks applied. In our case mount hooks, in
order to provide ways to push/pull files to/from the container or
mount it without things like multiple-mount-protection preventing you
from firing up the container before it's unmounted again.
We're still weighing some other ways we could go but I thought I'd get
some input about this patch since it doesn't seem to be too specific
to go upstream.

I've considered a few alternatives to this but I'm not sure if there
are any good ones.
I've considered an lxc.cgroup.freezer.state config entry, but that
happens too early and lxc-start won't exit until the container is
unfrozen.  Same problem with a start-hook, beside the fact that it
must be present in the container. (In theory one could open a handle
to an executable which waits for a signal and pass
/proc/self/fd/$handle as hook, but --daemonize always closes them.)

The semantics of the the start hook is another part to consider.
(Ignore? Add a parameter? Run later? Split?)

Patch 2: comment fixups

For the new function I used 'set_' instead of 'want_' as prefix to
make their purpose more obvious. Should I change it to 'want_' or
maybe change the cleanup patch to also rename the other functions to
'set_*'?

Wolfgang Bumiller (2):
  lxc-start: added --start-frozen
  cleanup: lxc_container::want_* comment descriptions

 doc/lxc-start.sgml.in  | 12 ++++++++++++
 src/lxc/arguments.h    |  3 +++
 src/lxc/conf.h         |  1 +
 src/lxc/lxc_start.c    |  7 +++++++
 src/lxc/lxccontainer.c | 16 ++++++++++++++++
 src/lxc/lxccontainer.h | 19 ++++++++++++++-----
 src/lxc/start.c        | 17 +++++++++++++++++
 7 files changed, 70 insertions(+), 5 deletions(-)

-- 
2.1.4




More information about the lxc-devel mailing list