Bug 431231 - upstart: no mechanism for cross-system dependencies
upstart: no mechanism for cross-system dependencies
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: upstart (Show other bugs)
10
All Linux
low Severity low
: ---
: ---
Assigned To: Casey Dahlin
Fedora Extras Quality Assurance
:
Depends On:
Blocks: upstart
  Show dependency treegraph
 
Reported: 2008-02-01 11:39 EST by Bill Nottingham
Modified: 2014-06-18 04:46 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-10-29 01:58:08 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Bill Nottingham 2008-02-01 11:39:28 EST
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 18:50:36 EST
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 13:30:45 EST
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 00:31:17 EST
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 10:11:04 EST
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 11:01:26 EST
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 12:09:18 EST
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 12:26:11 EST
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 13:10:11 EST
Well that does make it simpler :)
Comment 9 Casey Dahlin 2008-02-20 17:04:07 EST
(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 13:33:41 EST
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 17:20:45 EST
(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 17:29:50 EST
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 17:34:32 EST
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 17:36:06 EST
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-22 23:31:09 EST
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 10:38:27 EST
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 15:59:38 EST
What half are we missing?
Comment 18 Bill Nottingham 2008-03-03 11:46:26 EST
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 15:40:36 EST
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-10 23:24:34 EDT
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-16 23:08:57 EDT
what are thoughts on this now that its been around a bit?
Comment 22 Bill Nottingham 2008-03-17 11:28:33 EDT
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 00:58:21 EDT
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 15:40:59 EDT
changing back to rawhide
Comment 25 Bug Zapper 2008-11-25 21:05:57 EST
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 01:50:50 EDT
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.