diff --git a/openvswitch-2.13.3.tar.gz b/openvswitch-2.13.3.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..508595b35232a8a66ecc362befbc5b8bf9a4c39c Binary files /dev/null and b/openvswitch-2.13.3.tar.gz differ diff --git a/ovn-20.06.3.tar.gz b/ovn-20.06.3.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..fd3f51b2f88e94134e7a584311d0baa1e37af224 Binary files /dev/null and b/ovn-20.06.3.tar.gz differ diff --git a/ovn.spec b/ovn.spec new file mode 100644 index 0000000000000000000000000000000000000000..357da562de127f226b9b1c7c3feeddb1e8121fd7 --- /dev/null +++ b/ovn.spec @@ -0,0 +1,321 @@ +%define ovs_version 2.13.3 +%define ovn_version 20.06.3 +%define ovs_dir openvswitch-%{ovs_version} + +Name: ovn +Version: %{ovn_version} +Release: 1 +Summary: Open Virtual Network support +URL: https://www.ovn.org/ +Source0: https://github.com/ovn-org/ovn/archive/refs/tags/v%{ovn_version}.tar.gz#/ovn-%{version}.tar.gz +# These OVS sources is used only as a set of libraries to build OVN +# binaries. To actually run OVS binaries (ovs-vswitchd, ovsdb-server) +# use packages provided in openEuler distribution. +Source1: https://www.openvswitch.org/releases/openvswitch-%{ovs_version}.tar.gz + +# The entire source code of OVN and OVS is licensed under the ASL 2.0. +# But, some files are marked specifically with a different license. +# For example, +# - ovn/build-aux/cccl which is GPLv2+ +# - ovs/datapath/* which is GPLv2 +# ... +# For a breakdown of the licensing, see the "License" section of +# README.rst. +License: ASL 2.0 and BSD and GPLv2 and GPLv2+ and LGPLv2 and SISSL + +BuildRequires: gcc autoconf automake libtool make +BuildRequires: systemd openssl openssl-devel +BuildRequires: python3-devel python3-six python3-setuptools +BuildRequires: python3-sphinx +BuildRequires: desktop-file-utils +BuildRequires: groff-base groff graphviz +BuildRequires: unbound-devel +BuildRequires: python3-pyOpenSSL +BuildRequires: libcap-ng-devel +# Needed by the testsuite +BuildRequires: procps-ng + +Requires: openssl hostname iproute module-init-tools openvswitch libibverbs + +%description +OVN (Open Virtual Network) is a series of daemons that translates +virtual network configuration into OpenFlow, and installs them into +Open vSwitch. OVN provides a higher-layer abstraction then Open vSwitch, +working with logical routers and logical switches, rather than flows. +OVN is intended to be used by cloud management software (CMS). + +%package central +Summary: Open Virtual Network support +License: ASL 2.0 +Requires: %{name} +Requires: firewalld-filesystem + +%description central +OVN DB servers and ovn-northd running on a central node. + +%package host +Summary: Open Virtual Network support +License: ASL 2.0 +Requires: %{name} +Requires: firewalld-filesystem + +%description host +OVN controller running on each host. + +%package vtep +Summary: Open Virtual Network support +License: ASL 2.0 +Requires: %{name} + +%description vtep +OVN vtep controller + +%package docker +Summary: Open Virtual Network support +License: ASL 2.0 +Requires: %{name} + +%description docker +Docker network plugins for OVN. + +%prep +%autosetup -n %{name}-%{ovn_version} -a 1 + +%build +./boot.sh + +# OVN source code is now separate. +# Build openvswitch first. +pushd %{ovs_dir} +./boot.sh +%configure \ + --enable-libcapng \ + --enable-ssl \ + --with-pkidir=%{_sharedstatedir}/openvswitch/pki \ + PYTHON3=%{__python3} +make %{?_smp_mflags} +popd + +# Build OVN. +%configure \ + --with-ovs-source=$PWD/%{ovs_dir} \ + --enable-libcapng \ + --enable-ssl \ + --with-pkidir=%{_sharedstatedir}/openvswitch/pki \ + PYTHON3=%{__python3} +make %{?_smp_mflags} + +%install +%make_install + +install -p -D -m 0644 \ + rhel/usr_share_ovn_scripts_systemd_sysconfig.template \ + %{buildroot}/%{_sysconfdir}/sysconfig/ovn + +for service in ovn-controller ovn-controller-vtep ovn-northd; do + install -p -D -m 0644 \ + rhel/usr_lib_systemd_system_${service}.service \ + %{buildroot}%{_unitdir}/${service}.service +done + +install -d -m 0755 %{buildroot}/%{_sharedstatedir}/ovn + +install -d %{buildroot}%{_prefix}/lib/firewalld/services/ +install -p -m 0644 rhel/usr_lib_firewalld_services_ovn-central-firewall-service.xml \ + %{buildroot}%{_prefix}/lib/firewalld/services/ovn-central-firewall-service.xml +install -p -m 0644 rhel/usr_lib_firewalld_services_ovn-host-firewall-service.xml \ + %{buildroot}%{_prefix}/lib/firewalld/services/ovn-host-firewall-service.xml + +install -d -m 0755 %{buildroot}%{_prefix}/lib/ocf/resource.d/ovn +ln -s %{_datadir}/ovn/scripts/ovndb-servers.ocf \ + %{buildroot}%{_prefix}/lib/ocf/resource.d/ovn/ovndb-servers + +install -p -D -m 0644 rhel/etc_logrotate.d_ovn \ + %{buildroot}/%{_sysconfdir}/logrotate.d/ovn + +# remove OVS unpackages files +rm -f %{buildroot}%{_bindir}/ovs* +rm -f %{buildroot}%{_bindir}/vtep-ctl +rm -f %{buildroot}%{_sbindir}/ovs* +rm -f %{buildroot}%{_mandir}/man1/ovs* +rm -f %{buildroot}%{_mandir}/man5/ovs* +rm -f %{buildroot}%{_mandir}/man5/vtep* +rm -f %{buildroot}%{_mandir}/man7/ovs* +rm -f %{buildroot}%{_mandir}/man8/ovs* +rm -f %{buildroot}%{_mandir}/man8/vtep* +rm -rf %{buildroot}%{_datadir}/ovn/python +rm -f %{buildroot}%{_datadir}/ovn/scripts/ovs* +rm -rf %{buildroot}%{_datadir}/ovn/bugtool-plugins +rm -f %{buildroot}%{_libdir}/*.a +rm -f %{buildroot}%{_libdir}/*.la +rm -f %{buildroot}%{_libdir}/pkgconfig/*.pc +rm -f %{buildroot}%{_includedir}/ovn/* +rm -f %{buildroot}%{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash +rm -f %{buildroot}%{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash +rm -rf %{buildroot}%{_sysconfdir}/logrotate.d/openvswitch +rm -f %{buildroot}%{_datadir}/ovn/scripts/ovn-bugtool* + +%check +touch resolv.conf +export OVS_RESOLV_CONF=$(pwd)/resolv.conf +if make check TESTSUITEFLAGS='%{_smp_mflags} -k ovn' || + make check TESTSUITEFLAGS='--recheck -k ovn'; then :; +else + cat tests/testsuite.log +fi + +%pre central +if [ $1 -eq 1 ] ; then + # Package install. + /bin/systemctl status ovn-northd.service >/dev/null + ovn_status=$? + if [[ "$ovn_status" = "0" ]]; then + # ovn-northd service is running which means old openvswitch-ovn-central + # is possibly installed and it will be cleaned up. So start ovn-northd + # service when posttrans central is called. + touch %{_localstatedir}/lib/rpm-state/ovn-northd + fi +fi + +%pre host +if [ $1 -eq 1 ] ; then + # Package install. + /bin/systemctl status ovn-controller.service >/dev/null + ovn_status=$? + if [[ "$ovn_status" = "0" ]]; then + # ovn-controller service is running which means old + # openvswitch-ovn-host is possibly installed and it will be cleaned up. So + # start ovn-controller service when posttrans host is called. + touch %{_localstatedir}/lib/rpm-state/ovn-controller + fi +fi + +%pre vtep +if [ $1 -eq 1 ] ; then + # Package install. + /bin/systemctl status ovn-controller-vtep.service >/dev/null + ovn_status=$? + if [[ "$ovn_status" = "0" ]]; then + # ovn-controller-vtep service is running which means old + # openvswitch-ovn-vtep is possibly installed and it will be cleaned up. So + # start ovn-controller-vtep service when posttrans host is called. + touch %{_localstatedir}/lib/rpm-state/ovn-controller-vtep + fi +fi + +%preun central +%systemd_preun ovn-northd.service + +%preun host +%systemd_preun ovn-controller.service + +%preun vtep +%systemd_preun ovn-controller-vtep.service + +%post +%if %{with libcapng} +if [ $1 -eq 1 ]; then + sed -i 's:^#OVN_USER_ID=:OVN_USER_ID=:' %{_sysconfdir}/sysconfig/ovn + sed -i 's:\(.*su\).*:\1 openvswitch openvswitch:' %{_sysconfdir}/logrotate.d/ovn +fi +%endif + +%post central +%systemd_post ovn-northd.service + +%post host +%systemd_post ovn-controller.service + +%post vtep +%systemd_post ovn-controller-vtep.service + +%posttrans central +if [ $1 -eq 1 ]; then + # Package install, not upgrade + if [ -e %{_localstatedir}/lib/rpm-state/ovn-northd ]; then + unlink %{_localstatedir}/lib/rpm-state/ovn-northd + /bin/systemctl start ovn-northd.service >/dev/null 2>&1 || : + fi +fi + +%posttrans host +if [ $1 -eq 1 ]; then + # Package install, not upgrade + if [ -e %{_localstatedir}/lib/rpm-state/ovn-controller ]; then + unlink %{_localstatedir}/lib/rpm-state/ovn-controller + /bin/systemctl start ovn-controller.service >/dev/null 2>&1 || : + fi +fi + +%posttrans vtep +if [ $1 -eq 1 ]; then + # Package install, not upgrade + if [ -e %{_localstatedir}/lib/rpm-state/ovn-controller-vtep ]; then + unlink %{_localstatedir}/lib/rpm-state/ovn-controller-vtep + /bin/systemctl start ovn-controller-vtep.service >/dev/null 2>&1 || : + fi +fi + +%files +%{_bindir}/ovn-nbctl +%{_bindir}/ovn-sbctl +%{_bindir}/ovn-trace +%{_bindir}/ovn-detrace +%{_bindir}/ovn-appctl +%{_bindir}/ovn-ic-nbctl +%{_bindir}/ovn-ic-sbctl +%dir %{_datadir}/ovn/ +%dir %{_datadir}/ovn/scripts/ +%{_datadir}/ovn/scripts/ovn-ctl +%{_datadir}/ovn/scripts/ovn-lib +%{_datadir}/ovn/scripts/ovndb-servers.ocf +%{_mandir}/man8/ovn-ctl.8* +%{_mandir}/man8/ovn-appctl.8* +%{_mandir}/man8/ovn-nbctl.8* +%{_mandir}/man8/ovn-trace.8* +%{_mandir}/man1/ovn-detrace.1* +%{_mandir}/man7/ovn-architecture.7* +%{_mandir}/man8/ovn-sbctl.8* +%{_mandir}/man5/ovn-nb.5* +%{_mandir}/man5/ovn-sb.5* +%{_mandir}/man8/ovn-ic-nbctl.8* +%{_mandir}/man8/ovn-ic-sbctl.8* +%{_mandir}/man5/ovn-ic-nb.5* +%{_mandir}/man5/ovn-ic-sb.5* +%dir %{_prefix}/lib/ocf/resource.d/ovn/ +%{_prefix}/lib/ocf/resource.d/ovn/ovndb-servers +%config(noreplace) %{_sysconfdir}/logrotate.d/ovn +%config(noreplace) %{_sysconfdir}/sysconfig/ovn +%license LICENSE + +%files docker +%{_bindir}/ovn-docker-overlay-driver +%{_bindir}/ovn-docker-underlay-driver + +%files central +%{_bindir}/ovn-northd +%{_bindir}/ovn-ic +%{_mandir}/man8/ovn-northd.8* +%{_mandir}/man8/ovn-ic.8* +%{_datadir}/ovn/ovn-nb.ovsschema +%{_datadir}/ovn/ovn-sb.ovsschema +%{_datadir}/ovn/ovn-ic-nb.ovsschema +%{_datadir}/ovn/ovn-ic-sb.ovsschema +%{_unitdir}/ovn-northd.service +%{_prefix}/lib/firewalld/services/ovn-central-firewall-service.xml + +%files host +%{_bindir}/ovn-controller +%{_mandir}/man8/ovn-controller.8* +%{_unitdir}/ovn-controller.service +%{_prefix}/lib/firewalld/services/ovn-host-firewall-service.xml + +%files vtep +%{_bindir}/ovn-controller-vtep +%{_mandir}/man8/ovn-controller-vtep.8* +%{_unitdir}/ovn-controller-vtep.service + +%changelog +* Tue Nov 29 2022 Han Guangyu - 20.06.3-1 +- Init package +