Bug 818052 - RFE: Could an ExecRestartPre option be added for the service files.
RFE: Could an ExecRestartPre option be added for the service files.
Status: NEW
Product: Fedora
Classification: Fedora
Component: systemd (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: systemd-maint
Fedora Extras Quality Assurance
: Triaged
Depends On:
Blocks: systemd-RFE
  Show dependency treegraph
Reported: 2012-05-02 01:45 EDT by Ben Marzinski
Modified: 2014-03-16 23:40 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Ben Marzinski 2012-05-02 01:45:09 EDT
Here is my issue. I want to (and in RHEL 6, do) have different behaviours when you do a stop or a restart for the multipathd service. On RHEL 6, when you stop the multipathd service, all your multipath devices stop queueing IO, if they have no remaining paths.  If you are restarting the service, they continue to queue IO.

In general, users will only be stopping multipathd on shutdown.  The last thing you want in shutdown is to be hung because your multipath device is set to queue IO forever if there are no working paths.  Many users do set up their systems this way. They only want their devices to stop queueing when the all failed paths are manually removed.  However, once you start shutdown, it's time to give up and let that IO fail back, which is what multipathd does.

On the other hand, users may be restarting the multipathd service because they have installed a new version.  In this case, if they have any devices that are queueing because they are have no working paths, they do not what that IO getting failed back, and so multipathd doesn't fail it back.

To have these different behaviors, the RHEL 6 init scripts run a command on
restart to tell multipathd to not disable queueing when it shuts down.  This would be simple to do if I could add a ExecRestartPre to the multipathd.service

Or is there some other other way to get this behaviour that I don't know about?
Comment 1 Jóhann B. Guðmundsson 2012-08-08 20:05:17 EDT
Hmm I had looked into that a bit when I came across this in legacy sysv initscripts and in all of them ExecStartPre seemed to suffice so running this on every startup would that be harmful as in adding "ExecStartPre=-/path/to/command" to the unit file? 

Looking at the restart option there [1] it only calls the classic start/stop no magic is being done there 

restart() {

Also there seems to be a quite a difference between the Red Hat initscript and the Suse one so if you need to increase the maximum number of FDS as is being done there in the suse one you can do so by adding LimitNOFILE=4096 to the unit ( 
or LimitNOFILE=infinity for unlimited ) 

Comment 2 Ben Marzinski 2012-08-14 13:13:00 EDT
If you look at the RHEL6 redhat init scripts you will see the difference. I haven't post the change upstream, since it doesn't work with systemd, hence this bug.

ExecStartPre doesn't help this situation.  The issue is that when multipathd is stopped, it should disable queuing.  When it is restarted, it shouldn't.  Disabling queuing has to happen when the multipathd daemon stops, since you aren't doing anything else with it after that.

I might be able to make ExecStopPost do the work.  In order for that to work, ExecStopPost would need to either not be run on restarts. Or, I'd need to be able to pass to the command whether or not I'm doing a restart.

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