[ovs-dev] [PATCH ovn 2/3] rhel: add systemd-unit for ovn-ic

numans at ovn.org numans at ovn.org
Tue Dec 15 06:54:14 UTC 2020


From: Vladislav Odintsov <odivlad at gmail.com>

This commit adds new systemd-unit `ovn-ic.service` to manage OVN Interconnection
daemons using systemd.

Signed-off-by: Vladislav Odintsov <odivlad at gmail.com>
---
 rhel/automake.mk                           |  1 +
 rhel/ovn-fedora.spec.in                    | 20 ++++++++++++--
 rhel/usr_lib_systemd_system_ovn-ic.service | 32 ++++++++++++++++++++++
 3 files changed, 50 insertions(+), 3 deletions(-)
 create mode 100644 rhel/usr_lib_systemd_system_ovn-ic.service

diff --git a/rhel/automake.mk b/rhel/automake.mk
index 661975ea9..0e8795feb 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 6b11ef3e8..7eed9ddb5 100644
--- a/rhel/ovn-fedora.spec.in
+++ b/rhel/ovn-fedora.spec.in
@@ -82,7 +82,7 @@ Obsoletes: openvswitch-ovn-central
 Provides: openvswitch-ovn-central = %{?epoch:%{epoch}:}%{version}-%{release}
 
 %description central
-OVN DB servers and ovn-northd running on a central node.
+OVN DB servers, ovn-northd and ovn-ic running on a central node.
 
 %package host
 Summary: Open Virtual Network support
@@ -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; do
         install -p -D -m 0644 \
                         rhel/usr_lib_systemd_system_${service}.service \
                         $RPM_BUILD_ROOT%{_unitdir}/${service}.service
@@ -264,11 +264,14 @@ fi
 %preun central
 %if 0%{?systemd_preun:1}
     %systemd_preun ovn-northd.service
+    %systemd_preun ovn-ic.service
 %else
     if [ $1 -eq 0 ] ; then
         # Package removal, not upgrade
         /bin/systemctl --no-reload disable ovn-northd.service >/dev/null 2>&1 || :
         /bin/systemctl stop ovn-northd.service >/dev/null 2>&1 || :
+        /bin/systemctl --no-reload disable ovn-ic.service >/dev/null 2>&1 || :
+        /bin/systemctl stop ovn-ic.service >/dev/null 2>&1 || :
     fi
 %endif
 
@@ -305,6 +308,7 @@ fi
 %post central
 %if 0%{?systemd_post:1}
     %systemd_post ovn-northd.service
+    %systemd_post ovn-ic.service
 %else
     # Package install, not upgrade
     if [ $1 -eq 1 ]; then
@@ -337,11 +341,13 @@ fi
 %postun central
 %if 0%{?systemd_postun_with_restart:1}
     %systemd_postun_with_restart ovn-northd.service
+    %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-northd.service >/dev/null 2>&1 || :
+        /bin/systemctl try-restart ovn-ic.service >/dev/null 2>&1 || :
     fi
 %endif
 
@@ -374,6 +380,10 @@ if [ $1 -eq 1 ]; then
         rm %{_localstatedir}/lib/rpm-state/ovn-northd
         /bin/systemctl start ovn-northd.service >/dev/null 2>&1 || :
     fi
+    if [ -e %{_localstatedir}/lib/rpm-state/ovn-ic ]; then
+        rm %{_localstatedir}/lib/rpm-state/ovn-ic
+        /bin/systemctl start ovn-ic.service >/dev/null 2>&1 || :
+    fi
 fi
 
 
@@ -421,7 +431,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
@@ -435,11 +444,13 @@ fi
 %{_bindir}/ovn-northd
 %{_bindir}/ovn-ic
 %{_mandir}/man8/ovn-northd.8*
+%{_mandir}/man8/ovn-ic.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
+%{_unitdir}/ovn-ic.service
 %{_prefix}/lib/firewalld/services/ovn-central-firewall-service.xml
 
 %files host
@@ -454,5 +465,8 @@ fi
 %{_unitdir}/ovn-controller-vtep.service
 
 %changelog
+* Wed Dec 9 2020 Vladislav Odintsov <odivlad at gmail.com>
+- Added ovn-ic systemd-unit
+
 * Thu Dec 20 2018 Numan Siddique <nusiddiq at redhat.com>
 - 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 000000000..46ca0cff1
--- /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.28.0



More information about the dev mailing list