Upstart control of lxc container instances

Bug #1049908 reported by Christian Kampka on 2012-09-12
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)
Medium
Serge Hallyn
Quantal
Medium
Unassigned
Raring
Medium
Serge Hallyn

Bug Description

This change proposes that upstart takes care of running and managing lxc container instances instead of having them run as daemons.
This has some advantages:
 - lxc containers can benefit from upstart supervision, eg. respawn can be easily enabled, and parallel job execution
   At the moment with serial execution, stopping the lxc service can (worst case)
   take up to n times $LXC_SHUTDOWN_TIMEOUT, n being the number of containers running.
   Having upstart manage instance shutdown avoids this problem.
 - Administrators can write upstart jobs that run on lxc container startup/shutdown of a specific container.
   Consider for example a job that enables transparent port 80 routing once a container names "squid" comes up.

I have not found any possibility to assign the instance kill timeout dynamically so for now it's fixed at two minutes.

Related branches

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in lxc (Ubuntu):
status: New → Confirmed
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Thanks for the merge proposal. That's quite neat.

Changed in lxc (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Stéphane Graber (stgraber) wrote :

I see one problem with that. Directly calling lxc-stop outside of the container, or half in the container will cause upstart to restart it, which isn't quite what we want.

Revision history for this message
Christian Kampka (kampka) wrote : Re: [Bug 1049908] Re: Upstart control of lxc container instances

> I see one problem with that. Directly calling lxc-stop outside of the
> container, or half in the container will cause upstart to restart it,
> which isn't quite what we want.

I explicitly did not add the 'respawn' stanza to the .conf file, I just
mentioned it as a possible and valid use case. The merge would still
require to enable respawn yourself though if you want that so the
default behavior should be the indifferent to the current state.

Revision history for this message
Stéphane Graber (stgraber) wrote :

Oh right, sorry, for some reason I thought respawn was the default.

summary: - Upstart control of lxc container instances
+ [FFE] Upstart control of lxc container instances
Revision history for this message
Scott Kitterman (kitterman) wrote : Re: [Bug 1049908] [NEW] [FFE] Upstart control of lxc container instances

Why is this critical for Quantal? Can't it wait for "R"?

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Quoting Scott Kitterman (<email address hidden>):
> Why is this critical for Quantal? Can't it wait for "R"?

It's not critical. It's just a nice feature, allowing upstart to
up and down specific lxc instances.

Revision history for this message
Stéphane Graber (stgraber) wrote : Re: [FFE] Upstart control of lxc container instances

With the extra few tests Serge did during our discussion on IRC, I'm happy to have this change land in 12.10.
It's going to provide much better shutdown speed on LXC hosts and better integrates with upstart.

Ack

Changed in lxc (Ubuntu):
status: Confirmed → Triaged
Revision history for this message
Scott Kitterman (kitterman) wrote :

OK. Then it should be deferred to "R". People should be focusing on fixing actual bugs right now.

Changed in lxc (Ubuntu Quantal):
status: Triaged → Won't Fix
Revision history for this message
Stéphane Graber (stgraber) wrote :

14:55 < hallyn> stgraber: all right, found a bug. at this point ig uess it waits until r :)
14:55 < stgraber> hallyn: what's the bug?
14:56 < hallyn> stgraber: if instance is running and you reboot, the lxc-instance job times out but then reboot is cancelled
14:57 < hallyn> it may be easy to fix but is subtle enough not to play with this late.

Changed in lxc (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

I'll merge this on monday along with another change.

Changed in lxc (Ubuntu Raring):
assignee: nobody → Serge Hallyn (serge-hallyn)
summary: - [FFE] Upstart control of lxc container instances
+ Upstart control of lxc container instances
Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

Sorry, I'm going to postpone pushing this until wednesday until I have a chance to run some more tests (which I will do tomorrow).

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lxc - 0.8.0~rc1-4ubuntu45

---------------
lxc (0.8.0~rc1-4ubuntu45) raring; urgency=low

  [ Stéphane Graber ]
  * Allow the container to mount efivars on /sys/firmware/efi/efivars.
    efivars is automatically mounted by mountall on UEFI systems, failure to
    do so leads to a complete boot failured.
  * Allow mounts and pivot_roots under /usr/lib/lxc/root/ for compatibility
    with nested precise lxc hosts (quantal -> precise -> containers).

  [ Serge Hallyn ]
  * update 0227-ubuntu-cloud-parsing to catch a doc typo stgraber had found
    in the upstream review.
  * 0228-ignore-kmsg-setup-failure: ignore failure to set up kmsg, since that
    is not critical.

  [ Christian Kampka ]
  * Have upstart run lxc instances (LP: #1049908)
 -- Serge Hallyn <email address hidden> Tue, 27 Nov 2012 22:52:10 -0600

Changed in lxc (Ubuntu Raring):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers