1 # Spec file for Open Virtual Network (OVN).
3 # Copyright (C) 2018 Red Hat, Inc.
5 # Copying and distribution of this file, with or without modification,
6 # are permitted in any medium without royalty provided the copyright
7 # notice and this notice are preserved. This file is offered as-is,
8 # without warranty of any kind.
10 # If tests have to be skipped while building, specify the '--without check'
11 # option. For example:
12 # rpmbuild -bb --without check rhel/ovn-fedora.spec
15 # If libcap-ng isn't available and there is no need for running OVS
16 # as regular user, specify the '--without libcapng'
17 %bcond_without libcapng
19 # Enable Python 3 by specifying '--with build_python3'.
20 # This is enabled by default for versions of the distribution that
21 # have Python 3 by default (Fedora > 22).
22 %bcond_with build_python3
24 # Enable PIE, bz#955181
25 %global _hardened_build
1
27 # some distros (e.g: RHEL-7) don't define _rundir macro yet
28 # Fedora 15 onwards uses /run as _rundir
33 # define the python package prefix based on distribution version so that we can
34 # simultaneously support RHEL-based and later Fedora versions in this spec file.
39 %if 0%{?rhel} || 0%{?fedora} < 25
44 Summary: Open Virtual Network support
45 Group: System Environment
/Daemons
46 URL: http
://www.openvswitch.org
/
48 Obsoletes
: openvswitch
-ovn
-common
< %{?epoch:%{epoch}:}%{version}-%{release}
49 Provides: openvswitch
-ovn
-common
= %{?epoch:%{epoch}:}%{version}-%{release}
51 # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the
52 # lib/sflow*.[ch] files are SISSL
53 License: ASL
2.0 and LGPLv2
+ and SISSL
55 Source: http
://openvswitch.org
/releases
/openvswitch
-%{version}.tar.gz
57 BuildRequires
: gcc gcc
-c
++
58 BuildRequires
: autoconf automake libtool
59 BuildRequires
: systemd
-units openssl openssl
-devel
60 BuildRequires
: %{_py2}-devel
61 %if 0%{?fedora} > 22 || %{with build_python3}
62 BuildRequires
: python3
-devel
64 BuildRequires
: desktop
-file
-utils
65 BuildRequires
: groff graphviz
66 BuildRequires
: checkpolicy
, selinux
-policy
-devel
67 BuildRequires
: /usr
/bin
/sphinx
-build
68 # make check dependencies
69 BuildRequires
: %{_py2}-twisted%{?rhel:-core} %{_py2}-zope-interface %{_py2}-six
70 BuildRequires
: procps
-ng
72 BuildRequires
: libcap
-ng libcap
-ng
-devel
74 BuildRequires
: unbound unbound
-devel
76 Requires: openssl hostname iproute module
-init
-tools openvswitch
78 Requires(post
): systemd
-units
79 Requires(preun
): systemd
-units
80 Requires(postun
): systemd
-units
82 # to skip running checks, pass --without check
86 OVN
, the Open Virtual Network
, is a system to support virtual network
87 abstraction. OVN complements the existing capabilities of OVS to add
88 native support
for virtual network abstractions
, such as virtual L2 and L3
89 overlays and security groups.
92 Summary: Open Virtual Network support
95 Requires: firewalld
-filesystem
96 Obsoletes
: openvswitch
-ovn
-central
97 Provides: openvswitch
-ovn
-central
= %{?epoch:%{epoch}:}%{version}-%{release}
100 OVN DB servers and ovn
-northd running on a central node.
103 Summary: Open Virtual Network support
106 Requires: firewalld
-filesystem
107 Obsoletes
: openvswitch
-ovn
-host
108 Provides: openvswitch
-ovn
-host
= %{?epoch:%{epoch}:}%{version}-%{release}
111 OVN controller running on each host.
114 Summary: Open Virtual Network support
117 Obsoletes
: openvswitch
-ovn
-vtep
118 Provides: openvswitch
-ovn
-vtep
= %{?epoch:%{epoch}:}%{version}-%{release}
124 Summary: Open Virtual Network support
126 Requires: ovn
%{_py2}-openvswitch
127 Obsoletes
: openvswitch
-ovn
-docker
128 Provides: openvswitch
-ovn
-docker
= %{?epoch:%{epoch}:}%{version}-%{release}
131 Docker network plugins
for OVN.
134 %setup -n openvswitch
-%{version}
144 --with
-pkidir
=%{_sharedstatedir}/openvswitch
/pki \
145 %if 0%{?fedora} > 22 || %{with build_python3}
146 PYTHON3
=%{__python3} \
155 rm -rf $RPM_BUILD_ROOT
156 make install DESTDIR
=$RPM_BUILD_ROOT
158 for service
in ovn
-controller ovn
-controller
-vtep ovn
-northd
; do
159 install -p
-D
-m
0644 \
160 rhel
/usr_lib_systemd_system_$
{service
}.service \
161 $RPM_BUILD_ROOT
%{_unitdir}/${service}.service
164 rm -rf $RPM_BUILD_ROOT
/%{_datadir}/openvswitch
/python
/
166 install -d
-m
0755 $RPM_BUILD_ROOT
/%{_sharedstatedir}/openvswitch
168 install -d $RPM_BUILD_ROOT
%{_prefix}/lib
/firewalld
/services
/
169 install -p
-m
0644 rhel
/usr_lib_firewalld_services_ovn
-central
-firewall
-service.xml \
170 $RPM_BUILD_ROOT
%{_prefix}/lib
/firewalld
/services
/ovn
-central
-firewall
-service.xml
171 install -p
-m
0644 rhel
/usr_lib_firewalld_services_ovn
-host
-firewall
-service.xml \
172 $RPM_BUILD_ROOT
%{_prefix}/lib
/firewalld
/services
/ovn
-host
-firewall
-service.xml
174 install -d
-m
0755 $RPM_BUILD_ROOT
%{_prefix}/lib
/ocf
/resource.d
/ovn
175 ln
-s
%{_datadir}/openvswitch
/scripts
/ovndb
-servers.ocf \
176 $RPM_BUILD_ROOT
%{_prefix}/lib
/ocf
/resource.d
/ovn
/ovndb
-servers
178 # remove OVS unpackages files
179 rm -f $RPM_BUILD_ROOT
%{_bindir}/ovs
*
180 rm -f $RPM_BUILD_ROOT
%{_bindir}/vtep
-ctl
181 rm -f $RPM_BUILD_ROOT
%{_sbindir}/ovs
*
182 rm -f $RPM_BUILD_ROOT
%{_mandir}/man1
/ovs
*
183 rm -f $RPM_BUILD_ROOT
%{_mandir}/man5
/ovs
*
184 rm -f $RPM_BUILD_ROOT
%{_mandir}/man5
/vtep
*
185 rm -f $RPM_BUILD_ROOT
%{_mandir}/man7
/ovs
*
186 rm -f $RPM_BUILD_ROOT
%{_mandir}/man8
/ovs
*
187 rm -f $RPM_BUILD_ROOT
%{_mandir}/man8
/vtep
*
188 rm -f $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/ovs
*
189 rm -f $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/vswitch.ovsschema
190 rm -f $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/vtep.ovsschema
191 rm -f $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/scripts
/ovs
*
192 rm -rf $RPM_BUILD_ROOT
%{_datadir}/openvswitch
/bugtool
-plugins
193 rm -f $RPM_BUILD_ROOT
%{_includedir}/openvswitch
/*
194 rm -f $RPM_BUILD_ROOT
%{_includedir}/openflow
/*
195 rm -f $RPM_BUILD_ROOT
%{_libdir}/*.a
196 rm -f $RPM_BUILD_ROOT
%{_libdir}/*.la
197 rm -f $RPM_BUILD_ROOT
%{_libdir}/pkgconfig
/*.pc
198 rm -f $RPM_BUILD_ROOT
%{_includedir}/openvswitch
/*
199 rm -f $RPM_BUILD_ROOT
%{_includedir}/openflow
/*
200 rm -f $RPM_BUILD_ROOT
%{_includedir}/ovn
/*
201 rm -f $RPM_BUILD_ROOT
%{_sysconfdir}/bash_completion.d
/ovs
-appctl
-bashcomp.bash
202 rm -f $RPM_BUILD_ROOT
%{_sysconfdir}/bash_completion.d
/ovs
-vsctl
-bashcomp.bash
203 rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/logrotate.d
/openvswitch
208 export OVS_RESOLV_CONF
=$
(pwd)/resolv.conf
209 if make check TESTSUITEFLAGS
='
%{_smp_mflags}' RECHECK
=yes
; then :;
211 cat tests
/testsuite.log
217 rm -rf $RPM_BUILD_ROOT
220 if [ $
1 -eq
1 ] ; then
222 /bin
/systemctl status ovn
-northd.service
>/dev
/null
224 rpm
-ql openvswitch
-ovn
-central
> /dev
/null
225 if [[ "$?"
= "
0"
&& "$ovn_status"
= "
0"
]]; then
226 # ovn-northd service is running which means old openvswitch-ovn-central
227 # is already installed and it will be cleaned up. So start ovn-northd
228 # service when posttrans central is called.
229 touch
%{_localstatedir}/lib
/rpm
-state
/ovn
-northd
234 if [ $
1 -eq
1 ] ; then
236 /bin
/systemctl status ovn
-controller.service
>/dev
/null
238 rpm
-ql openvswitch
-ovn
-host
> /dev
/null
239 if [[ "$?"
= "
0"
&& "$ovn_status"
= "
0"
]]; then
240 # ovn-controller service is running which means old
241 # openvswitch-ovn-host is installed and it will be cleaned up. So
242 # start ovn-controller service when posttrans host is called.
243 touch
%{_localstatedir}/lib
/rpm
-state
/ovn
-controller
248 if [ $
1 -eq
1 ] ; then
250 /bin
/systemctl status ovn
-controller
-vtep.service
>/dev
/null
252 rpm
-ql openvswitch
-ovn
-vtep
> /dev
/null
253 if [[ "$?"
= "
0"
&& "$ovn_status"
= "
0"
]]; then
254 # ovn-controller-vtep service is running which means old
255 # openvswitch-ovn-vtep is installed and it will be cleaned up. So
256 # start ovn-controller-vtep service when posttrans host is called.
257 touch
%{_localstatedir}/lib
/rpm
-state
/ovn
-controller
-vtep
262 %if 0%{?systemd_preun:1}
263 %systemd_preun ovn
-northd.service
265 if [ $
1 -eq
0 ] ; then
266 # Package removal, not upgrade
267 /bin
/systemctl
--no
-reload disable ovn
-northd.service
>/dev
/null
2>&1 ||
:
268 /bin
/systemctl stop ovn
-northd.service
>/dev
/null
2>&1 ||
:
273 %if 0%{?systemd_preun:1}
274 %systemd_preun ovn
-controller.service
276 if [ $
1 -eq
0 ] ; then
277 # Package removal, not upgrade
278 /bin
/systemctl
--no
-reload disable ovn
-controller.service
>/dev
/null
2>&1 ||
:
279 /bin
/systemctl stop ovn
-controller.service
>/dev
/null
2>&1 ||
:
284 %if 0%{?systemd_preun:1}
285 %systemd_preun ovn
-controller
-vtep.service
287 if [ $
1 -eq
0 ] ; then
288 # Package removal, not upgrade
289 /bin
/systemctl
--no
-reload disable ovn
-controller
-vtep.service
>/dev
/null
2>&1 ||
:
290 /bin
/systemctl stop ovn
-controller
-vtep.service
>/dev
/null
2>&1 ||
:
295 %if 0%{?systemd_post:1}
296 %systemd_post ovn
-northd.service
298 # Package install, not upgrade
299 if [ $
1 -eq
1 ]; then
300 /bin
/systemctl daemon
-reload
>dev
/null ||
:
305 %if 0%{?systemd_post:1}
306 %systemd_post ovn
-controller.service
308 # Package install, not upgrade
309 if [ $
1 -eq
1 ]; then
310 /bin
/systemctl daemon
-reload
>dev
/null ||
:
315 %if 0%{?systemd_post:1}
316 %systemd_post ovn
-controller
-vtep.service
318 # Package install, not upgrade
319 if [ $
1 -eq
1 ]; then
320 /bin
/systemctl daemon
-reload
>dev
/null ||
:
327 %if 0%{?systemd_postun_with_restart:1}
328 %systemd_postun_with_restart ovn
-northd.service
330 /bin
/systemctl daemon
-reload
>/dev
/null
2>&1 ||
:
331 if [ "$
1"
-ge "
1"
] ; then
332 # Package upgrade, not uninstall
333 /bin
/systemctl try
-restart ovn
-northd.service
>/dev
/null
2>&1 ||
:
338 %if 0%{?systemd_postun_with_restart:1}
339 %systemd_postun_with_restart ovn
-controller.service
341 /bin
/systemctl daemon
-reload
>/dev
/null
2>&1 ||
:
342 if [ "$
1"
-ge "
1"
] ; then
343 # Package upgrade, not uninstall
344 /bin
/systemctl try
-restart ovn
-controller.service
>/dev
/null
2>&1 ||
:
349 %if 0%{?systemd_postun_with_restart:1}
350 %systemd_postun_with_restart ovn
-controller
-vtep.service
352 /bin
/systemctl daemon
-reload
>/dev
/null
2>&1 ||
:
353 if [ "$
1"
-ge "
1"
] ; then
354 # Package upgrade, not uninstall
355 /bin
/systemctl try
-restart ovn
-controller
-vtep.service
>/dev
/null
2>&1 ||
:
360 if [ $
1 -eq
1 ]; then
361 # Package install, not upgrade
362 if [ -e
%{_localstatedir}/lib
/rpm
-state
/ovn
-northd
]; then
363 rm %{_localstatedir}/lib
/rpm
-state
/ovn
-northd
364 /bin
/systemctl start ovn
-northd.service
>/dev
/null
2>&1 ||
:
370 if [ $
1 -eq
1 ]; then
371 # Package install, not upgrade
372 if [ -e
%{_localstatedir}/lib
/rpm
-state
/ovn
-controller
]; then
373 rm %{_localstatedir}/lib
/rpm
-state
/ovn
-controller
374 /bin
/systemctl start ovn
-controller.service
>/dev
/null
2>&1 ||
:
379 if [ $
1 -eq
1 ]; then
380 # Package install, not upgrade
381 if [ -e
%{_localstatedir}/lib
/rpm
-state
/ovn
-controller
-vtep
]; then
382 rm %{_localstatedir}/lib
/rpm
-state
/ovn
-controller
-vtep
383 /bin
/systemctl start ovn
-controller
-vtep.service
>/dev
/null
2>&1 ||
:
391 %{_bindir}/ovn
-detrace
392 %{_datadir}/openvswitch
/scripts
/ovn
-ctl
393 %{_datadir}/openvswitch
/scripts
/ovndb
-servers.ocf
394 %{_datadir}/openvswitch
/scripts
/ovn
-bugtool
-nbctl
-show
395 %{_datadir}/openvswitch
/scripts
/ovn
-bugtool
-sbctl
-lflow
-list
396 %{_datadir}/openvswitch
/scripts
/ovn
-bugtool
-sbctl
-show
397 %{_mandir}/man8
/ovn
-ctl
.8*
398 %{_mandir}/man8
/ovn
-nbctl
.8*
399 %{_mandir}/man8
/ovn
-trace
.8*
400 %{_mandir}/man1
/ovn
-detrace
.1*
401 %{_mandir}/man7
/ovn
-architecture
.7*
402 %{_mandir}/man8
/ovn
-sbctl
.8*
403 %{_mandir}/man5
/ovn
-nb
.5*
404 %{_mandir}/man5
/ovn
-sb
.5*
405 %{_prefix}/lib
/ocf
/resource.d
/ovn
/ovndb
-servers
408 %{_bindir}/ovn
-docker
-overlay
-driver
409 %{_bindir}/ovn
-docker
-underlay
-driver
412 %{_bindir}/ovn
-northd
413 %{_mandir}/man8
/ovn
-northd
.8*
414 %config %{_datadir}/openvswitch
/ovn
-nb.ovsschema
415 %config %{_datadir}/openvswitch
/ovn
-sb.ovsschema
416 %{_unitdir}/ovn
-northd.service
417 %{_prefix}/lib
/firewalld
/services
/ovn
-central
-firewall
-service.xml
420 %{_bindir}/ovn
-controller
421 %{_mandir}/man8
/ovn
-controller
.8*
422 %{_unitdir}/ovn
-controller.service
423 %{_prefix}/lib
/firewalld
/services
/ovn
-host
-firewall
-service.xml
426 %{_bindir}/ovn
-controller
-vtep
427 %{_mandir}/man8
/ovn
-controller
-vtep
.8*
428 %{_unitdir}/ovn
-controller
-vtep.service
431 * Thu Dec
20 2018 Numan Siddique
<nusiddiq@redhat.com
>