]> git.proxmox.com Git - mirror_ovs.git/blame - rhel/ovn-fedora.spec.in
ovn-controller-vtep: Fix wrong value for ovnsb-db argument
[mirror_ovs.git] / rhel / ovn-fedora.spec.in
CommitLineData
78203a9c
NS
1# Spec file for Open Virtual Network (OVN).
2
3# Copyright (C) 2018 Red Hat, Inc.
4#
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.
9#
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
13#
14
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
18
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
23
24# Enable PIE, bz#955181
25%global _hardened_build 1
26
27# some distros (e.g: RHEL-7) don't define _rundir macro yet
28# Fedora 15 onwards uses /run as _rundir
29%if 0%{!?_rundir:1}
30%define _rundir /run
31%endif
32
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.
35%if 0%{?fedora} >= 25
36%define _py2 python2
37%endif
38
39%if 0%{?rhel} || 0%{?fedora} < 25
40%define _py2 python
41%endif
42
43Name: ovn
44Summary: Open Virtual Network support
45Group: System Environment/Daemons
46URL: http://www.openvswitch.org/
47Version: @VERSION@
a53a7e03
NS
48Obsoletes: openvswitch-ovn-common < %{?epoch:%{epoch}:}%{version}-%{release}
49Provides: openvswitch-ovn-common = %{?epoch:%{epoch}:}%{version}-%{release}
78203a9c
NS
50
51# Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the
52# lib/sflow*.[ch] files are SISSL
53License: ASL 2.0 and LGPLv2+ and SISSL
54Release: 1%{?dist}
55Source: http://openvswitch.org/releases/openvswitch-%{version}.tar.gz
56
57BuildRequires: gcc gcc-c++
58BuildRequires: autoconf automake libtool
59BuildRequires: systemd-units openssl openssl-devel
60BuildRequires: %{_py2}-devel
61%if 0%{?fedora} > 22 || %{with build_python3}
62BuildRequires: python3-devel
63%endif
64BuildRequires: desktop-file-utils
65BuildRequires: groff graphviz
66BuildRequires: checkpolicy, selinux-policy-devel
b16b5caf 67BuildRequires: /usr/bin/sphinx-build
78203a9c
NS
68# make check dependencies
69BuildRequires: %{_py2}-twisted%{?rhel:-core} %{_py2}-zope-interface %{_py2}-six
70BuildRequires: procps-ng
71%if %{with libcapng}
72BuildRequires: libcap-ng libcap-ng-devel
73%endif
74BuildRequires: unbound unbound-devel
75
76Requires: openssl hostname iproute module-init-tools openvswitch
77
78Requires(post): systemd-units
79Requires(preun): systemd-units
80Requires(postun): systemd-units
81
82# to skip running checks, pass --without check
83%bcond_without check
84
85%description
86OVN, the Open Virtual Network, is a system to support virtual network
87abstraction. OVN complements the existing capabilities of OVS to add
88native support for virtual network abstractions, such as virtual L2 and L3
89overlays and security groups.
90
91%package central
92Summary: Open Virtual Network support
93License: ASL 2.0
a53a7e03 94Requires: ovn
78203a9c
NS
95Requires: firewalld-filesystem
96Obsoletes: openvswitch-ovn-central
97Provides: openvswitch-ovn-central = %{?epoch:%{epoch}:}%{version}-%{release}
98
99%description central
100OVN DB servers and ovn-northd running on a central node.
101
102%package host
103Summary: Open Virtual Network support
104License: ASL 2.0
a53a7e03 105Requires: ovn
78203a9c
NS
106Requires: firewalld-filesystem
107Obsoletes: openvswitch-ovn-host
108Provides: openvswitch-ovn-host = %{?epoch:%{epoch}:}%{version}-%{release}
109
110%description host
111OVN controller running on each host.
112
113%package vtep
114Summary: Open Virtual Network support
115License: ASL 2.0
a53a7e03 116Requires: ovn
78203a9c
NS
117Obsoletes: openvswitch-ovn-vtep
118Provides: openvswitch-ovn-vtep = %{?epoch:%{epoch}:}%{version}-%{release}
119
120%description vtep
121OVN vtep controller
122
78203a9c
NS
123%package docker
124Summary: Open Virtual Network support
125License: ASL 2.0
a53a7e03 126Requires: ovn %{_py2}-openvswitch
78203a9c
NS
127Obsoletes: openvswitch-ovn-docker
128Provides: openvswitch-ovn-docker = %{?epoch:%{epoch}:}%{version}-%{release}
129
130%description docker
131Docker network plugins for OVN.
132
133%prep
134%setup -n openvswitch-%{version}
135
136%build
137%configure \
138%if %{with libcapng}
139 --enable-libcapng \
140%else
141 --disable-libcapng \
142%endif
143 --enable-ssl \
144 --with-pkidir=%{_sharedstatedir}/openvswitch/pki \
145%if 0%{?fedora} > 22 || %{with build_python3}
146 PYTHON3=%{__python3} \
147 PYTHON=%{__python2}
148%else
149 PYTHON=%{__python}
150%endif
151
152make %{?_smp_mflags}
153
154%install
155rm -rf $RPM_BUILD_ROOT
156make install DESTDIR=$RPM_BUILD_ROOT
157
158for 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
162done
163
164rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/
165
166install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch
167
168install -d $RPM_BUILD_ROOT%{_prefix}/lib/firewalld/services/
169install -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
171install -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
173
174install -d -m 0755 $RPM_BUILD_ROOT%{_prefix}/lib/ocf/resource.d/ovn
175ln -s %{_datadir}/openvswitch/scripts/ovndb-servers.ocf \
176 $RPM_BUILD_ROOT%{_prefix}/lib/ocf/resource.d/ovn/ovndb-servers
177
178# remove OVS unpackages files
179rm -f $RPM_BUILD_ROOT%{_bindir}/ovs*
180rm -f $RPM_BUILD_ROOT%{_bindir}/vtep-ctl
181rm -f $RPM_BUILD_ROOT%{_sbindir}/ovs*
182rm -f $RPM_BUILD_ROOT%{_mandir}/man1/ovs*
183rm -f $RPM_BUILD_ROOT%{_mandir}/man5/ovs*
184rm -f $RPM_BUILD_ROOT%{_mandir}/man5/vtep*
185rm -f $RPM_BUILD_ROOT%{_mandir}/man7/ovs*
186rm -f $RPM_BUILD_ROOT%{_mandir}/man8/ovs*
187rm -f $RPM_BUILD_ROOT%{_mandir}/man8/vtep*
188rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/ovs*
189rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/vswitch.ovsschema
190rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/vtep.ovsschema
191rm -f $RPM_BUILD_ROOT%{_datadir}/openvswitch/scripts/ovs*
192rm -rf $RPM_BUILD_ROOT%{_datadir}/openvswitch/bugtool-plugins
193rm -f $RPM_BUILD_ROOT%{_includedir}/openvswitch/*
194rm -f $RPM_BUILD_ROOT%{_includedir}/openflow/*
195rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
196rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
197rm -f $RPM_BUILD_ROOT%{_libdir}/pkgconfig/*.pc
198rm -f $RPM_BUILD_ROOT%{_includedir}/openvswitch/*
199rm -f $RPM_BUILD_ROOT%{_includedir}/openflow/*
200rm -f $RPM_BUILD_ROOT%{_includedir}/ovn/*
201rm -f $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/ovs-appctl-bashcomp.bash
202rm -f $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/ovs-vsctl-bashcomp.bash
203rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/openvswitch
204
205%check
206%if %{with check}
0bdc0bf7
TR
207 touch resolv.conf
208 export OVS_RESOLV_CONF=$(pwd)/resolv.conf
78203a9c
NS
209 if make check TESTSUITEFLAGS='%{_smp_mflags}' RECHECK=yes; then :;
210 else
211 cat tests/testsuite.log
212 exit 1
213 fi
214%endif
215
216%clean
217rm -rf $RPM_BUILD_ROOT
218
219%pre central
220if [ $1 -eq 1 ] ; then
221 # Package install.
222 /bin/systemctl status ovn-northd.service >/dev/null
223 ovn_status=$?
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
230 fi
231fi
232
233%pre host
234if [ $1 -eq 1 ] ; then
235 # Package install.
236 /bin/systemctl status ovn-controller.service >/dev/null
237 ovn_status=$?
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
244 fi
245fi
246
247%pre vtep
248if [ $1 -eq 1 ] ; then
249 # Package install.
250 /bin/systemctl status ovn-controller-vtep.service >/dev/null
251 ovn_status=$?
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
258 fi
259fi
260
261%preun central
262%if 0%{?systemd_preun:1}
263 %systemd_preun ovn-northd.service
264%else
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 || :
269 fi
270%endif
271
272%preun host
273%if 0%{?systemd_preun:1}
274 %systemd_preun ovn-controller.service
275%else
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 || :
280 fi
281%endif
282
283%preun vtep
284%if 0%{?systemd_preun:1}
285 %systemd_preun ovn-controller-vtep.service
286%else
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 || :
291 fi
292%endif
293
294%post central
295%if 0%{?systemd_post:1}
296 %systemd_post ovn-northd.service
297%else
298 # Package install, not upgrade
299 if [ $1 -eq 1 ]; then
300 /bin/systemctl daemon-reload >dev/null || :
301 fi
302%endif
303
304%post host
305%if 0%{?systemd_post:1}
306 %systemd_post ovn-controller.service
307%else
308 # Package install, not upgrade
309 if [ $1 -eq 1 ]; then
310 /bin/systemctl daemon-reload >dev/null || :
311 fi
312%endif
313
314%post vtep
315%if 0%{?systemd_post:1}
316 %systemd_post ovn-controller-vtep.service
317%else
318 # Package install, not upgrade
319 if [ $1 -eq 1 ]; then
320 /bin/systemctl daemon-reload >dev/null || :
321 fi
322%endif
323
324%postun
325
326%postun central
327%if 0%{?systemd_postun_with_restart:1}
328 %systemd_postun_with_restart ovn-northd.service
329%else
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 || :
334 fi
335%endif
336
337%postun host
338%if 0%{?systemd_postun_with_restart:1}
339 %systemd_postun_with_restart ovn-controller.service
340%else
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 || :
345 fi
346%endif
347
348%postun vtep
349%if 0%{?systemd_postun_with_restart:1}
350 %systemd_postun_with_restart ovn-controller-vtep.service
351%else
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 || :
356 fi
357%endif
358
359%posttrans central
360if [ $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 || :
365 fi
366fi
367
368
369%posttrans host
370if [ $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 || :
375 fi
376fi
377
378%posttrans vtep
379if [ $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 || :
384 fi
385fi
386
387%files
78203a9c
NS
388%{_bindir}/ovn-nbctl
389%{_bindir}/ovn-sbctl
390%{_bindir}/ovn-trace
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
406
a53a7e03
NS
407%files docker
408%{_bindir}/ovn-docker-overlay-driver
409%{_bindir}/ovn-docker-underlay-driver
410
78203a9c
NS
411%files central
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
418
419%files host
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
424
425%files vtep
426%{_bindir}/ovn-controller-vtep
427%{_mandir}/man8/ovn-controller-vtep.8*
428%{_unitdir}/ovn-controller-vtep.service
429
430%changelog
431* Thu Dec 20 2018 Numan Siddique <nusiddiq@redhat.com>
432- OVS/OVN split.