diff mbox series

[ovs-dev,ovn,3/4] Fix "make rpm-fedora"

Message ID 20190813162803.16427-1-nusiddiq@redhat.com
State Superseded
Headers show
Series External OVS source support and separate run dir for OVN | expand

Commit Message

Numan Siddique Aug. 13, 2019, 4:28 p.m. UTC
From: Numan Siddique <nusiddiq@redhat.com>

"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.

Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
---
 Documentation/intro/install/fedora.rst        | 13 +++-
 rhel/automake.mk                              |  2 +
 rhel/etc_logrotate.d_ovn                      | 22 ++++++
 rhel/ovn-fedora.spec.in                       | 78 +++++++++++++------
 ...systemd_system_ovn-controller-vtep.service | 13 ++--
 ..._lib_systemd_system_ovn-controller.service |  7 +-
 .../usr_lib_systemd_system_ovn-northd.service | 12 ++-
 utilities/ovn-ctl                             |  3 +-
 8 files changed, 105 insertions(+), 45 deletions(-)
 create mode 100644 rhel/etc_logrotate.d_ovn

Comments

0-day Robot Aug. 13, 2019, 5:32 p.m. UTC | #1
Bleep bloop.  Greetings Numan Siddique, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 108 characters long (recommended limit is 79)
#270 FILE: rhel/usr_lib_systemd_system_ovn-controller-vtep.service:22:
#   Environment="OVN_DB=unix:/usr/local/var/run/ovn/db.sock" "VTEP_DB=unix:/usr/local/var/run/ovn/vtep.sock"

WARNING: Line is 133 characters long (recommended limit is 79)
#328 FILE: rhel/usr_lib_systemd_system_ovn-northd.service:10:
#   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"

WARNING: Line is 121 characters long (recommended limit is 79)
#333 FILE: rhel/usr_lib_systemd_system_ovn-northd.service:14:
#   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"

Lines checked: 377, Warnings: 3, Errors: 0


Please check this out.  If you feel there has been an error, please email aconole@redhat.com

Thanks,
0-day Robot
Mark Michelson Aug. 16, 2019, 5:14 p.m. UTC | #2
On 8/13/19 12:28 PM, nusiddiq@redhat.com wrote:
> From: Numan Siddique <nusiddiq@redhat.com>
> 
> "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.
> 
> Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
> ---
>   Documentation/intro/install/fedora.rst        | 13 +++-
>   rhel/automake.mk                              |  2 +
>   rhel/etc_logrotate.d_ovn                      | 22 ++++++
>   rhel/ovn-fedora.spec.in                       | 78 +++++++++++++------
>   ...systemd_system_ovn-controller-vtep.service | 13 ++--
>   ..._lib_systemd_system_ovn-controller.service |  7 +-
>   .../usr_lib_systemd_system_ovn-northd.service | 12 ++-
>   utilities/ovn-ctl                             |  3 +-
>   8 files changed, 105 insertions(+), 45 deletions(-)
>   create mode 100644 rhel/etc_logrotate.d_ovn
> 
> diff --git a/Documentation/intro/install/fedora.rst b/Documentation/intro/install/fedora.rst
> index c8ea6ec01..4cf9fbdb6 100644
> --- a/Documentation/intro/install/fedora.rst
> +++ b/Documentation/intro/install/fedora.rst
> @@ -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 tar bar in

tar bar?

> +your openvwitch source directory by running
> +
> +::
> +
> +    $make dist
> +
> +And then execute the following in the OVN source directory
> +(in which `./configure` was executed):
>   
>   ::
>   
> @@ -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.
>   
>   ::
> diff --git a/rhel/automake.mk b/rhel/automake.mk
> index be7c275a7..39e216b01 100644
> --- a/rhel/automake.mk
> +++ b/rhel/automake.mk
> @@ -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 \
> @@ -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
> diff --git a/rhel/etc_logrotate.d_ovn b/rhel/etc_logrotate.d_ovn
> new file mode 100644
> index 000000000..a351ec303
> --- /dev/null
> +++ b/rhel/etc_logrotate.d_ovn
> @@ -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
> +}
> diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
> index 2234e949f..cbca87511 100644
> --- a/rhel/ovn-fedora.spec.in
> +++ b/rhel/ovn-fedora.spec.in
> @@ -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
> @@ -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
> @@ -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
> @@ -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 \
> @@ -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
> @@ -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
> @@ -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
> @@ -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
>   
> diff --git a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> index 4ca684ac0..832849488 100644
> --- a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> +++ b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> @@ -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
> @@ -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]
> diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service b/rhel/usr_lib_systemd_system_ovn-controller.service
> index cf65988fe..6c8f33a27 100644
> --- a/rhel/usr_lib_systemd_system_ovn-controller.service
> +++ b/rhel/usr_lib_systemd_system_ovn-controller.service
> @@ -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
> diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service b/rhel/usr_lib_systemd_system_ovn-northd.service
> index 3c44600a0..82c23cee4 100644
> --- a/rhel/usr_lib_systemd_system_ovn-northd.service
> +++ b/rhel/usr_lib_systemd_system_ovn-northd.service
> @@ -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
> diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> index a973b09a2..39e03b189 100755
> --- a/utilities/ovn-ctl
> +++ b/utilities/ovn-ctl
> @@ -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
> @@ -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"
>
Numan Siddique Aug. 19, 2019, 5:23 p.m. UTC | #3
On Fri, Aug 16, 2019 at 10:46 PM Mark Michelson <mmichels@redhat.com> wrote:

