[lxc-users] autostart

Tamas Papp tompos at martos.bme.hu
Sat Feb 22 16:51:29 UTC 2014


On 02/22/2014 05:32 PM, Stéphane Graber wrote:
> On Sat, Feb 22, 2014 at 05:02:53PM +0100, Tamas Papp wrote:
>> hi All,
>>
>>
>> What lxc-autostart should do?
>>
>> If I run 'lxc-autostart -a' I see containers from host like this:
>>
>>  38942 ?        Ss     0:00 lxc-autostart -a
>>  38999 ?        Ss     0:00  \_ /sbin/init
>>  39221 ?        S      0:00      \_ upstart-udev-bridge --daemon
>>  39291 ?        Ss     0:00      \_ /sbin/udevd --daemon
>>  40327 ?        S      0:00      |   \_ /sbin/udevd --daemon
>>  39292 ?        Ss     0:00      \_ /usr/sbin/sshd -D
>>  39316 ?        Sl     0:00      \_ rsyslogd -c5
>>  39349 ?        S      0:00      \_ upstart-socket-bridge --daemon
>>  39356 pts/133  Ss+    0:00      \_ /sbin/getty -8 38400 tty4
>>  39364 pts/124  Ss+    0:00      \_ /sbin/getty -8 38400 tty2
>>  39370 pts/125  Ss+    0:00      \_ /sbin/getty -8 38400 tty3
>>  39382 ?        Ss     0:00      \_ cron
>>  39407 ?        Ss     0:00      \_ /usr/sbin/nrpe -c
>> /etc/nagios/nrpe.cfg -d
>>  39414 ?        Ssl    0:00      \_ /usr/sbin/nscd
>>  39435 ?        Ss     0:00      \_ /usr/sbin/munin-node
>>  39952 ?        Ss     0:00      \_ /usr/lib/postfix/master
>>  39994 ?        S      0:00      |   \_ pickup -l -t fifo -u -c
>>  39995 ?        S      0:00      |   \_ qmgr -l -t fifo -u
>>  40023 ?        S      0:00      \_ /usr/sbin/snmpd -Lf /dev/null -u
>> snmp -g snmp -I -smux -p /var/run/snmpd.pid
>>  40089 pts/134  Ss+    0:00      \_ /sbin/getty -8 38400 console
>>  40095 pts/123  Ss+    0:00      \_ /sbin/getty -8 38400 tty1
>>
>> The same with -g:
>>
>> # lxc-autostart -g
>> lxc-autostart: option requires an argument -- 'g'
>>
>> If a group name is specified as an argument, it started. So it looks, it
>> doesn't list, but starts the containers.
>> However, not this process list format is quite ugly:
>>
>>  38942 ?        Ss     0:00 lxc-autostart -a
>>  38999 ?        Ss     0:00  \_ /sbin/init
>>
>>
>> $ lxc-autostart -L
>> or
>> $ lxc-autostart -L -g <GROUP> returns nothing
>>
>> Also it seems that containers don't start automatically, if lxc.group is
>> set.
> lxc-autostart => starts all stopped containers that have lxc.start.auto = 1 and no lxc.group
> lxc-autostart -g blah => starts all stopped containers that have lxc.start.auto = 1 and lxc.group = blah
> lxc-autostart -a => starts all stopped containers that have lxc.start.auto = 1, regardless of groups

It's obvious, just its help says other:

  -a, --all         list all auto-started containers (ignore groups)
  -g, --groups      list of groups (comma separated) to select

According to help lxc-autostart -L would list containers, but it doesn't.


> It's indeed correct that if you add a lxc.group to your container, then
> lxc-autostart won't start it, unless you pass -g <group name>.

I mean at startup time.
Set lxc.start.auto = 1, reboot the machine I grouped containers won't be
start.
BTW, it would be great, if there is an lxc.description option.

> As for the process name, there's no magic there, lxc-autostart is the
> one calling the start() API function, so it's the one being forked into
> the background.  Short of doing some rather weird tricks with prctl to
> rename the process (and lie about what exactly spawned the container),
> there isn't much we can do.

I would expect from it to start containers like the init script or
actually calling the init script. Then it will look and behave exactly
the same way, am I wrong?


tamas


More information about the lxc-users mailing list