Bug 431231 - upstart: no mechanism for cross-system dependencies
Summary: upstart: no mechanism for cross-system dependencies
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: upstart
Version: 10
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Casey Dahlin
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: upstart
TreeView+ depends on / blocked
 
Reported: 2008-02-01 16:39 UTC by Bill Nottingham
Modified: 2014-06-18 08:46 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-10-29 05:58:08 UTC


Attachments (Terms of Use)
Patch to /etc/rc to add events (838 bytes, text/plain)
2008-02-23 04:31 UTC, Casey Dahlin
no flags Details

Description Bill Nottingham 2008-02-01 16:39:28 UTC
If we try to move some of our current rcX scripts to 'native' upstart scripts,
this will break dependencies, as you can't (as far as I can tell) properly
express dependencies between the two systems.

Fixing this may require rewriting /etc/rc after all.

Comment 1 Casey Dahlin 2008-02-10 23:50:36 UTC
we can add scripts to the runlevels which trigger upstart events at certain
milestones. Then we can have upstart services set to "start on stage1complete".
It may get ugly, but once most or all of the upstart jobs are in place it will
clean up easily.

Comment 2 Bill Nottingham 2008-02-11 18:30:45 UTC
It's the 'once most or all' that worries me, it makes it a very much all or
nothing move.

Comment 3 Casey Dahlin 2008-02-14 05:31:17 UTC
The intermediate time will be fine, there will just be a bit more crap in the
event files than we like and a bit of minor ugliness in a few of the scripts
(nothing compared to what's there already).

Comment 4 Bill Nottingham 2008-02-14 15:11:04 UTC
Can you give an example of how you'd handle this? Say, you have something that
has Required-Start: ntp

but ntp is now a upstart event.

Comment 5 Casey Dahlin 2008-02-14 16:01:26 UTC
There's some issues with this right now, but here is the idea...

At the beginning of the script:

initctl emit ntp
initctl event | grep -C1 "started ntp"

The emit is obvious enough. intctl event normally blocks forever, just listing
away events as they occur, but the grep will exit after the first matching line,
SIGEPIPEing the initctl.

The issue with this is for some reason initctl doesn't seem to write any output
when piped. Perhaps a security feature? expect could solve this, but I haven't
used it much.

Comment 6 Bill Nottingham 2008-02-14 17:09:18 UTC
Right, but then the old SysV init script that depended on ntp would need to
conditionally include that.

Comment 7 Scott James Remnant 2008-02-17 17:26:11 UTC
Did you know that emit will block until all jobs that react to the event have
been started and/or finished?  The "grep" bit shouldn't be necessary.

Comment 8 Casey Dahlin 2008-02-17 18:10:11 UTC
Well that does make it simpler :)

Comment 9 Casey Dahlin 2008-02-20 22:04:07 UTC
(In reply to comment #6)
> Right, but then the old SysV init script that depended on ntp would need to
> conditionally include that.

I'm still not certain I understand your argument here. We just add the emit line
to the file. Its effectively a noop if ntp is already running. There's no
conditional inclusion.

Comment 10 Bill Nottingham 2008-02-21 18:33:41 UTC
Your suggestion seems to be for the case of an upstart script that requires a
SysV script. I was asking about a SysV script that requires an upstart script,
and how that can be done *without changing the existing SysV script*.

Comment 11 Casey Dahlin 2008-02-21 22:20:45 UTC
(In reply to comment #10)
> Your suggestion seems to be for the case of an upstart script that requires a
> SysV script. I was asking about a SysV script that requires an upstart script,
> and how that can be done *without changing the existing SysV script*.

My suggestion was for the latter, and either way the solution is the same. For
the first its "Tell upstart to start the things I need" and for the second its
"tell upstart to start the things that need me"

Comment 12 Bill Nottingham 2008-02-21 22:29:50 UTC
Right, but it means that all things that have sysv dependencies would need
modified if any of their deps move to upstart (or just modified wholesale). That
isn't very practical.

Comment 13 Casey Dahlin 2008-02-21 22:34:32 UTC
Ah, I see your point.

Hmm, given what we've explored here, its probably fairly easy to modify /etc/rc
to just send an event before each script is started and then hold off starting
it until the event has been responded to. I'll play with it tonight or tomorrow.

Comment 14 Casey Dahlin 2008-02-21 22:36:06 UTC
Another thought, what if we (Scott, put the tea down) put an initctl emit $0
line at the end of the "functions" include? It would end up in the right place
in just about every file, though doing such a thing might cost us our eternal souls.

Comment 15 Casey Dahlin 2008-02-23 04:31:09 UTC
Created attachment 295697 [details]
Patch to /etc/rc to add events

Here is a modified /etc/rc that generates the necessary upstart events for
every service. I moved all the events into a "sysv." namespace, which I think
will make life easier during the transition.

Bill, if you approve, we can build a new initscripts package with this and
close the bug.

Comment 16 Bill Nottingham 2008-02-28 15:38:27 UTC
Hm. While I understand the idea of separating things into a sysv namespace, it
would mean that any dependent upstart events would actually need editing if the
event moved from sysv to upstart. So we may not want to separate them.

Also, of course, it's only half of the issue.

Comment 17 Casey Dahlin 2008-03-01 20:59:38 UTC
What half are we missing?

Comment 18 Bill Nottingham 2008-03-03 16:46:26 UTC
That fixes upstart-event-depends-on-sysv, not sysv-event-depends-on-upstart.
Unless I'm missing something.

Comment 19 Casey Dahlin 2008-03-03 20:40:36 UTC
We can still make init scripts block on upstart events.

So it would go like this: If ntp is moved to an upstart event, we still have an
ntp sysvinit script. That script just starts the upstart event and waits for it
to come up.

We should be able to develop events in this way without having to think much
about sysvinit. Then one day the sysv scripts just go away.

Comment 20 Bill Nottingham 2008-03-11 03:24:34 UTC
A version of your patch added in initscripts git. We'll see how it works.

Ideally it would go in init.d/functions for everything to use, but that's not
really practical as that doesn't wrap start/stop/etc.

Comment 21 Casey Dahlin 2008-03-17 03:08:57 UTC
what are thoughts on this now that its been around a bit?

Comment 22 Bill Nottingham 2008-03-17 15:28:33 UTC
Well, we emit events for sysv scripts now. I think that's probably as good as
we're going to get for the moment.

Comment 23 Bug Zapper 2008-05-14 04:58:21 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 24 Jon Stanley 2008-05-24 19:40:59 UTC
changing back to rawhide

Comment 25 Bug Zapper 2008-11-26 02:05:57 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 26 Casey Dahlin 2009-10-29 05:50:50 UTC
Closing per Bill's comment as of 2008-03-17.


Note You need to log in before you can comment on or make changes to this bug.