[lxc-devel] Question regarding an upstart job /etc/init/lxc-net.conf

Serge Hallyn serge.hallyn at ubuntu.com
Wed Nov 5 13:09:54 UTC 2014


Quoting Adam Ryczkowski (adam.ryczkowski at statystyka.net):
> 
> >>Dear Serge,
> >>
> >>I have a problem with reloading `dnsmasq` configuration for the
> >>default lxc bridged network. Specifically, the `sudo service lxc-net
> >>restart` does not force the dnsmasq service to re-read its
> >>configuration.
> >>
> >>I can see why: the upstart script that is credited to you, does not
> >>attempt to re-load the dnsmasq, if the bridge still exists.
> >>
> >>I want to try to fix this problem, so I read the
> >>upstart_coockbook.pdf by cannonical. I learned there, that the
> >>intended stanza where the service should be invoked is
> >>`script/exec`, not `pre-start`. The `pre-start` is specifically
> >>described as "Clearing out cache/tmp dirs is a good idea, but any
> >>heavy logic is discouraged, as Upstart job files should read like
> >>configuration files, not so much like complicated software".
> >>
> >>Can you tell me, why did you use the `pre-start` stanza to do the
> >>actual job, living the `script` stanza empty?
> >>
> >>I'll be very grateful for your input. I if understand the logic
> >>behind this script, I can be able to contribute to its development.
> >>
> >>Yours,
> >>
> >>Adam Ryczkowski
> >If we were going to redesign the upstart job, I'd suggest thinking
> >about how to break it up into pieces - the dnsmasq one as you say
> >can be a normal job with dnsmasq in the script;  it starts on started
> >lxc-net which creates the bridge, and stops on stopping lxc-net.
> >A third applies the firewall rules.
> Dear Serge,
> 
> I have impression this is actually very tough to do - I checked,
> that the dnsmasq doesn't conform to the PID expectation of the
> upstart - it doesn't work with either "expect daemon", "expect fork"

Hi,

looking at the manpage I would expect 'dnsmasq -k' to work with no
expect stanza (no expected forks).

> or no expect stanza. It does provide its own PID, but I understand,
> that there is no means of telling this information to the upstart.
> (And maybe that's why the `dnsmasq` (as installed by apt-get install
> dnsmasq) uses the old /etc/init.d script rather then upstart.)

It's possible, but I can't imagine what it would do to make -k not
work with no expect stanza.

> I know that I can wrap everything in my own scripts, but that
> defeats the purpose of upstart. Is there any "upstart-compatible"
> solution for services that are incompatible with "expect" stanza,
> but do provide their own PID file?
> 
> 
> Adam
> 
> 


More information about the lxc-devel mailing list