[lxc-devel] Container autostart proposal V2

Stéphane Graber stgraber at ubuntu.com
Tue May 28 19:58:37 UTC 2013


Hey everyone,

Thanks for the feedback on my previous autostart proposal.

Here's a detailed bullet-point list of what should be done to implement
autostarting containers in upstream LXC.

Changes to the container config:
 - ADD: lxc.start.auto (integer, 0 = disabled, 1 = enabled, default: 0)
 - ADD: lxc.start.delay (integer, time in second, default: 0)
 - ADD: lxc.start.order (integer, boot order, default: 0)
 - ADD: lxc.group (string, multi-value, default: empty)

 - NOTE: lxc.start.auto is an integer as there are plans to implement a
third value 2 = last-state.

Changes to the system config:
 - ADD: lxc.autostart.enabled (boolean, default: false)
 - ADD: lxc.autostart.group (string, multi-value, default: empty)

Changes to the commands:
 - lxc-config
   * Add a "-n <container>" option to query the container config instead
of the system config

 - lxc-list
   * Allow filtering by group
   * Allow showing the groups in the fancy view

 - lxc-start
   * Add a "-a" option which will match any container that has
lxc.start.auto set to 1
   * Add a "-g <groups>" option which will match any container that has
one of the groups in lxc.group matching one of the groups in <groups>
(comma separated).
   * Both options imply -n.
   * NOTE: When starting containers, sort them by start order
(lxc.start.order) and wait until the delay is passed before starting the
next one (lxc.start.delay).

 - lxc-stop
   * Add a "-a" option which will match any container that has
lxc.start.auto set to 1
   * Add a "-g <groups>" option which will match any container that has
one of the groups in lxc.group matching one of the groups in <groups>
(comma separated).
   * Both options imply -n.

Examples:
 - lxc-start -a => Starts all auto-started containers that are in one of
the groups listed in lxc.autostart.group (system config). If the system
config entry isn't set, start all containers that DO NOT have
lxc.start.group set (container config).
 - lxc-start -g django => Starts all the containers that have django in
their lxc.start.group regardless of the autostart flag.
 - lxc-start -g django -a => Starts all autostarted containers that have
django in their lxc.start.group.
 - lxc-start -g django,graphite -a => Starts all autostarted containers
that have either django or graphite in their lxc.start.group
 - lxc-start -g any => Starts all defined containers regardless of
autostart flag or group.

 - lxc-stop behaves in the exact same way as lxc-start but
stopping/shutting down/rebooting the container instead.

 - lxc-config -n p1 lxc.utsname => returns p1
 - lxc.config lxc.autostart.enabled => returns true

-- 
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: 901 bytes
Desc: OpenPGP digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20130528/e87c9599/attachment.pgp>


More information about the lxc-devel mailing list