[ovs-dev] [PATCH] rhel: Use systemd Restart option for ovn-controllers.

Lance Richardson lrichard at redhat.com
Wed Aug 2 19:27:46 UTC 2017


> From: "Mark Michelson" <mmichels at redhat.com>
> To: dev at openvswitch.org
> Sent: Wednesday, 2 August, 2017 2:43:04 PM
> Subject: [ovs-dev] [PATCH] rhel: Use systemd Restart option for	ovn-controllers.
> 
> This change stops the use of OVS's monitor for the ovn-controller and
> ovn-controller-vtep systemd services. Instead, the services use the
> systemd Restart option to restart the services automatically if they
> fail.
> 
> This patch changes the ovn-controller service Type from "oneshot" to
> "forking". The Restart option is incompatible with oneshot services. The
> patch does not change the ovn-controller-vtep service type from
> "simple", however.
> 
> Signed-off-by: Mark Michelson <mmichels at redhat.com>
> ---
>  ovn/utilities/ovn-ctl                                   | 2 ++
>  rhel/usr_lib_systemd_system_ovn-controller-vtep.service | 1 +
>  rhel/usr_lib_systemd_system_ovn-controller.service      | 7 ++++---
>  3 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/ovn/utilities/ovn-ctl b/ovn/utilities/ovn-ctl
> index 0b533916d..3e247a1c6 100755
> --- a/ovn/utilities/ovn-ctl
> +++ b/ovn/utilities/ovn-ctl
> @@ -381,6 +381,8 @@ set_defaults () {
>  
>      DB_SB_CREATE_INSECURE_REMOTE="no"
>      DB_NB_CREATE_INSECURE_REMOTE="no"
> +
> +    MONITOR="yes"
>  }
>  
>  set_option () {
> diff --git a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> index 8ca95941b..4ca684ac0 100644
> --- a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> +++ b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> @@ -34,6 +34,7 @@ After=openvswitch.service
>  
>  [Service]
>  Type=simple
> +Restart=on-failure
>  Environment=OVS_RUNDIR=%t/openvswitch
>  Environment=OVN_DB=unix:%t/openvswitch/db.sock
>  Environment=VTEP_DB=unix:%t/openvswitch/db.sock
> diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service
> b/rhel/usr_lib_systemd_system_ovn-controller.service
> index a21a7debd..283e581df 100644
> --- a/rhel/usr_lib_systemd_system_ovn-controller.service
> +++ b/rhel/usr_lib_systemd_system_ovn-controller.service
> @@ -20,10 +20,11 @@ Requires=openvswitch.service
>  After=openvswitch.service
>  
>  [Service]
> -Type=oneshot
> -RemainAfterExit=yes
> +Type=forking
> +Restart=on-failure
>  EnvironmentFile=-/etc/sysconfig/ovn-controller
> -ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_controller
> $OVN_CONTROLLER_OPTS
> +ExecStart=/usr/share/openvswitch/scripts/ovn-ctl --no-monitor \
> +          start_controller $OVN_CONTROLLER_OPTS
>  ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_controller
>  
>  [Install]
> --
> 2.13.3
> 

LGTM, but now I'm wondering if there's a good reason for not using ovn-ctl
to start ovn-controller-vtep instead of running it directly in the service
file. That might be worth looking into for a follow-up.

Acked-by: Lance Richardson <lrichard at redhat.com>


More information about the dev mailing list