]>
Commit | Line | Data |
---|---|---|
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 | ||
43 | Name: ovn | |
44 | Summary: Open Virtual Network support | |
45 | Group: System Environment/Daemons | |
46 | URL: http://www.openvswitch.org/ | |
47 | Version: @VERSION@ | |
a53a7e03 NS |
48 | Obsoletes: openvswitch-ovn-common < %{?epoch:%{epoch}:}%{version}-%{release} |
49 | Provides: 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 | |
53 | License: ASL 2.0 and LGPLv2+ and SISSL | |
54 | Release: 1%{?dist} | |
55 | Source: http://openvswitch.org/releases/openvswitch-%{version}.tar.gz | |
56 | ||
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 | |
63 | %endif | |
64 | BuildRequires: desktop-file-utils | |
65 | BuildRequires: groff graphviz | |
66 | BuildRequires: checkpolicy, selinux-policy-devel | |
b16b5caf | 67 | BuildRequires: /usr/bin/sphinx-build |
78203a9c NS |
68 | # make check dependencies |
69 | BuildRequires: %{_py2}-twisted%{?rhel:-core} %{_py2}-zope-interface %{_py2}-six | |
70 | BuildRequires: procps-ng | |
71 | %if %{with libcapng} | |
72 | BuildRequires: libcap-ng libcap-ng-devel | |
73 | %endif | |
74 | BuildRequires: unbound unbound-devel | |
75 | ||
76 | Requires: openssl hostname iproute module-init-tools openvswitch | |
77 | ||
78 | Requires(post): systemd-units | |
79 | Requires(preun): systemd-units | |
80 | Requires(postun): systemd-units | |
81 | ||
82 | # to skip running checks, pass --without check | |
83 | %bcond_without check | |
84 | ||
85 | %description | |
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. | |
90 | ||
91 | %package central | |
92 | Summary: Open Virtual Network support | |
93 | License: ASL 2.0 | |
a53a7e03 | 94 | Requires: ovn |
78203a9c NS |
95 | Requires: firewalld-filesystem |
96 | Obsoletes: openvswitch-ovn-central | |
97 | Provides: openvswitch-ovn-central = %{?epoch:%{epoch}:}%{version}-%{release} | |
98 | ||
99 | %description central | |
100 | OVN DB servers and ovn-northd running on a central node. | |
101 | ||
102 | %package host | |
103 | Summary: Open Virtual Network support | |
104 | License: ASL 2.0 | |
a53a7e03 | 105 | Requires: ovn |
78203a9c NS |
106 | Requires: firewalld-filesystem |
107 | Obsoletes: openvswitch-ovn-host | |
108 | Provides: openvswitch-ovn-host = %{?epoch:%{epoch}:}%{version}-%{release} | |
109 | ||
110 | %description host | |
111 | OVN controller running on each host. | |
112 | ||
113 | %package vtep | |
114 | Summary: Open Virtual Network support | |
115 | License: ASL 2.0 | |
a53a7e03 | 116 | Requires: ovn |
78203a9c NS |
117 | Obsoletes: openvswitch-ovn-vtep |
118 | Provides: openvswitch-ovn-vtep = %{?epoch:%{epoch}:}%{version}-%{release} | |
119 | ||
120 | %description vtep | |
121 | OVN vtep controller | |
122 | ||
78203a9c NS |
123 | %package docker |
124 | Summary: Open Virtual Network support | |
125 | License: ASL 2.0 | |
a53a7e03 | 126 | Requires: ovn %{_py2}-openvswitch |
78203a9c NS |
127 | Obsoletes: openvswitch-ovn-docker |
128 | Provides: openvswitch-ovn-docker = %{?epoch:%{epoch}:}%{version}-%{release} | |
129 | ||
130 | %description docker | |
131 | Docker 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 | ||
152 | make %{?_smp_mflags} | |
153 | ||
154 | %install | |
155 | rm -rf $RPM_BUILD_ROOT | |
156 | make install DESTDIR=$RPM_BUILD_ROOT | |
157 | ||
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 | |
162 | done | |
163 | ||
164 | rm -rf $RPM_BUILD_ROOT/%{_datadir}/openvswitch/python/ | |
165 | ||
166 | install -d -m 0755 $RPM_BUILD_ROOT/%{_sharedstatedir}/openvswitch | |
167 | ||
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 | |
173 | ||
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 | |
177 | ||
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 | |
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 | |
217 | rm -rf $RPM_BUILD_ROOT | |
218 | ||
219 | %pre central | |
220 | if [ $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 | |
231 | fi | |
232 | ||
233 | %pre host | |
234 | if [ $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 | |
245 | fi | |
246 | ||
247 | %pre vtep | |
248 | if [ $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 | |
259 | fi | |
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 | |
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 || : | |
365 | fi | |
366 | fi | |
367 | ||
368 | ||
369 | %posttrans host | |
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 || : | |
375 | fi | |
376 | fi | |
377 | ||
378 | %posttrans vtep | |
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 || : | |
384 | fi | |
385 | fi | |
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. |