Skip to content

Commit

Permalink
Fix "make rpm-fedora"
Browse files Browse the repository at this point in the history
"make rpm-fedora" is broken and this patch fixes it. Previous patch
in this series supported building OVN from external OVS sources.

Before running "make rpm-fedora", it is expected that the developer has run
"make dist" in the OVS source folder to generate the openvswitch-%{version}.tar.gz.
This tar file is copied to rpmbuild/SOURCES. The rpm spec file extracts this tar
file (using %autosetup in prep step) and compiles it before compiling OVN.

Acked-by: Mark Michelson <[email protected]>
Signed-off-by: Numan Siddique <[email protected]>
  • Loading branch information
numansiddique committed Aug 29, 2019
1 parent 2cfaaa4 commit 70f42bd
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 45 deletions.
13 changes: 10 additions & 3 deletions Documentation/intro/install/fedora.rst
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,15 @@ Building
OVN RPMs
~~~~~~~~~~~~~~~

To build OVN RPMs, execute the following from the directory
in which `./configure` was executed:
To build OVN RPMs, first generate openvswitch source tarball in
your openvwitch source directory by running

::

$make dist

And then execute the following in the OVN source directory
(in which `./configure` was executed):

::

Expand All @@ -108,7 +115,7 @@ This will create the RPMs `ovn`, `ovn-central`, `ovn-host`, `ovn-vtep`,
``ovn-host-debuginfo`` and ```ovn-vtep-debuginfo```.


You can also have the above commands automatically run the Open vSwitch unit
You can also have the above commands automatically run the OVN unit
tests. This can take several minutes.

::
Expand Down
2 changes: 2 additions & 0 deletions Documentation/intro/install/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ Example usage::
$./boot.sh
$./configure --with-ovs-source=/home/foo/ovs/ --with-ovs-build=/home/foo/ovs/_gcc

It is expected to configure both Open vSwitch and OVN with the same prefix.

.. _general-building:

Building
Expand Down
2 changes: 2 additions & 0 deletions rhel/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
EXTRA_DIST += \
rhel/README.RHEL.rst \
rhel/automake.mk \
rhel/etc_logrotate.d_ovn \
rhel/ovn-fedora.spec \
rhel/ovn-fedora.spec.in \
rhel/usr_lib_systemd_system_ovn-controller.service \
Expand All @@ -27,6 +28,7 @@ RPMBUILD_OPT ?= --without check
rpm-fedora: dist $(srcdir)/rhel/ovn-fedora.spec
${MKDIR_P} ${RPMBUILD_TOP}/SOURCES
cp ${DIST_ARCHIVES} ${RPMBUILD_TOP}/SOURCES
cp $(ovs_builddir)/openvswitch-$(VERSION).tar.gz ${RPMBUILD_TOP}/SOURCES
rpmbuild ${RPMBUILD_OPT} \
-D "_topdir ${RPMBUILD_TOP}" \
-ba $(srcdir)/rhel/ovn-fedora.spec
Expand Down
22 changes: 22 additions & 0 deletions rhel/etc_logrotate.d_ovn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (C) 2019 Red Hat, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without warranty of any kind.

