Adding systemd unit files in OpenStack packages

Thomas Goirand zigo at debian.org
Mon Jul 7 15:12:46 BST 2014


Hi,

Thanks for your reply. It's really helpful.

On 07/07/2014 07:21 PM, Ansgar Burchardt wrote:
> Hi,
> 
> I'm mostly a systemd user myself, but have read through a reasonable
> part of the documentation. So hopefully I can answer some of your questions.
> 
> On 07/06/2014 15:33, Thomas Goirand wrote:
>> Let's take an example with keystone. Currently, there's the following
>> init.d sysv-rc script LSB header:
>>
>> # Required-Start:    $network $local_fs $remote_fs
>> # Required-Stop:     $remote_fs
> 
> Except for $network, these dependencies should be included in default
> dependencies, i.e. you don't need to do anything for them.
> 
> The replacement for $network depends on what exactly is needed and I'm
> not entirely sure myself of the semantics. Maybe someone else could
> explain this part.

Well, network should be up, so that the IP is configured, and the daemon
can bind on it. But probably this part is already handled by the fact
I'm writing WantedBy=multi-user.target?

>> Then another example. With nova-compute, I have the following:
>>
>> [ -r /etc/default/openstack ] && . /etc/default/openstack
>> [ -r /etc/default/$NAME ] && . /etc/default/$NAME
>>
>> [ "x$USE_SYSLOG" = "xyes" ] && DAEMON_ARGS="$DAEMON_ARGS --use-syslog"
>> [ "x$USE_LOGFILE" != "xno" ] && DAEMON_ARGS="$DAEMON_ARGS \
>> 	--log-file /var/log/nova/$NAME.log"
>>
>> The idea is that, by default, nova-compute only logs to a file. That is,
>> unless someone configures /etc/default/nova-compute. It is also possible
>> configure it globally in /etc/default/openstack (with the same
>> directives). How do I do this in a systemd unit file?
> 
> I think they probably should log to the journal by default.

I don't think so. File logging is what everybody does by default in
OpenStack, so I don't want to change the default behavior, only provide
another (optional) facility, easily configured.

> If the admin
> wants to change this, he can override the ExecStart= option to pass
> different options to the executable.
> 
> Just let the daemon write to stdout/stderr and set
> StandardOutput=journal if it has no built-in support for logging the the
> journal itself.
> 
> systemd can do variable substitution, but logic like "if USE_SYSLOG=yes,
> then append --use-syslog to startup options" isn't directly supported.
> It is however considered better style not to rely on these features.

Well, I do not want to change the current behavior, as I know some
OpenStack on Debian users already have it in production. Having stuff
configured in a systemd units isn't ideal also because there's no unique
single place to configure all daemons (eg: /etc/default/openstack), and
configuring each and every systemd unit by hand wouldn't be nice. So I
would like to keep current behavior with systemd as well.

Cheers,

Thomas





More information about the Pkg-systemd-maintainers mailing list