[ovs-dev] [PATCH] rhel: Environment file option for northd service

Russell Bryant russell at ovn.org
Tue Nov 15 14:41:58 UTC 2016


On Tue, Nov 15, 2016 at 6:19 AM, <bschanmu at redhat.com> wrote:

> From: Babu Shanmugam <bschanmu at redhat.com>
>
> Since the northd service starts the DB servers as well, it will be
> better to have an environment file options in the systemd unit file for
> northd service.
> The environment file is expected to define NORTHD_OPTS
> which will have additional parameters to be passed to ovn-ctl script
> that starts ovn-northd.
>
> Signed-off-by: Babu Shanmugam <bschanmu at redhat.com>
> ---
>  rhel/usr_lib_systemd_system_ovn-northd.service | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service
> b/rhel/usr_lib_systemd_system_ovn-northd.service
> index 5b3b03a..12230e9 100644
> --- a/rhel/usr_lib_systemd_system_ovn-northd.service
> +++ b/rhel/usr_lib_systemd_system_ovn-northd.service
> @@ -7,6 +7,7 @@ After=openvswitch.service
>  [Service]
>  Type=oneshot
>  RemainAfterExit=yes
> +EnvironmentFile=-/etc/sysconfig/ovn-northd
>  Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
> -ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
> +ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
> $NORTHD_OPTS
>  ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd
>

I'm not sure this is necessary.  I believe something close enough is
possible with systemd already.

https://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

or:

"Example 2. Overriding vendor settings"
https://www.freedesktop.org/software/systemd/man/systemd.unit.html

For ovn-northd, you would create a directory and config file,
/etc/systemd/system/ovn-northd.d/local.conf, with contents like:

[System]
Environment=MY_ENV_VAR=VALUE "MY_ENV_VAR2=VALUE 2"

-- 
Russell Bryant


More information about the dev mailing list