diff mbox

[ovs-dev,2/2] rhel: Add EnvironmentFile for ovn services.

Message ID 20161121210647.21720-2-russell@ovn.org
State Superseded
Headers show

Commit Message

Russell Bryant Nov. 21, 2016, 9:06 p.m. UTC
A previous commit documented how you do this using systemd
native interfaces for customizing services.  However, it seems
that some people still would rather see environment variables
specified through an old-style sysconfig file.  It seems harmless
enough to provide, so this patch adds it.

The "-" prefix to the filename means that systemd will ignore this
setting if the file does not exist and will not report any error.

Signed-off-by: Russell Bryant <russell@ovn.org>
---
 rhel/usr_lib_systemd_system_ovn-controller-vtep.service | 10 ++++++++--
 rhel/usr_lib_systemd_system_ovn-controller.service      |  9 +++++++--
 rhel/usr_lib_systemd_system_ovn-northd.service          |  9 +++++++--
 3 files changed, 22 insertions(+), 6 deletions(-)

Comments

Numan Siddique Nov. 23, 2016, 10:12 a.m. UTC | #1
On Tue, Nov 22, 2016 at 2:36 AM, Russell Bryant <russell@ovn.org> wrote:

> A previous commit documented how you do this using systemd
> native interfaces for customizing services.  However, it seems
> that some people still would rather see environment variables
> specified through an old-style sysconfig file.  It seems harmless
> enough to provide, so this patch adds it.
>
> The "-" prefix to the filename means that systemd will ignore this
> setting if the file does not exist and will not report any error.
>
> Signed-off-by: Russell Bryant <russell@ovn.org>
> ---
>  rhel/usr_lib_systemd_system_ovn-controller-vtep.service | 10 ++++++++--
>  rhel/usr_lib_systemd_system_ovn-controller.service      |  9 +++++++--
>  rhel/usr_lib_systemd_system_ovn-northd.service          |  9 +++++++--
>  3 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> index 88e18b6..70128a9 100644
> --- a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> +++ b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> @@ -18,8 +18,13 @@
>  # you could place the following contents in
>  # /etc/systemd/system/ovn-controller-vtep.d/local.conf:
>  #
> -# [System]
> -# Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock"
> "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock"
> +#   [System]
> +#   Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock"
> "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock"
> +#
> +# Alternatively, you may specify environment variables in the file
> /etc/sysconfig/ovn-controller-vtep:
> +#
> +#   OVN_DB="unix:/usr/local/var/run/openvswitch/db.sock"
> +#   VTEP_DB="unix:/usr/local/var/run/openvswitch/vtep.sock"
>
>  [Unit]
>  Description=OVN VTEP gateway controller daemon
> @@ -30,6 +35,7 @@ After=openvswitch.service
>  [Service]
>  Type=simple
>  Environment=OVS_RUNDIR=%t/openvswitch OVN_DB=unix:%t/openvswitch/db.sock
> VTEP_DB=unix:%t/openvswitch/db.sock
> +EnvironmentFile=-/etc/sysconfig/ovn-controller-vtep
>  ExecStart=/usr/bin/ovn-controller-vtep -vconsole:emer -vsyslog:err
> -vfile:info \
>            --log-file=/var/log/openvswitch/ovn-controller-vtep.log \
>            --no-chdir --pidfile=${OVS_RUNDIR}/ovn-controller-vtep.pid \
> diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service
> b/rhel/usr_lib_systemd_system_ovn-controller.service
> index ad1b146..d08e9e2 100644
> --- a/rhel/usr_lib_systemd_system_ovn-controller.service
> +++ b/rhel/usr_lib_systemd_system_ovn-controller.service
> @@ -6,8 +6,12 @@
>  # could place the following contents in
>  # /etc/systemd/system/ovn-controller.d/local.conf:
>  #
> -# [System]
> -# Environment="OVN_CONTROLLER_OPTS=--ovn-controller-log=-vconsole:emer
> -vsyslog:err -vfile:info"
> +#   [System]
> +#   Environment="OVN_CONTROLLER_OPTS=--ovn-controller-log=-vconsole:emer
> -vsyslog:err -vfile:info"
> +#
> +# Alternatively, you may specify environment variables in the file
> /etc/sysconfig/ovn-controller:
> +#
> +#   OVN_CONTROLLER_OPTS="--ovn-controller-log=-vconsole:emer
> -vsyslog:err -vfile:info"
>
>  [Unit]
>  Description=OVN controller daemon
> @@ -18,5 +22,6 @@ After=openvswitch.service
>  [Service]
>  Type=oneshot
>  RemainAfterExit=yes
> +EnvironmentFile=-/etc/sysconfig/ovn-controller
>  ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_controller
> $OVN_CONTROLLER_OPTS
>  ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_controller
> diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service
> b/rhel/usr_lib_systemd_system_ovn-northd.service
> index 6e23eaa..0eedd1a 100644
> --- a/rhel/usr_lib_systemd_system_ovn-northd.service
> +++ b/rhel/usr_lib_systemd_system_ovn-northd.service
> @@ -6,8 +6,12 @@
>  # could place the following contents in
>  # /etc/systemd/system/ovn-northd.d/local.conf:
>  #
> -# [System]
> -# Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock
> --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
> +#   [System]
> +#   Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock
> --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
> +#
> +# Alternatively, you may specify environment variables in the file
> ​​
> /etc/sysconfig/ovn-controller:
>

