diff mbox series

[ovs-dev,2/2] rhel: Add systemd-units for ovn-ic services

Message ID 20210203084431.28953-1-numans@ovn.org
State Accepted
Headers show
Series [ovs-dev,1/2] Revert "rhel: Add systemd-unit for ovn-ic and move IC to sub-rpm ovn-ic." | expand

Commit Message

Numan Siddique Feb. 3, 2021, 8:44 a.m. UTC
From: Vladislav Odintsov <odivlad@gmail.com>

New ovn-ic.service and ovn-ic-db.service systemd units were added
to manage ovn-ic and ovsdb-servers for OVN IC respectively.
ovn-ic-db.service manages both OVN_IC_Northbound and OVN_IC_Southbound
OVSDB server processes.

Submitted-at: https://github.com/ovn-org/ovn/pull/65
Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
---
 rhel/automake.mk                              |  2 +
 rhel/ovn-fedora.spec.in                       | 63 ++++++++++++++++++-
 rhel/usr_lib_systemd_system_ovn-ic-db.service | 32 ++++++++++
 rhel/usr_lib_systemd_system_ovn-ic.service    | 31 +++++++++
 4 files changed, 126 insertions(+), 2 deletions(-)
 create mode 100644 rhel/usr_lib_systemd_system_ovn-ic-db.service
 create mode 100644 rhel/usr_lib_systemd_system_ovn-ic.service

Comments

0-day Robot Feb. 3, 2021, 10:34 a.m. UTC | #1
Bleep bloop.  Greetings Numan Siddique, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 108 characters long (recommended limit is 79)
#165 FILE: rhel/usr_lib_systemd_system_ovn-ic-db.service:10:
#   Environment="OVN_IC_DB_OPTS=--db-ic-nb-create-insecure-remote=yes --db-ic-sb-create-insecure-remote=yes"

WARNING: Line is 92 characters long (recommended limit is 79)
#167 FILE: rhel/usr_lib_systemd_system_ovn-ic-db.service:12:
# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-ic-db:

WARNING: Line is 96 characters long (recommended limit is 79)
#169 FILE: rhel/usr_lib_systemd_system_ovn-ic-db.service:14:
#   OVN_IC_DB_OPTS="--db-ic-nb-create-insecure-remote=yes --db-ic-sb-create-insecure-remote=yes"

WARNING: Line is 143 characters long (recommended limit is 79)
#203 FILE: rhel/usr_lib_systemd_system_ovn-ic.service:10:
#   Environment="OVN_IC_OPTS=--db-ic-nb-sock=/usr/local/var/run/ovn/ovn_ic_nb_db.sock --db-ic-sb-sock=/usr/local/var/run/ovn/ovn_ic_sb_db.sock"

WARNING: Line is 89 characters long (recommended limit is 79)
#205 FILE: rhel/usr_lib_systemd_system_ovn-ic.service:12:
# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-ic:

WARNING: Line is 131 characters long (recommended limit is 79)
#207 FILE: rhel/usr_lib_systemd_system_ovn-ic.service:14:
#   OVN_IC_OPTS="--db-ic-nb-sock=/usr/local/var/run/ovn/ovn_ic_nb_db.sock --db-ic-sb-sock=/usr/local/var/run/ovn/ovn_ic_sb_db.sock"

Lines checked: 227, Warnings: 6, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Numan Siddique Feb. 3, 2021, 12:33 p.m. UTC | #2
On Wed, Feb 3, 2021 at 2:15 PM <numans@ovn.org> wrote:
>
> From: Vladislav Odintsov <odivlad@gmail.com>
>
> New ovn-ic.service and ovn-ic-db.service systemd units were added
> to manage ovn-ic and ovsdb-servers for OVN IC respectively.
> ovn-ic-db.service manages both OVN_IC_Northbound and OVN_IC_Southbound
> OVSDB server processes.
>
> Submitted-at: https://github.com/ovn-org/ovn/pull/65
> Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>

Thanks for the PR. I applied these patches to master.

Numan

