Skip to content

Commit

Permalink
rhel: Add systemd-unit for ovsdb-server-ic
Browse files Browse the repository at this point in the history
New ovsdb-server-ic.service systemd-unit manages OVN_IC_Northbound and
OVN_IC_Southbound OVSDB server processes.

Signed-off-by: Vladislav Odintsov <odivlad@gmail.com>
  • Loading branch information
odivlad committed Jan 27, 2021
1 parent a2d043d commit 8da8799
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 2 deletions.
1 change: 1 addition & 0 deletions rhel/automake.mk
Expand Up @@ -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
Expand Down
28 changes: 27 additions & 1 deletion rhel/ovn-fedora.spec.in
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion rhel/usr_lib_systemd_system_ovn-ic.service
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions 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

0 comments on commit 8da8799

Please sign in to comment.