​I think there's a typo here - i.e
​
/etc/sysconfig/ovn
​-northd
​ instead of
​
/etc/sysconfig/ovn-controller​
​

+#
> +#   OVN_NORTHD_OPTS="--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock
> --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
>
>  [Unit]
>  Description=OVN northd management daemon
> @@ -19,5 +23,6 @@ After=openvswitch.service
>  Type=oneshot
>  RemainAfterExit=yes
>  Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
> +EnvironmentFile=-/etc/sysconfig/ovn-northd
>  ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
> $OVN_NORTHD_OPTS
>  ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd
> --
> 2.9.3
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Russell Bryant Nov. 23, 2016, 7:59 p.m. UTC | #2
On Wed, Nov 23, 2016 at 5:12 AM, Numan Siddique <nusiddiq@redhat.com> wrote:

>
>
> On Tue, Nov 22, 2016 at 2:36 AM, Russell Bryant <russell@ovn.org> wrote:
>
>> A previous commit documented how you do this using systemd
>> native interfaces for customizing services.  However, it seems
>> that some people still would rather see environment variables
>> specified through an old-style sysconfig file.  It seems harmless
>> enough to provide, so this patch adds it.
>>
>> The "-" prefix to the filename means that systemd will ignore this
>> setting if the file does not exist and will not report any error.
>>
>> Signed-off-by: Russell Bryant <russell@ovn.org>
>> ---
>>  rhel/usr_lib_systemd_system_ovn-controller-vtep.service | 10 ++++++++--
>>  rhel/usr_lib_systemd_system_ovn-controller.service      |  9 +++++++--
>>  rhel/usr_lib_systemd_system_ovn-northd.service          |  9 +++++++--
>>  3 files changed, 22 insertions(+), 6 deletions(-)
>>
>> diff --git a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
>> b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
>> index 88e18b6..70128a9 100644
>> --- a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
>> +++ b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
>> @@ -18,8 +18,13 @@
>>  # you could place the following contents in
>>  # /etc/systemd/system/ovn-controller-vtep.d/local.conf:
>>  #
>> -# [System]
>> -# Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock"
>> "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock"
>> +#   [System]
>> +#   Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock"
>> "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock"
>> +#
>> +# Alternatively, you may specify environment variables in the file
>> /etc/sysconfig/ovn-controller-vtep:
>> +#
>> +#   OVN_DB="unix:/usr/local/var/run/openvswitch/db.sock"
>> +#   VTEP_DB="unix:/usr/local/var/run/openvswitch/vtep.sock"
>>
>>  [Unit]
>>  Description=OVN VTEP gateway controller daemon
>> @@ -30,6 +35,7 @@ After=openvswitch.service
>>  [Service]
>>  Type=simple
>>  Environment=OVS_RUNDIR=%t/openvswitch OVN_DB=unix:%t/openvswitch/db.sock
>> VTEP_DB=unix:%t/openvswitch/db.sock
>> +EnvironmentFile=-/etc/sysconfig/ovn-controller-vtep
>>  ExecStart=/usr/bin/ovn-controller-vtep -vconsole:emer -vsyslog:err
>> -vfile:info \
>>            --log-file=/var/log/openvswitch/ovn-controller-vtep.log \
>>            --no-chdir --pidfile=${OVS_RUNDIR}/ovn-controller-vtep.pid \
>> diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service
>> b/rhel/usr_lib_systemd_system_ovn-controller.service
>> index ad1b146..d08e9e2 100644
>> --- a/rhel/usr_lib_systemd_system_ovn-controller.service
>> +++ b/rhel/usr_lib_systemd_system_ovn-controller.service
>> @@ -6,8 +6,12 @@
>>  # could place the following contents in
>>  # /etc/systemd/system/ovn-controller.d/local.conf:
>>  #
>> -# [System]
>> -# Environment="OVN_CONTROLLER_OPTS=--ovn-controller-log=-vconsole:emer
>> -vsyslog:err -vfile:info"
>> +#   [System]
>> +#   Environment="OVN_CONTROLLER_OPTS=--ovn-controller-log=-vconsole:emer
>> -vsyslog:err -vfile:info"
>> +#
>> +# Alternatively, you may specify environment variables in the file
>> /etc/sysconfig/ovn-controller:
>> +#
>> +#   OVN_CONTROLLER_OPTS="--ovn-controller-log=-vconsole:emer
>> -vsyslog:err -vfile:info"
>>
>>  [Unit]
>>  Description=OVN controller daemon
>> @@ -18,5 +22,6 @@ After=openvswitch.service
>>  [Service]
>>  Type=oneshot
>>  RemainAfterExit=yes
>> +EnvironmentFile=-/etc/sysconfig/ovn-controller
>>  ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_controller
>> $OVN_CONTROLLER_OPTS
>>  ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_controller
>> diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service
>> b/rhel/usr_lib_systemd_system_ovn-northd.service
>> index 6e23eaa..0eedd1a 100644
>> --- a/rhel/usr_lib_systemd_system_ovn-northd.service
>> +++ b/rhel/usr_lib_systemd_system_ovn-northd.service
>> @@ -6,8 +6,12 @@
>>  # could place the following contents in
>>  # /etc/systemd/system/ovn-northd.d/local.conf:
>>  #
>> -# [System]
>> -# Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock
>> --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
>> +#   [System]
>> +#   Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock
>> --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
>> +#
>> +# Alternatively, you may specify environment variables in the file
>> ​​
>> /etc/sysconfig/ovn-controller:
>>
>
> ​I think there's a typo here - i.e
> ​
> /etc/sysconfig/ovn
> ​-northd
> ​ instead of
> ​
> /etc/sysconfig/ovn-controller​
>