> ---
>  rhel/automake.mk                              |  2 +
>  rhel/ovn-fedora.spec.in                       | 63 ++++++++++++++++++-
>  rhel/usr_lib_systemd_system_ovn-ic-db.service | 32 ++++++++++
>  rhel/usr_lib_systemd_system_ovn-ic.service    | 31 +++++++++
>  4 files changed, 126 insertions(+), 2 deletions(-)
>  create mode 100644 rhel/usr_lib_systemd_system_ovn-ic-db.service
>  create mode 100644 rhel/usr_lib_systemd_system_ovn-ic.service
>
> diff --git a/rhel/automake.mk b/rhel/automake.mk
> index 661975ea9..3e71f5d80 100644
> --- a/rhel/automake.mk
> +++ b/rhel/automake.mk
> @@ -13,6 +13,8 @@ EXTRA_DIST += \
>         rhel/ovn-fedora.spec.in \
>         rhel/usr_lib_systemd_system_ovn-controller.service \
>         rhel/usr_lib_systemd_system_ovn-controller-vtep.service \
> +       rhel/usr_lib_systemd_system_ovn-ic.service \
> +       rhel/usr_lib_systemd_system_ovn-ic-db.service \
>         rhel/usr_lib_systemd_system_ovn-northd.service \
>         rhel/usr_lib_firewalld_services_ovn-central-firewall-service.xml \
>         rhel/usr_lib_firewalld_services_ovn-host-firewall-service.xml \
> diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
> index 6b11ef3e8..6716dd0d2 100644
> --- a/rhel/ovn-fedora.spec.in
> +++ b/rhel/ovn-fedora.spec.in
> @@ -161,7 +161,7 @@ install -p -D -m 0644 \
>          rhel/usr_share_ovn_scripts_systemd_sysconfig.template \
>          $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/ovn
>
> -for service in ovn-controller ovn-controller-vtep ovn-northd; do
> +for service in ovn-controller ovn-controller-vtep ovn-northd ovn-ic ovn-ic-db; do
>          install -p -D -m 0644 \
>                          rhel/usr_lib_systemd_system_${service}.service \
>                          $RPM_BUILD_ROOT%{_unitdir}/${service}.service
> @@ -256,7 +256,7 @@ if [ $1 -eq 1 ] ; then
>      if [[ "$?" = "0" && "$ovn_status" = "0" ]]; then
>          # ovn-controller-vtep service is running which means old
>          # openvswitch-ovn-vtep is installed and it will be cleaned up. So
> -        # start ovn-controller-vtep service when posttrans host is called.
> +        # start ovn-controller-vtep service when posttrans vtep is called.
>          touch %{_localstatedir}/lib/rpm-state/ovn-controller-vtep
>      fi
>  fi
> @@ -272,6 +272,26 @@ fi
>      fi
>  %endif
>
> +%if 0%{?systemd_preun:1}
> +    %systemd_preun ovn-ic.service
> +%else
> +    if [ $1 -eq 0 ] ; then
> +        # Package removal, not upgrade
> +        /bin/systemctl --no-reload disable ovn-ic.service >/dev/null 2>&1 || :
> +        /bin/systemctl stop ovn-ic.service >/dev/null 2>&1 || :
> +    fi
> +%endif
> +
> +%if 0%{?systemd_preun:1}
> +    %systemd_preun ovn-ic-db.service
> +%else
> +    if [ $1 -eq 0 ] ; then
> +        # Package removal, not upgrade
> +        /bin/systemctl --no-reload disable ovn-ic-db.service >/dev/null 2>&1 || :
> +        /bin/systemctl stop ovn-ic-db.service >/dev/null 2>&1 || :
> +    fi
> +%endif
> +
>  %preun host
>  %if 0%{?systemd_preun:1}
>      %systemd_preun ovn-controller.service
> @@ -312,6 +332,24 @@ fi
>      fi
>  %endif
>
> +%if 0%{?systemd_post:1}
> +    %systemd_post ovn-ic.service
> +%else
> +    # Package install, not upgrade
> +    if [ $1 -eq 1 ]; then
> +        /bin/systemctl daemon-reload >dev/null || :
> +    fi
> +%endif
> +
> +%if 0%{?systemd_post:1}
> +    %systemd_post ovn-ic-db.service
> +%else
> +    # Package install, not upgrade
> +    if [ $1 -eq 1 ]; then
> +        /bin/systemctl daemon-reload >dev/null || :
> +    fi
> +%endif
> +
>  %post host
>  %if 0%{?systemd_post:1}
>      %systemd_post ovn-controller.service
> @@ -345,6 +383,22 @@ fi
>      fi
>  %endif
>
> +%if 0%{?systemd_postun_with_restart:1}
> +    %systemd_postun_with_restart ovn-ic.service
> +%else
> +    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
> +    if [ "$1" -ge "1" ] ; then
> +    # Package upgrade, not uninstall
> +        /bin/systemctl try-restart ovn-ic.service >/dev/null 2>&1 || :
> +    fi
> +%endif
> +
> +%if 0%{?systemd_postun:1}
> +    %systemd_postun ovn-ic-db.service
> +%else
> +    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
> +%endif
> +
>  %postun host
>  %if 0%{?systemd_postun_with_restart:1}
>      %systemd_postun_with_restart ovn-controller.service
> @@ -439,6 +493,8 @@ fi
>  %config %{_datadir}/ovn/ovn-sb.ovsschema
>  %config %{_datadir}/ovn/ovn-ic-nb.ovsschema
>  %config %{_datadir}/ovn/ovn-ic-sb.ovsschema
> +%{_unitdir}/ovn-ic.service
> +%{_unitdir}/ovn-ic-db.service
>  %{_unitdir}/ovn-northd.service
>  %{_prefix}/lib/firewalld/services/ovn-central-firewall-service.xml
>
> @@ -454,5 +510,8 @@ fi
>  %{_unitdir}/ovn-controller-vtep.service
>
>  %changelog
> +* Mon Feb 1 2021 Vladislav Odintsov <odivlad@gmail.com>
> +- Added ovn-ic, ovn-ic-db systemd-units.
> +
>  * Thu Dec 20 2018 Numan Siddique <nusiddiq@redhat.com>
>  - OVS/OVN split.
> diff --git a/rhel/usr_lib_systemd_system_ovn-ic-db.service b/rhel/usr_lib_systemd_system_ovn-ic-db.service
> new file mode 100644
> index 000000000..04173d9a3
> --- /dev/null
> +++ b/rhel/usr_lib_systemd_system_ovn-ic-db.service
> @@ -0,0 +1,32 @@
> +# See ovn-ic(8) for details about ovn-ic.
> +#
> +# To customize the ovn-ic-db service, you may create a configuration file
> +# in the /etc/systemd/system/ovn-ic-db.d/ directory.  For example, to specify
> +# additional options to be passed to the "ovn-ctl start_ic_ovsdb" command, you
> +# could place the following contents in
> +# /etc/systemd/system/ovn-ic-db.d/local.conf:
> +#
> +#   [System]
> +#   Environment="OVN_IC_DB_OPTS=--db-ic-nb-create-insecure-remote=yes --db-ic-sb-create-insecure-remote=yes"
> +#
> +# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-ic-db:
> +#
> +#   OVN_IC_DB_OPTS="--db-ic-nb-create-insecure-remote=yes --db-ic-sb-create-insecure-remote=yes"
> +
> +[Unit]
> +Description=OVN global (IC) northbound and southbound OVSDB servers
> +After=syslog.target
> +
> +[Service]
> +Type=oneshot
> +RemainAfterExit=yes
> +Environment=OVN_RUNDIR=%t/ovn OVN_DBDIR=/var/lib/ovn
> +EnvironmentFile=-/etc/sysconfig/ovn
> +EnvironmentFile=-/etc/sysconfig/ovn-ic-db
> +ExecStartPre=-/usr/bin/chown -R ${OVN_USER_ID} ${OVN_DBDIR}
> +ExecStart=/usr/share/ovn/scripts/ovn-ctl \
> +          --ovn-user=${OVN_USER_ID} start_ic_ovsdb $OVN_IC_DB_OPTS
> +ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_ic_ovsdb
> +
> +[Install]
> +WantedBy=multi-user.target
> diff --git a/rhel/usr_lib_systemd_system_ovn-ic.service b/rhel/usr_lib_systemd_system_ovn-ic.service
> new file mode 100644
> index 000000000..2507a11e4
> --- /dev/null
> +++ b/rhel/usr_lib_systemd_system_ovn-ic.service
> @@ -0,0 +1,31 @@
> +# See ovn-ic(8) for details about ovn-ic.
> +#
> +# To customize the ovn-ic service, you may create a configuration file
> +# in the /etc/systemd/system/ovn-ic.d/ directory.  For example, to specify
> +# additional options to be passed to the "ovn-ctl start_ic" command, you
> +# could place the following contents in
> +# /etc/systemd/system/ovn-ic.d/local.conf:
> +#
> +#   [System]
> +#   Environment="OVN_IC_OPTS=--db-ic-nb-sock=/usr/local/var/run/ovn/ovn_ic_nb_db.sock --db-ic-sb-sock=/usr/local/var/run/ovn/ovn_ic_sb_db.sock"
> +#
> +# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-ic:
> +#
> +#   OVN_IC_OPTS="--db-ic-nb-sock=/usr/local/var/run/ovn/ovn_ic_nb_db.sock --db-ic-sb-sock=/usr/local/var/run/ovn/ovn_ic_sb_db.sock"
> +
> +[Unit]
> +Description=OVN ic management daemon
> +After=syslog.target
> +
> +[Service]
> +Type=oneshot
> +RemainAfterExit=yes
> +Environment=OVN_RUNDIR=%t/ovn OVN_DBDIR=/var/lib/ovn
> +EnvironmentFile=-/etc/sysconfig/ovn
> +EnvironmentFile=-/etc/sysconfig/ovn-ic
> +ExecStart=/usr/share/ovn/scripts/ovn-ctl \
> +          --ovn-user=${OVN_USER_ID} start_ic $OVN_IC_OPTS
> +ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_ic
> +
> +[Install]
> +WantedBy=multi-user.target
> --
> 2.29.2
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
Odintsov Vladislav Feb. 3, 2021, 12:53 p.m. UTC | #3
Thanks!
 

Regards,
 
Vladislav Odintsov

On 03.02.2021, 15:34, "dev on behalf of Numan Siddique" <ovs-dev-bounces@openvswitch.org on behalf of numans@ovn.org> wrote:

    On Wed, Feb 3, 2021 at 2:15 PM <numans@ovn.org> wrote:
    >
    > From: Vladislav Odintsov <odivlad@gmail.com>
    >
    > New ovn-ic.service and ovn-ic-db.service systemd units were added
    > to manage ovn-ic and ovsdb-servers for OVN IC respectively.
    > ovn-ic-db.service manages both OVN_IC_Northbound and OVN_IC_Southbound
    > OVSDB server processes.
    >
    > Submitted-at: https://github.com/ovn-org/ovn/pull/65
    > Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>

    Thanks for the PR. I applied these patches to master.

    Numan

    > ---
    >  rhel/automake.mk                              |  2 +
    >  rhel/ovn-fedora.spec.in                       | 63 ++++++++++++++++++-
    >  rhel/usr_lib_systemd_system_ovn-ic-db.service | 32 ++++++++++
    >  rhel/usr_lib_systemd_system_ovn-ic.service    | 31 +++++++++
    >  4 files changed, 126 insertions(+), 2 deletions(-)
    >  create mode 100644 rhel/usr_lib_systemd_system_ovn-ic-db.service
    >  create mode 100644 rhel/usr_lib_systemd_system_ovn-ic.service
    >
    > diff --git a/rhel/automake.mk b/rhel/automake.mk
    > index 661975ea9..3e71f5d80 100644
    > --- a/rhel/automake.mk
    > +++ b/rhel/automake.mk
    > @@ -13,6 +13,8 @@ EXTRA_DIST += \
    >         rhel/ovn-fedora.spec.in \
    >         rhel/usr_lib_systemd_system_ovn-controller.service \
    >         rhel/usr_lib_systemd_system_ovn-controller-vtep.service \
    > +       rhel/usr_lib_systemd_system_ovn-ic.service \
    > +       rhel/usr_lib_systemd_system_ovn-ic-db.service \
    >         rhel/usr_lib_systemd_system_ovn-northd.service \
    >         rhel/usr_lib_firewalld_services_ovn-central-firewall-service.xml \
    >         rhel/usr_lib_firewalld_services_ovn-host-firewall-service.xml \
    > diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
    > index 6b11ef3e8..6716dd0d2 100644
    > --- a/rhel/ovn-fedora.spec.in
    > +++ b/rhel/ovn-fedora.spec.in
    > @@ -161,7 +161,7 @@ install -p -D -m 0644 \
    >          rhel/usr_share_ovn_scripts_systemd_sysconfig.template \
    >          $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/ovn
    >
    > -for service in ovn-controller ovn-controller-vtep ovn-northd; do
    > +for service in ovn-controller ovn-controller-vtep ovn-northd ovn-ic ovn-ic-db; do
    >          install -p -D -m 0644 \
    >                          rhel/usr_lib_systemd_system_${service}.service \
    >                          $RPM_BUILD_ROOT%{_unitdir}/${service}.service
    > @@ -256,7 +256,7 @@ if [ $1 -eq 1 ] ; then
    >      if [[ "$?" = "0" && "$ovn_status" = "0" ]]; then
    >          # ovn-controller-vtep service is running which means old
    >          # openvswitch-ovn-vtep is installed and it will be cleaned up. So
    > -        # start ovn-controller-vtep service when posttrans host is called.
    > +        # start ovn-controller-vtep service when posttrans vtep is called.
    >          touch %{_localstatedir}/lib/rpm-state/ovn-controller-vtep
    >      fi
    >  fi
    > @@ -272,6 +272,26 @@ fi
    >      fi
    >  %endif
    >
    > +%if 0%{?systemd_preun:1}
    > +    %systemd_preun ovn-ic.service
    > +%else
    > +    if [ $1 -eq 0 ] ; then
    > +        # Package removal, not upgrade
    > +        /bin/systemctl --no-reload disable ovn-ic.service >/dev/null 2>&1 || :
    > +        /bin/systemctl stop ovn-ic.service >/dev/null 2>&1 || :
    > +    fi
    > +%endif
    > +
    > +%if 0%{?systemd_preun:1}
    > +    %systemd_preun ovn-ic-db.service
    > +%else
    > +    if [ $1 -eq 0 ] ; then
    > +        # Package removal, not upgrade
    > +        /bin/systemctl --no-reload disable ovn-ic-db.service >/dev/null 2>&1 || :
    > +        /bin/systemctl stop ovn-ic-db.service >/dev/null 2>&1 || :
    > +    fi
    > +%endif
    > +
    >  %preun host
    >  %if 0%{?systemd_preun:1}
    >      %systemd_preun ovn-controller.service
    > @@ -312,6 +332,24 @@ fi
    >      fi
    >  %endif
    >
    > +%if 0%{?systemd_post:1}
    > +    %systemd_post ovn-ic.service
    > +%else
    > +    # Package install, not upgrade
    > +    if [ $1 -eq 1 ]; then
    > +        /bin/systemctl daemon-reload >dev/null || :
    > +    fi
    > +%endif
    > +
    > +%if 0%{?systemd_post:1}
    > +    %systemd_post ovn-ic-db.service
    > +%else
    > +    # Package install, not upgrade
    > +    if [ $1 -eq 1 ]; then
    > +        /bin/systemctl daemon-reload >dev/null || :
    > +    fi
    > +%endif
    > +
    >  %post host
    >  %if 0%{?systemd_post:1}
    >      %systemd_post ovn-controller.service
    > @@ -345,6 +383,22 @@ fi
    >      fi
    >  %endif
    >
    > +%if 0%{?systemd_postun_with_restart:1}
    > +    %systemd_postun_with_restart ovn-ic.service
    > +%else
    > +    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
    > +    if [ "$1" -ge "1" ] ; then
    > +    # Package upgrade, not uninstall
    > +        /bin/systemctl try-restart ovn-ic.service >/dev/null 2>&1 || :
    > +    fi
    > +%endif
    > +
    > +%if 0%{?systemd_postun:1}
    > +    %systemd_postun ovn-ic-db.service
    > +%else
    > +    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
    > +%endif
    > +
    >  %postun host
    >  %if 0%{?systemd_postun_with_restart:1}
    >      %systemd_postun_with_restart ovn-controller.service
    > @@ -439,6 +493,8 @@ fi
    >  %config %{_datadir}/ovn/ovn-sb.ovsschema
    >  %config %{_datadir}/ovn/ovn-ic-nb.ovsschema
    >  %config %{_datadir}/ovn/ovn-ic-sb.ovsschema
    > +%{_unitdir}/ovn-ic.service
    > +%{_unitdir}/ovn-ic-db.service
    >  %{_unitdir}/ovn-northd.service
    >  %{_prefix}/lib/firewalld/services/ovn-central-firewall-service.xml
    >
    > @@ -454,5 +510,8 @@ fi
    >  %{_unitdir}/ovn-controller-vtep.service
    >
    >  %changelog
    > +* Mon Feb 1 2021 Vladislav Odintsov <odivlad@gmail.com>
    > +- Added ovn-ic, ovn-ic-db systemd-units.
    > +
    >  * Thu Dec 20 2018 Numan Siddique <nusiddiq@redhat.com>
    >  - OVS/OVN split.
    > diff --git a/rhel/usr_lib_systemd_system_ovn-ic-db.service b/rhel/usr_lib_systemd_system_ovn-ic-db.service
    > new file mode 100644
    > index 000000000..04173d9a3
    > --- /dev/null
    > +++ b/rhel/usr_lib_systemd_system_ovn-ic-db.service
    > @@ -0,0 +1,32 @@
    > +# See ovn-ic(8) for details about ovn-ic.
    > +#
    > +# To customize the ovn-ic-db service, you may create a configuration file
    > +# in the /etc/systemd/system/ovn-ic-db.d/ directory.  For example, to specify
    > +# additional options to be passed to the "ovn-ctl start_ic_ovsdb" command, you
    > +# could place the following contents in
    > +# /etc/systemd/system/ovn-ic-db.d/local.conf:
    > +#
    > +#   [System]
    > +#   Environment="OVN_IC_DB_OPTS=--db-ic-nb-create-insecure-remote=yes --db-ic-sb-create-insecure-remote=yes"
    > +#
    > +# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-ic-db:
    > +#
    > +#   OVN_IC_DB_OPTS="--db-ic-nb-create-insecure-remote=yes --db-ic-sb-create-insecure-remote=yes"
    > +
    > +[Unit]
    > +Description=OVN global (IC) northbound and southbound OVSDB servers
    > +After=syslog.target
    > +
    > +[Service]
    > +Type=oneshot
    > +RemainAfterExit=yes
    > +Environment=OVN_RUNDIR=%t/ovn OVN_DBDIR=/var/lib/ovn
    > +EnvironmentFile=-/etc/sysconfig/ovn
    > +EnvironmentFile=-/etc/sysconfig/ovn-ic-db
    > +ExecStartPre=-/usr/bin/chown -R ${OVN_USER_ID} ${OVN_DBDIR}
    > +ExecStart=/usr/share/ovn/scripts/ovn-ctl \
    > +          --ovn-user=${OVN_USER_ID} start_ic_ovsdb $OVN_IC_DB_OPTS
    > +ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_ic_ovsdb
    > +
    > +[Install]
    > +WantedBy=multi-user.target
    > diff --git a/rhel/usr_lib_systemd_system_ovn-ic.service b/rhel/usr_lib_systemd_system_ovn-ic.service
    > new file mode 100644
    > index 000000000..2507a11e4
    > --- /dev/null
    > +++ b/rhel/usr_lib_systemd_system_ovn-ic.service
    > @@ -0,0 +1,31 @@
    > +# See ovn-ic(8) for details about ovn-ic.
    > +#
    > +# To customize the ovn-ic service, you may create a configuration file
    > +# in the /etc/systemd/system/ovn-ic.d/ directory.  For example, to specify
    > +# additional options to be passed to the "ovn-ctl start_ic" command, you
    > +# could place the following contents in
    > +# /etc/systemd/system/ovn-ic.d/local.conf:
    > +#
    > +#   [System]
    > +#   Environment="OVN_IC_OPTS=--db-ic-nb-sock=/usr/local/var/run/ovn/ovn_ic_nb_db.sock --db-ic-sb-sock=/usr/local/var/run/ovn/ovn_ic_sb_db.sock"
    > +#
    > +# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-ic:
    > +#
    > +#   OVN_IC_OPTS="--db-ic-nb-sock=/usr/local/var/run/ovn/ovn_ic_nb_db.sock --db-ic-sb-sock=/usr/local/var/run/ovn/ovn_ic_sb_db.sock"
    > +
    > +[Unit]
    > +Description=OVN ic management daemon
    > +After=syslog.target
    > +
    > +[Service]
    > +Type=oneshot
    > +RemainAfterExit=yes
    > +Environment=OVN_RUNDIR=%t/ovn OVN_DBDIR=/var/lib/ovn
    > +EnvironmentFile=-/etc/sysconfig/ovn
    > +EnvironmentFile=-/etc/sysconfig/ovn-ic
    > +ExecStart=/usr/share/ovn/scripts/ovn-ctl \
    > +          --ovn-user=${OVN_USER_ID} start_ic $OVN_IC_OPTS
    > +ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_ic
    > +
    > +[Install]
    > +WantedBy=multi-user.target
    > --
    > 2.29.2
    >
    > _______________________________________________
    > dev mailing list
    > dev@openvswitch.org
    > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
    >
    _______________________________________________
    dev mailing list
    dev@openvswitch.org
    https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

