[Rdo-list] Question about Restart=always in systemd

Haïkel hguemar at fedoraproject.org
Tue Sep 15 18:33:16 UTC 2015


2015-09-15 18:37 GMT+02:00 Lars Kellogg-Stedman <lars at redhat.com>:
> On Fri, Sep 11, 2015 at 11:32:14AM -0400, Matthew Miller wrote:
>> On Fri, Sep 04, 2015 at 11:17:16AM -0400, Matthew Miller wrote:
>> > > I'd think that "Restart=always" is a good setting for all services.
>> > > What it really brings up is maybe the issue of streamlining the unit
>> > > config files.
>> >
>> > For several releases, we've had packaging guidelines in Fedora
>> > encouraging Restart=on-failure or Restart=on-abnormal:
>> >
>> > https://fedoraproject.org/wiki/Packaging:Systemd#Automatic_restarting
>> >
>> > We never, however, had an effort to bring existing packages into a
>> > consistent state. I'd love for that effort to happen — anyone
>> > interesting in helping out?
>>
>> And then there were crickets. :)
>
> I didn't see any other traffic on this, so...
>
> How about a mechanism to *generate* unit files using information
> specified by the package?  Maybe packages would provide "stub" unit
> files that contain only things that differ from standard behavior
> (e.g., description, dependencies, environmentfiles, etc), and then the
> actual unit file is generated by filling in the missing information.
> E.g., for openstack-nova, a package provides the following stub:
>
>   [Service]
>   Type=notify
>   NotifyAcess=all
>   TimeoutStartSec=0
>   User=nova
>
> And then you run:
>
>   install-systemd-unit \
>     --execstart /usr/bin/nova-api \
>     --description "OpenStack Nova API Server" \
>     /path/to/stub/units/openstack-nova-template.service \
>     /lib/systemd/system/openstack-nova-api.service
>
> And you get:
>
>   [Unit]
>   Description=OpenStack Nova API Server
>   After=syslog.target network.target
>
>   [Service]
>   Type=notify
>   NotifyAccess=all
>   User=nova
>   ExecStart=/usr/bin/nova-api
>   Restart=on-failure
>
>   [Install]
>   WantedBy=multi-user.target
>
> And for, say, openstack-nova-scheduler:
>
>   install-systemd-unit \
>     --execstart /usr/bin/nova-scheduler \
>     --description "OpenStack Nova Scheduler Server" \
>     /path/to/stub/units/openstack-nova-template.service \
>     /lib/systemd/system/openstack-nova-scheduler.service
>

Not a bad idea, could be a feature for Fedora 24 (systemd-unit-utils)

/me adds this on his TODO

Could be a RPM macro but it would be very ugly.

> Or if that's too crazy, just add a check to the fedora-review tool
> that ensures unit files have standard settings, such as the Restart=
> setting.  The review could flag things like:
>
> - Missing Restart behavior
> - Missing Description
>

Easy fix.

> Either solution would be reasonably easy to put together.  I like the
> first one, because (a) yay automation and because (b) it would allow
> for local policy overrides ("I want all my services to run with
> Restart=always instead of Restart=on-failure").
>
> An auditing tool could also be used to check all of the *existing*
> packages, if that were preferable in addition to or as an alternative
> too either of the above.
>
> --
> Lars Kellogg-Stedman <lars at redhat.com> | larsks @ {freenode,twitter,github}
> Cloud Engineering / OpenStack          | http://blog.oddbit.com/
>
>
> _______________________________________________
> Rdo-list mailing list
> Rdo-list at redhat.com
> https://www.redhat.com/mailman/listinfo/rdo-list
>
> To unsubscribe: rdo-list-unsubscribe at redhat.com




More information about the dev mailing list