> On 8/13/19 12:28 PM, nusiddiq@redhat.com wrote:
> > From: Numan Siddique <nusiddiq@redhat.com>
> >
> > "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.
> >
> > Signed-off-by: Numan Siddique <nusiddiq@redhat.com>
> > ---
> >   Documentation/intro/install/fedora.rst        | 13 +++-
> >   rhel/automake.mk                              |  2 +
> >   rhel/etc_logrotate.d_ovn                      | 22 ++++++
> >   rhel/ovn-fedora.spec.in                       | 78 +++++++++++++------
> >   ...systemd_system_ovn-controller-vtep.service | 13 ++--
> >   ..._lib_systemd_system_ovn-controller.service |  7 +-
> >   .../usr_lib_systemd_system_ovn-northd.service | 12 ++-
> >   utilities/ovn-ctl                             |  3 +-
> >   8 files changed, 105 insertions(+), 45 deletions(-)
> >   create mode 100644 rhel/etc_logrotate.d_ovn
> >
> > diff --git a/Documentation/intro/install/fedora.rst
> b/Documentation/intro/install/fedora.rst
> > index c8ea6ec01..4cf9fbdb6 100644
> > --- a/Documentation/intro/install/fedora.rst
> > +++ b/Documentation/intro/install/fedora.rst
> > @@ -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 tar bar in
>
> tar bar?
>

Oops. I meant tarball. I will correct in v2.

Thanks
Numan



>
> > +your openvwitch source directory by running
> > +
> > +::
> > +
> > +    $make dist
> > +
> > +And then execute the following in the OVN source directory
> > +(in which `./configure` was executed):
> >
> >   ::
> >
> > @@ -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.
> >
> >   ::
> > diff --git a/rhel/automake.mk b/rhel/automake.mk
> > index be7c275a7..39e216b01 100644
> > --- a/rhel/automake.mk
> > +++ b/rhel/automake.mk
> > @@ -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 \
> > @@ -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
> > diff --git a/rhel/etc_logrotate.d_ovn b/rhel/etc_logrotate.d_ovn
> > new file mode 100644
> > index 000000000..a351ec303
> > --- /dev/null
> > +++ b/rhel/etc_logrotate.d_ovn
> > @@ -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
> > +}
> > diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
> > index 2234e949f..cbca87511 100644
> > --- a/rhel/ovn-fedora.spec.in
> > +++ b/rhel/ovn-fedora.spec.in
> > @@ -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
> > @@ -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
> > @@ -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
> > @@ -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 \
> > @@ -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
> > @@ -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
> > @@ -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
> > @@ -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
> >
> > diff --git a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> > index 4ca684ac0..832849488 100644
> > --- a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> > +++ b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
> > @@ -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
> > @@ -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]
> > diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service
> b/rhel/usr_lib_systemd_system_ovn-controller.service
> > index cf65988fe..6c8f33a27 100644
> > --- a/rhel/usr_lib_systemd_system_ovn-controller.service
> > +++ b/rhel/usr_lib_systemd_system_ovn-controller.service
> > @@ -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
> > diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service
> b/rhel/usr_lib_systemd_system_ovn-northd.service
> > index 3c44600a0..82c23cee4 100644
> > --- a/rhel/usr_lib_systemd_system_ovn-northd.service
> > +++ b/rhel/usr_lib_systemd_system_ovn-northd.service
> > @@ -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
> > diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
> > index a973b09a2..39e03b189 100755
> > --- a/utilities/ovn-ctl
> > +++ b/utilities/ovn-ctl
> > @@ -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
> > @@ -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"
> >
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
diff mbox series

Patch

diff --git a/Documentation/intro/install/fedora.rst b/Documentation/intro/install/fedora.rst
index c8ea6ec01..4cf9fbdb6 100644
--- a/Documentation/intro/install/fedora.rst
+++ b/Documentation/intro/install/fedora.rst
@@ -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 tar bar in
+your openvwitch source directory by running
+
+::
+
+    $make dist
+
+And then execute the following in the OVN source directory
+(in which `./configure` was executed):
 
 ::
 
@@ -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.
 
 ::
diff --git a/rhel/automake.mk b/rhel/automake.mk
index be7c275a7..39e216b01 100644
--- a/rhel/automake.mk
+++ b/rhel/automake.mk
@@ -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 \
@@ -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
diff --git a/rhel/etc_logrotate.d_ovn b/rhel/etc_logrotate.d_ovn
new file mode 100644
index 000000000..a351ec303
--- /dev/null
+++ b/rhel/etc_logrotate.d_ovn
@@ -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
+}
diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in
index 2234e949f..cbca87511 100644
--- a/rhel/ovn-fedora.spec.in
+++ b/rhel/ovn-fedora.spec.in
@@ -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
@@ -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
@@ -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
@@ -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 \
@@ -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
@@ -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
@@ -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
@@ -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
 
diff --git a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
index 4ca684ac0..832849488 100644
--- a/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
+++ b/rhel/usr_lib_systemd_system_ovn-controller-vtep.service
@@ -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
@@ -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]
diff --git a/rhel/usr_lib_systemd_system_ovn-controller.service b/rhel/usr_lib_systemd_system_ovn-controller.service
index cf65988fe..6c8f33a27 100644
--- a/rhel/usr_lib_systemd_system_ovn-controller.service
+++ b/rhel/usr_lib_systemd_system_ovn-controller.service
@@ -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
diff --git a/rhel/usr_lib_systemd_system_ovn-northd.service b/rhel/usr_lib_systemd_system_ovn-northd.service
index 3c44600a0..82c23cee4 100644
--- a/rhel/usr_lib_systemd_system_ovn-northd.service
+++ b/rhel/usr_lib_systemd_system_ovn-northd.service
@@ -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
diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl
index a973b09a2..39e03b189 100755
--- a/utilities/ovn-ctl
+++ b/utilities/ovn-ctl
@@ -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
@@ -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"