diff --git a/rhel/automake.mk b/rhel/automake.mk
index 661975ea9..3e71f5d80 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -13,6 +13,8 @@  EXTRA_DIST += \
 	rhel/ovn-fedora.spec.in \
 	rhel/usr_lib_systemd_system_ovn-controller.service \
 	rhel/usr_lib_systemd_system_ovn-controller-vtep.service \
+	rhel/usr_lib_systemd_system_ovn-ic.service \
+	rhel/usr_lib_systemd_system_ovn-ic-db.service \
 	rhel/usr_lib_systemd_system_ovn-northd.service \
 	rhel/usr_lib_firewalld_services_ovn-central-firewall-service.xml \
 	rhel/usr_lib_firewalld_services_ovn-host-firewall-service.xml \
diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
index 6b11ef3e8..6716dd0d2 100644
--- a/rhel/ovn-fedora.spec.in
+++ b/rhel/ovn-fedora.spec.in
@@ -161,7 +161,7 @@  install -p -D -m 0644 \
         rhel/usr_share_ovn_scripts_systemd_sysconfig.template \
         $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/ovn
 
-for service in ovn-controller ovn-controller-vtep ovn-northd; do
+for service in ovn-controller ovn-controller-vtep ovn-northd ovn-ic ovn-ic-db; do
         install -p -D -m 0644 \
                         rhel/usr_lib_systemd_system_${service}.service \
                         $RPM_BUILD_ROOT%{_unitdir}/${service}.service