Good catch.  Copy/paste mistake.


> ​
>
> +#
>> +#   OVN_NORTHD_OPTS="--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock
>> --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
>>
>>  [Unit]
>>  Description=OVN northd management daemon
>> @@ -19,5 +23,6 @@ After=openvswitch.service
>>  Type=oneshot
>>  RemainAfterExit=yes
>>  Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
>> +EnvironmentFile=-/etc/sysconfig/ovn-northd
>>  ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd
>> $OVN_NORTHD_OPTS
>>  ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd
>> --
>> 2.9.3
>>
>> _______________________________________________
>> dev mailing list
>> dev@openvswitch.org
>> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>>
>
>
diff mbox

Patch

diff --git a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
index 88e18b6..70128a9 100644
--- a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
+++ b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
@@ -18,8 +18,13 @@ 
 # you could place the following contents in
 # /etc/systemd/system/ovn-controller-vtep.d/local.conf:
 #
-# [System]
-# Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock" "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock"
+#   [System]
+#   Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock" "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock"
+#
+# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-controller-vtep:
+#
+#   OVN_DB="unix:/usr/local/var/run/openvswitch/db.sock"
+#   VTEP_DB="unix:/usr/local/var/run/openvswitch/vtep.sock"
 
 [Unit]
 Description=OVN VTEP gateway controller daemon
@@ -30,6 +35,7 @@  After=openvswitch.service
 [Service]
 Type=simple
 Environment=OVS_RUNDIR=%t/openvswitch OVN_DB=unix:%t/openvswitch/db.sock VTEP_DB=unix:%t/openvswitch/db.sock
+EnvironmentFile=-/etc/sysconfig/ovn-controller-vtep
 ExecStart=/usr/bin/ovn-controller-vtep -vconsole:emer -vsyslog:err -vfile:info \
           --log-file=/var/log/openvswitch/ovn-controller-vtep.log \
           --no-chdir --pidfile=${OVS_RUNDIR}/ovn-controller-vtep.pid \
diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service b/rhel/usr_lib_systemd_system_ovn-controller.service
index ad1b146..d08e9e2 100644
--- a/rhel/usr_lib_systemd_system_ovn-controller.service
+++ b/rhel/usr_lib_systemd_system_ovn-controller.service
@@ -6,8 +6,12 @@ 
 # could place the following contents in
 # /etc/systemd/system/ovn-controller.d/local.conf:
 #
-# [System]
-# Environment="OVN_CONTROLLER_OPTS=--ovn-controller-log=-vconsole:emer -vsyslog:err -vfile:info"
+#   [System]
+#   Environment="OVN_CONTROLLER_OPTS=--ovn-controller-log=-vconsole:emer -vsyslog:err -vfile:info"
+#
+# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-controller:
+#
+#   OVN_CONTROLLER_OPTS="--ovn-controller-log=-vconsole:emer -vsyslog:err -vfile:info"
 
 [Unit]
 Description=OVN controller daemon
@@ -18,5 +22,6 @@  After=openvswitch.service
 [Service]
 Type=oneshot
 RemainAfterExit=yes
+EnvironmentFile=-/etc/sysconfig/ovn-controller
 ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_controller $OVN_CONTROLLER_OPTS
 ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_controller
diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service b/rhel/usr_lib_systemd_system_ovn-northd.service
index 6e23eaa..0eedd1a 100644
--- a/rhel/usr_lib_systemd_system_ovn-northd.service
+++ b/rhel/usr_lib_systemd_system_ovn-northd.service
@@ -6,8 +6,12 @@ 
 # could place the following contents in
 # /etc/systemd/system/ovn-northd.d/local.conf:
 #
-# [System]
-# Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
+#   [System]
+#   Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
+#
+# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-controller:
+#
+#   OVN_NORTHD_OPTS="--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
 
 [Unit]
 Description=OVN northd management daemon
@@ -19,5 +23,6 @@  After=openvswitch.service
 Type=oneshot
 RemainAfterExit=yes
 Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
+EnvironmentFile=-/etc/sysconfig/ovn-northd
 ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd $OVN_NORTHD_OPTS
 ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd