Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to manage ovn-ic services with systemd #65

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions rhel/automake.mk
Expand Up @@ -14,6 +14,7 @@ EXTRA_DIST += \
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 \
Expand Down
53 changes: 33 additions & 20 deletions rhel/ovn-fedora.spec.in
Expand Up @@ -84,14 +84,6 @@ 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
Expand Down Expand Up @@ -169,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 ovn-ic; 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
Expand Down Expand Up @@ -280,7 +272,6 @@ fi
fi
%endif

%preun ic
%if 0%{?systemd_preun:1}
%systemd_preun ovn-ic.service
%else
Expand All @@ -291,6 +282,16 @@ fi
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
Expand Down Expand Up @@ -331,7 +332,6 @@ fi
fi
%endif

%post ic
%if 0%{?systemd_post:1}
%systemd_post ovn-ic.service
%else
Expand All @@ -341,6 +341,15 @@ fi
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
Expand Down Expand Up @@ -374,7 +383,6 @@ fi
fi
%endif

%postun ic
%if 0%{?systemd_postun_with_restart:1}
%systemd_postun_with_restart ovn-ic.service
%else
Expand All @@ -385,6 +393,12 @@ fi
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
Expand Down Expand Up @@ -461,6 +475,7 @@ 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
Expand All @@ -472,18 +487,16 @@ 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
%{_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
%{_unitdir}/ovn-ic-db.service
%{_unitdir}/ovn-northd.service
%{_prefix}/lib/firewalld/services/ovn-central-firewall-service.xml

%files host
%{_bindir}/ovn-controller
Expand All @@ -497,8 +510,8 @@ fi
%{_unitdir}/ovn-controller-vtep.service

%changelog
* Wed Dec 9 2020 Vladislav Odintsov <odivlad@gmail.com>
- Added ovn-ic systemd-unit and subpackage.
* 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.
32 changes: 32 additions & 0 deletions 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
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}
odivlad marked this conversation as resolved.
Show resolved Hide resolved
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