/var/log/ovn/*.log {
su root root
daily
compress
sharedscripts
missingok
postrotate
# Tell OVN daemons to reopen their log files
if [ -d /var/run/ovn ]; then
for ctl in /var/run/ovn/*.ctl; do
ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
done
fi
endscript
}
78 changes: 54 additions & 24 deletions rhel/ovn-fedora.spec.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Spec file for Open Virtual Network (OVN).

# Copyright (C) 2018 Red Hat, Inc.
# Copyright (C) 2018,2019 Red Hat, Inc.
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
Expand Down Expand Up @@ -48,11 +48,15 @@ Version: @VERSION@
Obsoletes: openvswitch-ovn-common < %{?epoch:%{epoch}:}%{version}-%{release}
Provides: openvswitch-ovn-common = %{?epoch:%{epoch}:}%{version}-%{release}

%define ovsver %{version}
%define ovsdir openvswitch-%{ovsver}

# Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the
# lib/sflow*.[ch] files are SISSL
License: ASL 2.0 and LGPLv2+ and SISSL
Release: 1%{?dist}
Source: http://openvswitch.org/releases/openvswitch-%{version}.tar.gz
Source: http://openvswitch.org/releases/ovn-%{version}.tar.gz
Source10: http://openvswitch.org/releases/openvswitch-%{ovsver}.tar.gz

BuildRequires: gcc gcc-c++
BuildRequires: autoconf automake libtool
Expand Down Expand Up @@ -131,10 +135,37 @@ Provides: openvswitch-ovn-docker = %{?epoch:%{epoch}:}%{version}-%{release}
Docker network plugins for OVN.

%prep
%setup -n openvswitch-%{version}
%autosetup -n ovn-%{version} -a 10 -p 1


%build
./boot.sh

# Build openvswitch first
cd openvswitch-%{ovsver}
./boot.sh
%configure \
--with-ovs-source=ovs \
%if %{with libcapng}
--enable-libcapng \
%else
--disable-libcapng \
%endif
--enable-ssl \
--with-pkidir=%{_sharedstatedir}/openvswitch/pki \
%if 0%{?fedora} > 22 || %{with build_python3}
PYTHON3=%{__python3} \
PYTHON=%{__python2}
%else
PYTHON=%{__python}
%endif

make %{?_smp_mflags}
cd -

# Build OVN.
%configure \
--with-ovs-source=$PWD/openvswitch-%{ovsver} \
%if %{with libcapng}
--enable-libcapng \
%else
Expand Down Expand Up @@ -163,7 +194,7 @@ done

rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/

install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/ovn

install -d $RPM_BUILD_ROOT%{_prefix}/lib/firewalld/services/
install -p -m 0644 rhel/usr_lib_firewalld_services_ovn-central-firewall-service.xml \
Expand All @@ -172,9 +203,12 @@ install -p -m 0644 rhel/usr_lib_firewalld_services_ovn-host-firewall-service.xml
$RPM_BUILD_ROOT%{_prefix}/lib/firewalld/services/ovn-host-firewall-service.xml

install -d -m 0755 $RPM_BUILD_ROOT%{_prefix}/lib/ocf/resource.d/ovn
ln -s %{_datadir}/openvswitch/scripts/ovndb-servers.ocf \
ln -s %{_datadir}/ovn/scripts/ovndb-servers.ocf \
$RPM_BUILD_ROOT%{_prefix}/lib/ocf/resource.d/ovn/ovndb-servers

install -p -D -m 0644 rhel/etc_logrotate.d_ovn \
$RPM_BUILD_ROOT/%{_sysconfdir}/logrotate.d/ovn

# remove OVS unpackages files
rm -f $RPM_BUILD_ROOT%{_bindir}/ovs*
rm -f $RPM_BUILD_ROOT%{_bindir}/vtep-ctl
Expand All @@ -185,18 +219,12 @@ rm -f $RPM_BUILD_ROOT%{_mandir}/man5/vtep*
rm -f $RPM_BUILD_ROOT%{_mandir}/man7/ovs*
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/ovs*
rm -f $RPM_BUILD_ROOT%{_mandir}/man8/vtep*
rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/ovs*
rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/vswitch.ovsschema
rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/vtep.ovsschema
rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovs*
rm -rf $RPM_BUILD_ROOT%{_datadir}/openvswitch/bugtool-plugins
rm -f $RPM_BUILD_ROOT%{_includedir}/openvswitch/*
rm -f $RPM_BUILD_ROOT%{_includedir}/openflow/*
rm -rf $RPM_BUILD_ROOT%{_datadir}/ovn/python
rm -f $RPM_BUILD_ROOT%{_datadir}/ovn/scripts/ovs*
rm -rf $RPM_BUILD_ROOT%{_datadir}/ovn/bugtool-plugins
rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
rm -f $RPM_BUILD_ROOT%{_libdir}/pkgconfig/*.pc
rm -f $RPM_BUILD_ROOT%{_includedir}/openvswitch/*
rm -f $RPM_BUILD_ROOT%{_includedir}/openflow/*
rm -f $RPM_BUILD_ROOT%{_includedir}/ovn/*
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash
Expand Down Expand Up @@ -389,20 +417,22 @@ fi
%{_bindir}/ovn-sbctl
%{_bindir}/ovn-trace
%{_bindir}/ovn-detrace
%{_datadir}/openvswitch/scripts/ovn-ctl
%{_datadir}/openvswitch/scripts/ovndb-servers.ocf
%{_datadir}/openvswitch/scripts/ovn-bugtool-nbctl-show
%{_datadir}/openvswitch/scripts/ovn-bugtool-sbctl-lflow-list
%{_datadir}/openvswitch/scripts/ovn-bugtool-sbctl-show
%{_datadir}/ovn/scripts/ovn-ctl
%{_datadir}/ovn/scripts/ovn-lib
%{_datadir}/ovn/scripts/ovndb-servers.ocf
%{_datadir}/ovn/scripts/ovn-bugtool-nbctl-show
%{_datadir}/ovn/scripts/ovn-bugtool-sbctl-lflow-list
%{_datadir}/ovn/scripts/ovn-bugtool-sbctl-show
%{_mandir}/man8/ovn-ctl.8*
%{_mandir}/man8/ovn-nbctl.8*
%{_mandir}/man8/ovn-trace.8*
%{_mandir}/man1/ovn-detrace.1*
%{_mandir}/man7/ovn-architecture.7*
#%{_mandir}/man7/ovn-architecture.7* - Uncomment this once the manpage is fixed
%{_mandir}/man8/ovn-sbctl.8*
%{_mandir}/man5/ovn-nb.5*
%{_mandir}/man5/ovn-sb.5*
#%{_mandir}/man5/ovn-nb.5* - Uncomment this once the manpage is fixed
#%{_mandir}/man5/ovn-sb.5* - Uncomment this once the manpage is fixed
%{_prefix}/lib/ocf/resource.d/ovn/ovndb-servers
%config(noreplace) %{_sysconfdir}/logrotate.d/ovn

%files docker
%{_bindir}/ovn-docker-overlay-driver
Expand All @@ -411,8 +441,8 @@ fi
%files central
%{_bindir}/ovn-northd
%{_mandir}/man8/ovn-northd.8*
%config %{_datadir}/openvswitch/ovn-nb.ovsschema
%config %{_datadir}/openvswitch/ovn-sb.ovsschema
%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

Expand Down
13 changes: 7 additions & 6 deletions rhel/usr_lib_systemd_system_ovn-controller-vtep.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
# /etc/systemd/system/ovn-controller-vtep.d/local.conf:
#
# [System]
# Environment="OVN_DB=unix:/usr/local/var/run/openvswitch/db.sock" "VTEP_DB=unix:/usr/local/var/run/openvswitch/vtep.sock"
# Environment="OVN_DB=unix:/usr/local/var/run/ovn/db.sock" "VTEP_DB=unix:/usr/local/var/run/ovn/vtep.sock"
#
# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-controller-vtep:
#
# OVN_DB="unix:/usr/local/var/run/openvswitch/db.sock"
# VTEP_DB="unix:/usr/local/var/run/openvswitch/vtep.sock"
# OVN_DB="unix:/usr/local/var/run/ovn/db.sock"
# VTEP_DB="unix:/usr/local/var/run/ovn/vtep.sock"

[Unit]
Description=OVN VTEP gateway controller daemon
Expand All @@ -36,12 +36,13 @@ After=openvswitch.service
Type=simple
Restart=on-failure
Environment=OVS_RUNDIR=%t/openvswitch
Environment=OVN_DB=unix:%t/openvswitch/db.sock
Environment=OVN_RUNDIR=%t/ovn
Environment=OVN_DB=unix:%t/ovn/ovnsb_db.sock
Environment=VTEP_DB=unix:%t/openvswitch/db.sock
EnvironmentFile=-/etc/sysconfig/ovn-controller-vtep
ExecStart=/usr/bin/ovn-controller-vtep -vconsole:emer -vsyslog:err -vfile:info \
--log-file=/var/log/openvswitch/ovn-controller-vtep.log \
--no-chdir --pidfile=${OVS_RUNDIR}/ovn-controller-vtep.pid \
--log-file=/var/log/ovn/ovn-controller-vtep.log \
--no-chdir --pidfile=${OVN_RUNDIR}/ovn-controller-vtep.pid \
--ovnsb-db=${OVN_DB} --vtep-db=${VTEP_DB}

[Install]
Expand Down
7 changes: 4 additions & 3 deletions rhel/usr_lib_systemd_system_ovn-controller.service
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@ After=openvswitch.service

[Service]
Type=forking
PIDFile=/var/run/openvswitch/ovn-controller.pid
PIDFile=/var/run/ovn/ovn-controller.pid
Restart=on-failure
Environment=OVN_RUNDIR=%t/ovn OVS_RUNDIR=%t/openvswitch
EnvironmentFile=-/etc/sysconfig/ovn-controller
ExecStart=/usr/share/openvswitch/scripts/ovn-ctl --no-monitor \
ExecStart=/usr/share/ovn/scripts/ovn-ctl --no-monitor \
start_controller $OVN_CONTROLLER_OPTS
ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_controller
ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_controller

[Install]
WantedBy=multi-user.target
12 changes: 5 additions & 7 deletions rhel/usr_lib_systemd_system_ovn-northd.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,23 @@
# /etc/systemd/system/ovn-northd.d/local.conf:
#
# [System]
# Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
# Environment="OVN_NORTHD_OPTS=--db-nb-sock=/usr/local/var/run/ovn/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/ovn/ovnsb_db.sock"
#
# Alternatively, you may specify environment variables in the file /etc/sysconfig/ovn-northd:
#
# OVN_NORTHD_OPTS="--db-nb-sock=/usr/local/var/run/openvswitch/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/openvswitch/ovnsb_db.sock"
# OVN_NORTHD_OPTS="--db-nb-sock=/usr/local/var/run/ovn/ovnnb_db.sock --db-sb-sock=/usr/local/var/run/ovn/ovnsb_db.sock"

[Unit]
Description=OVN northd management daemon
After=syslog.target
Requires=openvswitch.service
After=openvswitch.service

[Service]
Type=oneshot
RemainAfterExit=yes
Environment=OVS_RUNDIR=%t/openvswitch OVS_DBDIR=/var/lib/openvswitch
Environment=OVN_RUNDIR=%t/ovn OVN_DBDIR=/var/lib/ovn
EnvironmentFile=-/etc/sysconfig/ovn-northd
ExecStart=/usr/share/openvswitch/scripts/ovn-ctl start_northd $OVN_NORTHD_OPTS
ExecStop=/usr/share/openvswitch/scripts/ovn-ctl stop_northd
ExecStart=/usr/share/ovn/scripts/ovn-ctl start_northd $OVN_NORTHD_OPTS
ExecStop=/usr/share/ovn/scripts/ovn-ctl stop_northd

[Install]
WantedBy=multi-user.target
3 changes: 1 addition & 2 deletions utilities/ovn-ctl
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ $cluster_remote_port
set "$@" --remote=punix:$sock --pidfile=$db_pid_file
set "$@" --unixctl=$ctrl_sock

[ "$OVS_USER" != "" ] && set "$@" --user "$OVS_USER"
[ "$OVN_USER" != "" ] && set "$@" --user "$OVN_USER"

if test X"$detach" != Xno; then
set "$@" --detach --monitor
Expand Down Expand Up @@ -487,7 +487,6 @@ set_defaults () {
OVN_CONTROLLER_WRAPPER=

OVN_USER=
OVS_USER=

OVN_CONTROLLER_LOG="-vconsole:emer -vsyslog:err -vfile:info"
OVN_NORTHD_LOG="-vconsole:emer -vsyslog:err -vfile:info"
Expand Down

0 comments on commit 70f42bd

Please sign in to comment.