@@ -256,7 +256,7 @@  if [ $1 -eq 1 ] ; then
     if [[ "$?" = "0" && "$ovn_status" = "0" ]]; then
         # ovn-controller-vtep service is running which means old
         # openvswitch-ovn-vtep is installed and it will be cleaned up. So
-        # start ovn-controller-vtep service when posttrans host is called.
+        # start ovn-controller-vtep service when posttrans vtep is called.
         touch %{_localstatedir}/lib/rpm-state/ovn-controller-vtep
     fi
 fi
@@ -272,6 +272,26 @@  fi
     fi
 %endif
 
+%if 0%{?systemd_preun:1}
+    %systemd_preun ovn-ic.service
+%else
+    if [ $1 -eq 0 ] ; then
+        # Package removal, not upgrade
+        /bin/systemctl --no-reload disable ovn-ic.service >/dev/null 2>&1 || :
+        /bin/systemctl stop ovn-ic.service >/dev/null 2>&1 || :
+    fi
+%endif
+
+%if 0%{?systemd_preun:1}
+    %systemd_preun ovn-ic-db.service
+%else
+    if [ $1 -eq 0 ] ; then
+        # Package removal, not upgrade
+        /bin/systemctl --no-reload disable ovn-ic-db.service >/dev/null 2>&1 || :
+        /bin/systemctl stop ovn-ic-db.service >/dev/null 2>&1 || :
+    fi
+%endif
+
 %preun host
 %if 0%{?systemd_preun:1}
     %systemd_preun ovn-controller.service
