Add patch for convert non raw images according to OSCI-943
[openstack-build/cinder-build.git] / rpm / SPECS / openstack-cinder.spec
1 %global with_doc %{!?_without_doc:1}%{?_without_doc:0}
2
3 Name:             openstack-cinder
4 Version:          2013.2
5 Release:          0.9.b3%{?dist}
6 Summary:          OpenStack Volume service
7
8 Group:            Applications/System
9 License:          ASL 2.0
10 URL:              http://www.openstack.org/software/openstack-storage/
11 Source0:          https://launchpad.net/cinder/havana/havana-3/+download/cinder-%{version}.b3.tar.gz
12 Source1:          cinder-dist.conf
13 Source2:          cinder.logrotate
14 Source3:          cinder-tgt.conf
15
16 Source10:         openstack-cinder-api.init
17 Source100:        openstack-cinder-api.upstart
18 Source11:         openstack-cinder-scheduler.init
19 Source110:        openstack-cinder-scheduler.upstart
20 Source12:         openstack-cinder-volume.init
21 Source120:        openstack-cinder-volume.upstart
22 Source13:         openstack-cinder-backup.init
23 Source130:        openstack-cinder-backup.upstart
24
25 Source20:         cinder-sudoers
26
27 #
28 # patches_base=2013.2.b3
29 #
30 Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch
31 Patch0002: 0002-Use-updated-parallel-install-versions-of-epel-packag.patch
32 Patch0003: 0003-Remove-runtime-dep-on-python-pbr-python-d2to1.patch
33 Patch0004: 0004-Revert-Use-oslo.sphinx-and-remove-local-copy-of-doc-.patch
34 Patch0005: MIRA-Do-not-clone-non-raw-images-in-rbd-backend.patch
35
36 BuildArch:        noarch
37 BuildRequires:    intltool
38 BuildRequires:    python-d2to1
39 BuildRequires:    python-pbr
40 BuildRequires:    python-sphinx10
41 BuildRequires:    python-setuptools
42 BuildRequires:    python-netaddr
43 BuildRequires:    openstack-utils
44 BuildRequires:    python-paste-deploy1.5
45 BuildRequires:    python-routes1.12
46 BuildRequires:    python-sqlalchemy0.7
47 BuildRequires:    python-webob1.2
48
49 Requires:         openstack-utils
50 Requires:         python-cinder = %{version}-%{release}
51
52 # as convenience
53 Requires:         python-cinderclient
54
55 Requires(post):   chkconfig
56 Requires(postun): initscripts
57 Requires(preun):  chkconfig
58 Requires(pre):    shadow-utils
59
60 Requires:         lvm2
61 Requires:         scsi-target-utils
62
63 %description
64 OpenStack Volume (codename Cinder) provides services to manage and
65 access block storage volumes for use by Virtual Machine instances.
66
67
68 %package -n       python-cinder
69 Summary:          OpenStack Volume Python libraries
70 Group:            Applications/System
71
72 Requires:         sudo
73
74 Requires:         MySQL-python
75
76 Requires:         qemu-img
77 Requires:         sysfsutils
78
79 Requires:         python-paramiko
80
81 Requires:         python-qpid
82 Requires:         python-kombu
83 Requires:         python-amqplib
84 Requires:         python-importlib
85
86 Requires:         python-eventlet
87 Requires:         python-greenlet
88 Requires:         python-iso8601
89 Requires:         python-netaddr
90 Requires:         python-lxml
91 Requires:         python-anyjson
92 Requires:         python-cheetah
93 Requires:         python-stevedore
94 Requires:         python-suds
95
96 Requires:         python-sqlalchemy0.7
97 Requires:         python-migrate
98
99 Requires:         python-paste-deploy1.5
100 Requires:         python-routes1.12
101 Requires:         python-webob1.2
102
103 Requires:         python-glanceclient >= 1:0
104 Requires:         python-swiftclient >= 1.2
105 Requires:         python-keystoneclient
106 Requires:         python-novaclient >= 2.14
107
108 Requires:         python-oslo-config >= 1:1.2.0
109 Requires:         python-six
110
111 Requires:         python-babel
112 Requires:         python-lockfile
113
114 %description -n   python-cinder
115 OpenStack Volume (codename Cinder) provides services to manage and
116 access block storage volumes for use by Virtual Machine instances.
117
118 This package contains the cinder Python library.
119
120 %if 0%{?with_doc}
121 %package doc
122 Summary:          Documentation for OpenStack Volume
123 Group:            Documentation
124
125 Requires:         %{name} = %{version}-%{release}
126
127 BuildRequires:    graphviz
128
129 # Required to build module documents
130 BuildRequires:    python-eventlet
131 BuildRequires:    python-routes1.12
132 BuildRequires:    python-sqlalchemy0.7
133 BuildRequires:    python-webob1.2
134 # while not strictly required, quiets the build down when building docs.
135 BuildRequires:    python-migrate, python-iso8601
136
137 %description      doc
138 OpenStack Volume (codename Cinder) provides services to manage and
139 access block storage volumes for use by Virtual Machine instances.
140
141 This package contains documentation files for cinder.
142 %endif
143
144 %prep
145 %setup -q -n cinder-%{version}
146
147 %patch0001 -p1
148 %patch0002 -p1
149 %patch0003 -p1
150 %patch0004 -p1
151 %patch0005 -p1
152
153 find . \( -name .gitignore -o -name .placeholder \) -delete
154
155 find cinder -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} +
156
157 # TODO: Have the following handle multi line entries
158 sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py
159
160 # Remove the requirements file so that pbr hooks don't add it
161 # to distutils requires_dist config
162 rm -rf {test-,}requirements.txt tools/{pip,test}-requires
163
164 # We add REDHATCINDERVERSION/RELEASE with the pbr removal patch
165 sed -i s/REDHATCINDERVERSION/%{version}/ cinder/version.py
166 sed -i s/REDHATCINDERRELEASE/%{release}/ cinder/version.py
167
168 %build
169
170 # Move authtoken configuration out of paste.ini
171 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_tenant_name
172 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_user
173 openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_password
174 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_host
175 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_port
176 openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_protocol
177
178 %{__python} setup.py build
179
180 %install
181 %{__python} setup.py install -O1 --skip-build --root %{buildroot}
182
183 # docs generation requires everything to be installed first
184 export PYTHONPATH="$( pwd ):$PYTHONPATH"
185
186 pushd doc
187
188 %if 0%{?with_doc}
189 SPHINX_DEBUG=1 sphinx-1.0-build -b html source build/html
190 # Fix hidden-file-or-dir warnings
191 rm -fr build/html/.doctrees build/html/.buildinfo
192 %endif
193
194 # Create dir link to avoid a sphinx-build exception
195 mkdir -p build/man/.doctrees/
196 ln -s .  build/man/.doctrees/man
197 SPHINX_DEBUG=1 sphinx-1.0-build -b man -c source source/man build/man
198 mkdir -p %{buildroot}%{_mandir}/man1
199 install -p -D -m 644 build/man/*.1 %{buildroot}%{_mandir}/man1/
200
201 popd
202
203 # Setup directories
204 install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder
205 install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder/tmp
206 install -d -m 755 %{buildroot}%{_localstatedir}/log/cinder
207
208 # Install config files
209 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder
210 install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/cinder/cinder-dist.conf
211 install -p -D -m 640 etc/cinder/cinder.conf.sample %{buildroot}%{_sysconfdir}/cinder/cinder.conf
212 install -d -m 755 %{buildroot}%{_sysconfdir}/cinder/volumes
213 install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/tgt/conf.d/cinder.conf
214 install -p -D -m 640 etc/cinder/rootwrap.conf %{buildroot}%{_sysconfdir}/cinder/rootwrap.conf
215 install -p -D -m 640 etc/cinder/api-paste.ini %{buildroot}%{_sysconfdir}/cinder/api-paste.ini
216 install -p -D -m 640 etc/cinder/policy.json %{buildroot}%{_sysconfdir}/cinder/policy.json
217
218 # Install initscripts for services
219 install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/openstack-cinder-api
220 install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-cinder-scheduler
221 install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/openstack-cinder-volume
222 install -p -D -m 755 %{SOURCE13} %{buildroot}%{_initrddir}/openstack-cinder-backup
223
224 # Install sudoers
225 install -p -D -m 440 %{SOURCE20} %{buildroot}%{_sysconfdir}/sudoers.d/cinder
226
227 # Install logrotate
228 install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-cinder
229
230 # Install pid directory
231 install -d -m 755 %{buildroot}%{_localstatedir}/run/cinder
232
233 # Install upstart jobs examples
234 install -d -m 755 %{buildroot}%{_datadir}/cinder
235 install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/cinder/
236 install -p -m 644 %{SOURCE110} %{buildroot}%{_datadir}/cinder/
237 install -p -m 644 %{SOURCE120} %{buildroot}%{_datadir}/cinder/
238 install -p -m 644 %{SOURCE130} %{buildroot}%{_datadir}/cinder/
239
240 # Install rootwrap files in /usr/share/cinder/rootwrap
241 mkdir -p %{buildroot}%{_datarootdir}/cinder/rootwrap/
242 install -p -D -m 644 etc/cinder/rootwrap.d/* %{buildroot}%{_datarootdir}/cinder/rootwrap/
243
244 # Remove unneeded in production stuff
245 rm -f %{buildroot}%{_bindir}/cinder-debug
246 rm -fr %{buildroot}%{python_sitelib}/cinder/tests/
247 rm -fr %{buildroot}%{python_sitelib}/run_tests.*
248 rm -f %{buildroot}/usr/share/doc/cinder/README*
249
250 %pre
251 getent group cinder >/dev/null || groupadd -r cinder --gid 165
252 if ! getent passwd cinder >/dev/null; then
253   useradd -u 165 -r -g cinder -G cinder,nobody -d %{_sharedstatedir}/cinder -s /sbin/nologin -c "OpenStack Cinder Daemons" cinder
254 fi
255 exit 0
256
257 %post
258 if [ $1 -eq 1 ] ; then
259     # Initial installation
260     for svc in volume api scheduler; do
261         /sbin/chkconfig --add openstack-cinder-$svc
262     done
263 fi
264
265 %preun
266 if [ $1 -eq 0 ] ; then
267     for svc in volume api scheduler; do
268         /sbin/service openstack-cinder-${svc} stop > /dev/null 2>&1
269         /sbin/chkconfig --del openstack-cinder-${svc}
270     done
271 fi
272
273 %postun
274 if [ $1 -ge 1 ] ; then
275     # Package upgrade, not uninstall
276     for svc in volume api scheduler; do
277         /sbin/service openstack-cinder-${svc} condrestart > /dev/null 2>&1 || :
278     done
279 fi
280
281 %files
282 %doc LICENSE
283
284 %dir %{_sysconfdir}/cinder
285 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/cinder.conf
286 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/api-paste.ini
287 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/rootwrap.conf
288 %config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/policy.json
289 %config(noreplace) %{_sysconfdir}/logrotate.d/openstack-cinder
290 %config(noreplace) %{_sysconfdir}/sudoers.d/cinder
291 %config(noreplace) %{_sysconfdir}/tgt/conf.d/cinder.conf
292 %attr(-, root, cinder) %{_datadir}/cinder/cinder-dist.conf
293
294 %dir %attr(0750, cinder, root) %{_localstatedir}/log/cinder
295 %dir %attr(0755, cinder, root) %{_localstatedir}/run/cinder
296 %dir %attr(0755, cinder, root) %{_sysconfdir}/cinder/volumes
297
298 %{_bindir}/cinder-*
299 %{_initrddir}/openstack-cinder-*
300 %{_datarootdir}/cinder
301 %{_mandir}/man1/cinder*.1.gz
302
303 %defattr(-, cinder, cinder, -)
304 %dir %{_sharedstatedir}/cinder
305 %dir %{_sharedstatedir}/cinder/tmp
306
307 %files -n python-cinder
308 %doc LICENSE
309 %{python_sitelib}/cinder
310 %{python_sitelib}/cinder-%{version}*.egg-info
311
312 %if 0%{?with_doc}
313 %files doc
314 %doc doc/build/html
315 %endif
316
317 %changelog
318 * Wed Sep 18 2013 Eric Harney <eharney@redhat.com> - 2013.2-0.9.b3
319 - Add cinder-dist.conf
320 - Tighten permissions on /var/log/cinder
321
322 * Mon Sep 9 2013 Eric Harney <eharney@redhat.com> - 2013.2-0.8.b3
323 - Update to Havana milestone 3
324 - Add dependency on python-novaclient
325
326 * Thu Aug 29 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.7.b2
327 - Add dependency on sysfsutils to support the fiber channel driver
328
329 * Mon Aug 26 2013 Eric Harney <eharney@redhat.com> - 2013.2-0.5.b2
330 - Add cinder-backup service init script
331
332 * Mon Jul 22 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.4.b2
333 - Add dependency on python-suds to support the netapp driver
334 - Add dependency on python-keystoneclient for auth token middleware
335 - Add dependency on qemu-img for volume creation from Glance images
336
337 * Sun Jul 21 2013 Pádraig Brady <pbrady@redhat.com> - 2013.2-0.3.b2
338 - Update to Havana milestone 2
339
340 * Thu Jun 13 2013 Eric Harney <eharney@redhat.com> - 2013.2-0.2.b1
341 - Update to Havana milestone 1
342
343 * Fri May 10 2013 Eric Harney <eharney@redhat.com> - 2013.1.1-1
344 - Update to Grizzly stable release 1
345
346 * Mon Apr 08 2013 Eric Harney <eharney@redhat.com> - 2013.1-2
347 - Backport fix for GlusterFS driver get_volume_stats
348 - Adjust to support sqlalchemy-0.8.0
349
350 * Thu Apr 04 2013 Eric Harney <eharney@redhat.com> - 2013.1-1
351 - Update to Grizzly final release
352
353 * Wed Mar 27 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.5.rc3
354 - Update to Grizzly RC3 release
355
356 * Mon Mar 25 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.5.rc2
357 - Update to Grizzly RC2 release
358
359 * Mon Mar 18 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.5.rc1
360 - Update to Grizzly RC1 release
361
362 * Tue Mar 05 2013 Pádraig Brady <P@draigBrady.com> - 2013.1-0.4.g3
363 - Add dependency on python-stevedore
364
365 * Wed Feb 27 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.2.g3
366 - Update to Grizzly milestone 3
367
368 * Thu Jan 10 2013 Eric Harney <eharney@redhat.com> - 2013.1-0.1.g2
369 - Update to Grizzly milestone 2
370
371 * Thu Dec 20 2012 Eric Harney <eharney@redhat.com> - 2013.1-0.1.g1
372 - Update to Grizzly milestone 1
373
374 * Mon Dec 03 2012 Eric Harney <eharney@redhat.com> - 2012.2.1-1
375 - Update to Folsom stable release 1
376
377 * Wed Nov 14 2012 Eric Harney <eharney@redhat.com> - 2012.2-4
378 - Remove unused dependency on python-daemon
379
380 * Wed Oct 31 2012 Pádraig Brady <P@draigBrady.com> - 2012.2-3
381 - Adjust to be compatible with python-migrate-0.6
382
383 * Wed Oct 24 2012 Pádraig Brady <P@draigBrady.com> - 2012.2-2
384 - Initial Folsom release