From: Vladislav Odintsov <[email protected]> This commit adds new systemd-unit `ovn-ic.service` to manage OVN Interconnection daemons using systemd.
Signed-off-by: Vladislav Odintsov <[email protected]> --- rhel/automake.mk | 1 + rhel/ovn-fedora.spec.in | 58 +++++++++++++++++++--- rhel/usr_lib_systemd_system_ovn-ic.service | 32 ++++++++++++ 3 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 rhel/usr_lib_systemd_system_ovn-ic.service diff --git a/rhel/automake.mk b/rhel/automake.mk index 661975ea96..0e8795feb3 100644 --- a/rhel/automake.mk +++ b/rhel/automake.mk @@ -13,6 +13,7 @@ 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-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 6b11ef3e89..6938deee6a 100644 --- a/rhel/ovn-fedora.spec.in +++ b/rhel/ovn-fedora.spec.in @@ -84,6 +84,14 @@ Provides: openvswitch-ovn-central = %{?epoch:%{epoch}:}%{version}-%{release} %description central OVN DB servers and ovn-northd running on a central node. +%package ic +Summary: Open Virtual Network interconnection support +License: ASL 2.0 +Requires: ovn + +%description ic +OVN IC DB servers and ovn-ic. + %package host Summary: Open Virtual Network support License: ASL 2.0 @@ -161,7 +169,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; do install -p -D -m 0644 \ rhel/usr_lib_systemd_system_${service}.service \ $RPM_BUILD_ROOT%{_unitdir}/${service}.service @@ -256,7 +264,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 +280,17 @@ fi fi %endif +%preun ic +%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 + %preun host %if 0%{?systemd_preun:1} %systemd_preun ovn-controller.service @@ -312,6 +331,16 @@ fi fi %endif +%post ic +%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 + %post host %if 0%{?systemd_post:1} %systemd_post ovn-controller.service @@ -345,6 +374,17 @@ fi fi %endif +%postun ic +%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 + %postun host %if 0%{?systemd_postun_with_restart:1} %systemd_postun_with_restart ovn-controller.service @@ -421,7 +461,6 @@ fi %{_mandir}/man5/ovn-sb.5* %{_mandir}/man8/ovn-ic-nbctl.8* %{_mandir}/man8/ovn-ic-sbctl.8* -%{_mandir}/man8/ovn-ic.8* %{_mandir}/man5/ovn-ic-nb.5* %{_mandir}/man5/ovn-ic-sb.5* %{_prefix}/lib/ocf/resource.d/ovn/ovndb-servers @@ -433,15 +472,19 @@ fi %files central %{_bindir}/ovn-northd -%{_bindir}/ovn-ic %{_mandir}/man8/ovn-northd.8* %config %{_datadir}/ovn/ovn-nb.ovsschema %config %{_datadir}/ovn/ovn-sb.ovsschema -%config %{_datadir}/ovn/ovn-ic-nb.ovsschema -%config %{_datadir}/ovn/ovn-ic-sb.ovsschema %{_unitdir}/ovn-northd.service %{_prefix}/lib/firewalld/services/ovn-central-firewall-service.xml +%files ic +%{_bindir}/ovn-ic +%{_mandir}/man8/ovn-ic.8* +%config %{_datadir}/ovn/ovn-ic-nb.ovsschema +%config %{_datadir}/ovn/ovn-ic-sb.ovsschema +%{_unitdir}/ovn-ic.service + %files host %{_bindir}/ovn-controller %{_mandir}/man8/ovn-controller.8* @@ -454,5 +497,8 @@ fi %{_unitdir}/ovn-controller-vtep.service %changelog +* Wed Dec 9 2020 Vladislav Odintsov <[email protected]> +- Added ovn-ic systemd-unit and subpackage. + * Thu Dec 20 2018 Numan Siddique <[email protected]> - OVS/OVN split. 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 0000000000..46ca0cff12 --- /dev/null +++ b/rhel/usr_lib_systemd_system_ovn-ic.service @@ -0,0 +1,32 @@ +# 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 +ExecStartPre=-/usr/bin/chown -R ${OVN_USER_ID} ${OVN_DBDIR} +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 [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