@@ -312,6 +332,24 @@  fi
     fi
 %endif
 
+%if 0%{?systemd_post:1}
+    %systemd_post ovn-ic.service
+%else
+    # Package install, not upgrade
+    if [ $1 -eq 1 ]; then
+        /bin/systemctl daemon-reload >dev/null || :
+    fi
+%endif
+
+%if 0%{?systemd_post:1}
+    %systemd_post ovn-ic-db.service
+%else
+    # Package install, not upgrade
+    if [ $1 -eq 1 ]; then
+        /bin/systemctl daemon-reload >dev/null || :
+    fi
+%endif
+
 %post host
 %if 0%{?systemd_post:1}
     %systemd_post ovn-controller.service
@@ -345,6 +383,22 @@  fi
     fi
 %endif
 
+%if 0%{?systemd_postun_with_restart:1}
+    %systemd_postun_with_restart ovn-ic.service
+%else
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+    if [ "$1" -ge "1" ] ; then
+    # Package upgrade, not uninstall
+        /bin/systemctl try-restart ovn-ic.service >/dev/null 2>&1 || :
+    fi
+%endif
+
+%if 0%{?systemd_postun:1}
+    %systemd_postun ovn-ic-db.service
+%else
+    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+%endif
+
 %postun host
 %if 0%{?systemd_postun_with_restart:1}
     %systemd_postun_with_restart ovn-controller.service
