[PKG-Openstack-devel] systemd support for OpenStack

gustavo panizzo <gfa> gfa at zumbi.com.ar
Tue Jul 15 13:10:52 UTC 2014


On 07/15/2014 03:44 AM, Thomas Goirand wrote:
> On 07/15/2014 01:55 AM, gustavo panizzo <gfa> wrote:
>> On 07/14/2014 01:46 PM, stanzgy wrote:
>>> Hi zigo, I agreed with Gustavo to use the EnvironmentFile to deal with
>>> the logging facility.
>>> But after some failed tries I found it seems impossible to use
>>> EnvironmentFile to handle this.
>>> The syntax EnvironmentFile using[1] is incompatible with bash(especially
>>> when dealing with
>>> quotes and spaces),
>>
>> newer versions of systemd support shell like quoting in EnvironmentFile,
>> 204-14 does it. i just checked with ssh service file
>>
>>
>>  and seems have no control statements like if or
>>> while. So the following
>>
>> :(
>>
>>> code couldn't be done with systemd service file AFAIK.
>>>
>>> [ "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"
>>
>>>
>>> IMHO a workaround is to always enable logfile and offer some options in
>>> /etc/default
>>> to decide whether to enable syslog.
>> Agreed
>>
>> i think we could
>>
>> 1) add a postinst script to parse, and modify, /etc/default/openstack
>> and /etc/default/nova.
>> logging options will end in $DAEMON_ARGS which we could consume from
>> service and init.d files
>>
>> 2) launch the service from a shell wrapper :(
>>
>>
>> both approaches will suit me, i need them because
>> https://github.com/saltstack/salt/issues/11900
>>
>> i do prefer the postinst path
> 
> The postinst path doesn't work, because you should be able to just edit
> /etc/default/<name> or /etc/default/openstack, restart the daemon, and
> your new option tweaks should be taken care of. Postinst doesn't run
> when you start the service.

maybe i miss explained

the postinst should parse and edit /etc/default/openstack and
/etc/default/<name> to replace the non-generic options like USE_SYSLOG=1
with command line switches like --syslog

> 
> So the only option we have remaining is a kind of wrapper somehow. I've
> heard that there's an option in systemd to run some kind of scripting,
> do you guys know about that? Or is it just writing a wrapper in the
> ExecStart?

AFAIK the only scripting you can do is in ExecStart or ExecPreStart
but you can't pass VARS from ExecPreStart to ExecStart


-- 
1AE0 322E B8F7 4717 BDEA BF1D 44BB 1BA7 9F6C 6333



More information about the Openstack-devel mailing list