[ovs-dev] [PATCH ovn] rhel: Add systemd-unit for ovsdb-server-ic
numans at ovn.org
numans at ovn.org
Wed Jan 27 17:58:17 UTC 2021
From: Vladislav Odintsov <odivlad at gmail.com>
New ovsdb-server-ic.service systemd-unit manages OVN_IC_Northbound and
OVN_IC_Southbound OVSDB server processes.
Signed-off-by: Vladislav Odintsov <odivlad at gmail.com>
---
rhel/automake.mk | 1 +
rhel/ovn-fedora.spec.in | 28 +++++++++++++++-
rhel/usr_lib_systemd_system_ovn-ic.service | 1 -
...lib_systemd_system_ovsdb-server-ic.service | 32 +++++++++++++++++++
4 files changed, 60 insertions(+), 2 deletions(-)
create mode 100644 rhel/usr_lib_systemd_system_ovsdb-server-ic.service
diff --git a/rhel/automake.mk b/rhel/automake.mk
index 0e8795feb3..16d1b618b1 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -15,6 +15,7 @@ EXTRA_DIST += \
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_systemd_system_ovsdb-server-ic.service \
rhel/usr_lib_firewalld_services_ovn-central-firewall-service.xml \
rhel/usr_lib_firewalld_services_ovn-host-firewall-service.xml \
rhel/usr_share_ovn_scripts_systemd_sysconfig.template
diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
index 6938deee6a..8890e33db9 100644
--- a/rhel/ovn-fedora.spec.in
+++ b/rhel/ovn-fedora.spec.in
@@ -169,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 ovn-ic; do
+for service in ovn-controller ovn-controller-vtep ovn-northd ovn-ic ovsdb-server-ic; do
install -p -D -m 0644 \
rhel/usr_lib_systemd_system_${service}.service \
$RPM_BUILD_ROOT%{_unitdir}/${service}.service
@@ -291,6 +291,16 @@ fi
fi
%endif
+%if 0%{?systemd_preun:1}
+ %systemd_preun ovsdb-server-ic.service
+%else
+ if [ $1 -eq 0 ] ; then
+ # Package removal, not upgrade
+ /bin/systemctl --no-reload disable ovsdb-server-ic.service >/dev/null 2>&1 || :
+ /bin/systemctl stop ovsdb-server-ic.service >/dev/null 2>&1 || :
+ fi
+%endif
+
%preun host
%if 0%{?systemd_preun:1}
%systemd_preun ovn-controller.service
@@ -341,6 +351,15 @@ fi
fi
%endif
+%if 0%{?systemd_post:1}
+ %systemd_post ovsdb-server-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
@@ -385,6 +404,12 @@ fi
fi
%endif
+%if 0%{?systemd_postun:1}
+ %systemd_postun ovsdb-server-ic.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
@@ -484,6 +509,7 @@ fi
%config %{_datadir}/ovn/ovn-ic-nb.ovsschema
%config %{_datadir}/ovn/ovn-ic-sb.ovsschema
%{_unitdir}/ovn-ic.service
+%{_unitdir}/ovsdb-server-ic.service
%files host
%{_bindir}/ovn-controller
diff --git a/rhel/usr_lib_systemd_system_ovn-ic.service b/rhel/usr_lib_systemd_system_ovn-ic.service
index 46ca0cff12..2507a11e40 100644
--- a/rhel/usr_lib_systemd_system_ovn-ic.service
+++ b/rhel/usr_lib_systemd_system_ovn-ic.service
@@ -23,7 +23,6 @@ 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
diff --git a/rhel/usr_lib_systemd_system_ovsdb-server-ic.service b/rhel/usr_lib_systemd_system_ovsdb-server-ic.service
new file mode 100644
index 0000000000..c1ed0341a2
--- /dev/null
+++ b/rhel/usr_lib_systemd_system_ovsdb-server-ic.service
@@ -0,0 +1,32 @@
+# See ovn-ic(8) for details about ovn-ic.
+#
+# To customize the ovsdb-server-ic service, you may create a configuration file
+# in the /etc/systemd/system/ovsdb-server-ic.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/ovsdb-server-ic.d/local.conf:
+#
+# [System]
+# Environment="OVSDB_SERVER_IC=--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/ovsdb-server-ic:
+#
+# OVSDB_SERVER_IC=--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/ovsdb-server-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_ovsdb $OVSDB_SERVER_IC
+ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_ic_ovsdb
+
+[Install]
+WantedBy=multi-user.target
--
2.29.2
More information about the dev
mailing list