@@ -439,6 +493,8 @@  fi
 %config %{_datadir}/ovn/ovn-sb.ovsschema
 %config %{_datadir}/ovn/ovn-ic-nb.ovsschema
 %config %{_datadir}/ovn/ovn-ic-sb.ovsschema
+%{_unitdir}/ovn-ic.service
+%{_unitdir}/ovn-ic-db.service
 %{_unitdir}/ovn-northd.service
 %{_prefix}/lib/firewalld/services/ovn-central-firewall-service.xml
 
@@ -454,5 +510,8 @@  fi
 %{_unitdir}/ovn-controller-vtep.service
 
 %changelog
+* Mon Feb 1 2021 Vladislav Odintsov <odivlad@gmail.com>
+- Added ovn-ic, ovn-ic-db systemd-units.
+
 * Thu Dec 20 2018 Numan Siddique <nusiddiq@redhat.com>
 - OVS/OVN split.
diff --git a/rhel/usr_lib_systemd_system_ovn-ic-db.service b/rhel/usr_lib_systemd_system_ovn-ic-db.service
new file mode 100644
index 000000000..04173d9a3
--- /dev/null
+++ b/rhel/usr_lib_systemd_system_ovn-ic-db.service
@@ -0,0 +1,32 @@ 
+# See ovn-ic(8) for details about ovn-ic.
+#
+# To customize the ovn-ic-db service, you may create a configuration file
+# in the /etc/systemd/system/ovn-ic-db.d/ directory.  For example, to specify
+# additional options to be passed to the "ovn-ctl start_ic_ovsdb" command, you
+# could place the following contents in
+# /etc/systemd/system/ovn-ic-db.d/local.conf:
+#
+#   [System]
+#   Environment="OVN_IC_DB_OPTS=--db-ic-nb-create-insecure-remote=yes --db-ic-sb-create-insecure-remote=yes"
+#
+# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-ic-db:
+#
+#   OVN_IC_DB_OPTS="--db-ic-nb-create-insecure-remote=yes --db-ic-sb-create-insecure-remote=yes"
+
+[Unit]
+Description=OVN global (IC) northbound and southbound OVSDB servers
+After=syslog.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+Environment=OVN_RUNDIR=%t/ovn OVN_DBDIR=/var/lib/ovn
+EnvironmentFile=-/etc/sysconfig/ovn
+EnvironmentFile=-/etc/sysconfig/ovn-ic-db
+ExecStartPre=-/usr/bin/chown -R ${OVN_USER_ID} ${OVN_DBDIR}
+ExecStart=/usr/share/ovn/scripts/ovn-ctl \
+          --ovn-user=${OVN_USER_ID} start_ic_ovsdb $OVN_IC_DB_OPTS
+ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_ic_ovsdb
+
+[Install]
+WantedBy=multi-user.target
diff --git a/rhel/usr_lib_systemd_system_ovn-ic.service b/rhel/usr_lib_systemd_system_ovn-ic.service
new file mode 100644
index 000000000..2507a11e4
--- /dev/null
+++ b/rhel/usr_lib_systemd_system_ovn-ic.service
@@ -0,0 +1,31 @@ 
+# See ovn-ic(8) for details about ovn-ic.
+#
+# To customize the ovn-ic service, you may create a configuration file
+# in the /etc/systemd/system/ovn-ic.d/ directory.  For example, to specify
+# additional options to be passed to the "ovn-ctl start_ic" command, you
+# could place the following contents in
+# /etc/systemd/system/ovn-ic.d/local.conf:
+#
+#   [System]
+#   Environment="OVN_IC_OPTS=--db-ic-nb-sock=/usr/local/var/run/ovn/ovn_ic_nb_db.sock --db-ic-sb-sock=/usr/local/var/run/ovn/ovn_ic_sb_db.sock"
+#
+# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-ic:
+#
+#   OVN_IC_OPTS="--db-ic-nb-sock=/usr/local/var/run/ovn/ovn_ic_nb_db.sock --db-ic-sb-sock=/usr/local/var/run/ovn/ovn_ic_sb_db.sock"
+
+[Unit]
+Description=OVN ic management daemon
+After=syslog.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+Environment=OVN_RUNDIR=%t/ovn OVN_DBDIR=/var/lib/ovn
+EnvironmentFile=-/etc/sysconfig/ovn
+EnvironmentFile=-/etc/sysconfig/ovn-ic
+ExecStart=/usr/share/ovn/scripts/ovn-ctl \
+          --ovn-user=${OVN_USER_ID} start_ic $OVN_IC_OPTS
+ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_ic
+
+[Install]
+WantedBy=multi-user.target