File openstack-cinder.spec of Package openstack-cinder
#
# spec file for package openstack-cinder
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define component cinder
%define groupname openstack-%{component}
%define username openstack-%{component}
Name: openstack-%{component}
Version: 2013.2.5.dev2.ga0b026b
Release: 0
Summary: OpenStack Block Storage (Cinder)
License: Apache-2.0
Group: System/Management
Url: https://launchpad.net/cinder
Source: http://manyboxes.opensuse.org/openstack/dist/cinder-stable-havana.tar.gz
Source1: %{name}.init
Source2: %{name}.logrotate
Source3: cinder-sudoers
%if 0%{?suse_version} > 1230
Source10: %name.conf
BuildRequires: systemd
%endif
Patch0: 0001-Avoid-using-GREENDNS-due-to-dnspython.patch
Patch1: 0001-Set-useful-vendor-product-id-in-Cinder-ISCSI-exports.patch
Patch2: 0001-Robustify-skipactivation-detection.patch
Patch4: 0001-Deactivate-LV-before-removing.patch
# PATCH-FIX-UPSTREAM speilicke@suse.com -- https://review.openstack.org/#/c/79621/
Patch5: 0001-Import-glance_api_version-from-cinder.common.config.patch
Patch6: 0001-Remove-explicit-dependency-on-amqplib.patch
Patch7: 0001-Cinder-override-all-method.patch
Patch8: 0001-Add-_wrap_db_error-support-for-postgresql.patch
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: openstack-suse-sudo
BuildRequires: python-base
BuildRequires: python-distribute >= 0.6.24
BuildRequires: python-oslo.config
BuildRequires: python-six
# Documentation build requirements:
BuildRequires: crudini
BuildRequires: python-Babel
BuildRequires: python-Sphinx
BuildRequires: python-WebOb
BuildRequires: python-argparse
BuildRequires: python-eventlet
BuildRequires: python-iso8601
BuildRequires: python-oslo.sphinx
BuildRequires: python-paramiko
BuildRequires: python-pbr
BuildRequires: python-stevedore >= 0.8
Requires: logrotate
Requires: openstack-suse-sudo
Requires: python >= 2.6.8
Requires: python-cinder = %{version}
Requires: python-kombu >= 2.4.8
Requires: python-oslo.config >= 1.2.0
Requires: python-swiftclient >= 1.5
%if 0%{?suse_version} > 1110
Requires(pre): pwdutils
%else
Requires(pre): shadow-utils
%endif
%if 0%{?fedora}
Requires(pre): shadow-utils
%endif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%description
Cinder is the OpenStack Block storage service. This is a spin out of
nova-volumes.
%package -n python-cinder
Summary: OpenStack Block Storage (Cinder) - Python module
Group: Development/Languages/Python
Requires: python >= 2.6.8
Requires: python-Babel >= 1.3
Requires: python-Paste
Requires: python-PasteDeploy >= 1.5.0
Requires: python-Routes >= 1.12.3
Requires: python-SQLAlchemy >= 0.7.8
Requires: python-WebOb >= 1.2.3
Requires: python-anyjson >= 0.3.3
Requires: python-eventlet >= 0.13.0
Requires: python-glanceclient >= 0.9.0
Requires: python-greenlet >= 0.3.2
Requires: python-iso8601 >= 0.1.8
Requires: python-keystoneclient >= 0.3.2
Requires: python-lockfile >= 0.8
Requires: python-lxml >= 2.3
Requires: python-netaddr
Requires: python-novaclient >= 2.15.0
Requires: python-paramiko >= 1.8.0
Requires: python-six >= 1.4.1
Requires: python-sqlalchemy-migrate >= 0.7.2
Requires: python-stevedore >= 0.10
Requires: python-suds >= 0.4
Requires: python-wsgiref >= 0.1.2
%description -n python-cinder
Cinder is the OpenStack Block storage service. This is a spin out of
nova-volumes.
This package contains the core Python module of OpenStack Keystone.
%package api
Summary: OpenStack Block Storage (Cinder) - API
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description api
This package contains the OpenStack Cinder API.
%package backup
Summary: OpenStack Block Storage (Cinder) - Volume Backup Service
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description backup
This package contains the OpenStack Cinder Backup Service.
%package scheduler
Summary: OpenStack Block Storage (Cinder) - Scheduler
Group: Development/Languages/Python
Requires: %{name} = %{version}
%description scheduler
This package contains the OpenStack Cinder scheduler.
%package volume
Summary: OpenStack Block Storage (Cinder) - Volume
Group: Development/Languages/Python
Requires: %{name} = %{version}
# needed by EMC
Requires: python-pywbem
# needed by Boot from Volume (qemu-img)
%if %suse_version < 1120
Requires: virt-utils
%else
Requires: qemu-tools
%endif
Provides: openstack-nova-volume = 2013.1
Obsoletes: openstack-nova-volume < 2013.1
%description volume
This package contains the OpenStack Cinder volume manager.
%package test
Summary: OpenStack Block Storage (Cinder) - Testsuite
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: git-core
Requires: python-cinderclient
Requires: python-coverage >= 3.6
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
Requires: python-discover
%endif
Requires: python-fixtures >= 0.3.14
Requires: python-flake8 >= 2.0
Requires: python-glanceclient >= 0.9.0
Requires: python-hacking >= 0.5.6
Requires: python-hp3parclient >= 2.0
Requires: python-mock >= 1.0
Requires: python-mox >= 0.5.3
Requires: python-pbr >= 0.5.21
Requires: python-pep8 >= 1.4.5
Requires: python-psycopg2
Requires: python-pyflakes >= 0.7.2
Requires: python-python-subunit
Requires: python-testrepository >= 0.0.17
Requires: python-testtools >= 0.9.32
%description test
The OpenStack Cinder testsuite. It is used to verify the
functionality of OpenStack Cinder.
%prep
%setup -q -n %{component}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%openstack_cleanup_prep
%build
python setup.py build
python setup.py build_sphinx -b man
%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
### directories
install -d -m 755 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}
install -d -m 700 %{buildroot}%{_localstatedir}/run/%{component}
%if 0%{?suse_version} > 1230
install -D -m 644 %{SOURCE10} %{buildroot}/%_tmpfilesdir/%name.conf
%endif
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
### configuration files
install -p -D -m 644 etc/cinder/cinder.conf.sample %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf
install -p -D -m 644 etc/cinder/{api-paste.ini,policy.json,rootwrap.conf} %{buildroot}%{_sysconfdir}/%{component}/
cp -a etc/cinder/rootwrap.d/ %{buildroot}%{_sysconfdir}/%{component}/
# bash-completion/logrotate/etc.
install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
### init scripts
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_initddir}
for i in api backup scheduler volume ; do
install -m 755 %{SOURCE1} %{buildroot}%{_initddir}/%{name}-$i
sed -i -e "s/__NAME__/$i/g" %{buildroot}%{_initddir}/%{name}-$i
bootlvm=""
%if %suse_version < 1310
if [ "$i" = "volume" ]; then
bootlvm="boot.lvm"
fi
%endif
sed -i -e "s/__BOOT_LVM__/$bootlvm/" %{buildroot}%{_initddir}/%{name}-$i
ln -s ../..%{_initddir}/%{name}-$i %{buildroot}%{_sbindir}/rc%{name}-$i
done
### sudoers configuration for cinder-rootwrap:
install -D -m 440 %{SOURCE3} %{buildroot}%{_sysconfdir}/sudoers.d/openstack-cinder
### documentation
install -d %{buildroot}%{_mandir}/man1
install -m 644 doc/build/man/*.1 %{buildroot}%{_mandir}/man1
### test subpackage
%openstack_test_package_install
%fdupes %{buildroot}%{_localstatedir}/lib/%{name}-test
### misc
%fdupes %{buildroot}%{python_sitelib}/%{component}
### set default configuration (mostly applies to package-only setups and quickstart, i.e. not generally crowbar)
%define cinder_conf %{buildroot}%{_sysconfdir}/cinder/cinder.conf
crudini --set %{cinder_conf} DEFAULT verbose True
#NOTE(saschpe): Don't set 'log_file', each cinder deamon will create it's own if only 'log_dir' is set:
crudini --set %{cinder_conf} DEFAULT log_dir /var/log/cinder
crudini --set %{cinder_conf} DEFAULT auth_strategy keystone
crudini --set %{cinder_conf} DEFAULT rootwrap_config /etc/cinder/rootwrap.conf
crudini --set %{cinder_conf} DEFAULT state_path /var/lib/cinder
#NOTE(saschpe): Do we want to use sqlite per default or demand PostgreSQL right away?
crudini --set %{cinder_conf} DEFAULT sql_connection sqlite:////var/lib/cinder/cinder.db
#NOTE(saschpe): Can't hurt to set the default volume_group, only the LVM driver has a it otherwise:
crudini --set %{cinder_conf} DEFAULT volume_group cinder-volumes
crudini --set %{cinder_conf} keystone_authtoken signing_dir /var/cache/%component/keystone-signing
crudini --set %{cinder_conf} DEFAULT lock_path /var/run/%component
%pre
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || useradd -r -g %{groupname} -d %{_localstatedir}/lib/%{component} -s /sbin/nologin -c "OpenStack Cinder Daemons" %{username}
exit 0
%post api
%{fillup_and_insserv -f %{name}-api}
%preun api
%stop_on_removal %{name}-api
%postun api
%restart_on_update %{name}-api
%insserv_cleanup
%post backup
%preun backup
%stop_on_removal %{name}-backup
%postun backup
%restart_on_update %{name}-backup
%insserv_cleanup
%post scheduler
%{fillup_and_insserv -f %{name}-scheduler}
%preun scheduler
%stop_on_removal %{name}-scheduler
%postun scheduler
%restart_on_update %{name}-scheduler
%insserv_cleanup
%post volume
%{fillup_and_insserv -f %{name}-volume}
%preun volume
%stop_on_removal %{name}-volume
%postun volume
%restart_on_update %{name}-volume
%insserv_cleanup
%files
%defattr(-,root,root)
%doc LICENSE README.rst
%dir %attr(0755, %{username}, %{groupname}) %{_localstatedir}/lib/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/cache/%{component}
%dir %attr(0750, %{username}, %{groupname}) %{_localstatedir}/log/%{component}
%if 0%{?suse_version} > 1230
%ghost %dir %attr(700,%{username},%{groupname}) %{_localstatedir}/run/%{component}
%_tmpfilesdir/%name.conf
%else
%dir %attr(0700, %{username}, %{groupname}) %{_localstatedir}/run/%{component}
%endif
%dir %{_sysconfdir}/%{component}
%dir %{_sysconfdir}/%{component}/rootwrap.d
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%config %{_sysconfdir}/sudoers.d/openstack-cinder
%config %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/api-paste.ini
%config(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf
%config %{_sysconfdir}/%{component}/policy.json
%config %{_sysconfdir}/%{component}/rootwrap.conf
%{_bindir}/%{component}-all
%{_bindir}/%{component}-clear-rabbit-queues
%{_bindir}/%{component}-manage
%{_bindir}/%{component}-rootwrap
%{_mandir}/man1/%{component}-manage.1%{?ext_man}
%files -n python-%{component}
%defattr(-,root,root,-)
%doc LICENSE
%{python_sitelib}/%{component}/
%{python_sitelib}/%{component}-*.egg-info
%exclude %{python_sitelib}/%{component}/test*
%files api
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-api
%{_sbindir}/rc%{name}-api
%{_bindir}/%{component}-api
%{_bindir}/%{component}-rpc-zmq-receiver
%files backup
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-backup
%{_sbindir}/rc%{name}-backup
%{_bindir}/%{component}-backup
%files scheduler
%defattr(-,root,root,-)
%doc LICENSE
%{_initddir}/%{name}-scheduler
%{_sbindir}/rc%{name}-scheduler
%{_bindir}/%{component}-scheduler
%files volume
%defattr(-,root,root,-)
%doc LICENSE
%config %{_sysconfdir}/%{component}/rootwrap.d/volume.filters
%{_initddir}/%{name}-volume
%{_sbindir}/rc%{name}-volume
%{_bindir}/%{component}-volume
%{_bindir}/%{component}-volume-usage-audit
%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%{python_sitelib}/%{component}/test*
%changelog