File openstack-cinder.spec of Package openstack-cinder
#
# spec file for package openstack-cinder
#
# Copyright (c) 2020 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define component cinder
%define groupname %{component}
%define username %{component}
%if ! %{defined _rundir}
%define _rundir %{_localstatedir}/run
%endif
%define version_unconverted 9.1.5.dev6
Name: openstack-%{component}
Version: 9.1.5~dev6
Release: 0
Summary: OpenStack Block Storage (Cinder)
License: Apache-2.0
Group: System/Management
URL: https://launchpad.net/cinder
Source: http://tarballs.openstack.org/cinder/cinder-stable-newton.tar.gz
Source1: %{name}.logrotate
Source2: cinder-sudoers
Source3: %name.conf
Source4: rpmlintrc
Source5: cinder-migrate-volume-names-to-cluster
# systemd service files
Source10: %{name}-api.service
Source11: %{name}-backup.service
Source12: %{name}-scheduler.service
Source13: %{name}-volume.service
Source50: README.config
# https://review.openstack.org/#/c/493952/
Patch0: 0001-netapp-fix-svm-scoped-user-startup-exception.patch
# https://review.openstack.org/#/c/426547/
Patch1: 0002-short-circuit-notifications-when-not-enabled.patch
# https://review.openstack.org/#/c/427647/
Patch2: 0003-fix-notification-short-circuit.patch
#3 https://review.openstack.org/#/c/606130/
Patch3: 0004-ScaleIO-Prevent-usage-of-unsafe-volumes.patch
BuildRequires: fdupes
BuildRequires: openstack-suse-macros
BuildRequires: openstack-suse-sudo
BuildRequires: python-base
BuildRequires: python-oslo.config
BuildRequires: python-setuptools
BuildRequires: python-six
# Documentation build requirements:
BuildRequires: crudini
BuildRequires: python-Babel
BuildRequires: python-Paste
BuildRequires: python-PasteDeploy
BuildRequires: python-Routes
BuildRequires: python-Sphinx
BuildRequires: python-WebOb
BuildRequires: python-argparse
BuildRequires: python-eventlet
BuildRequires: python-glanceclient
BuildRequires: python-google-api-python-client
BuildRequires: python-httplib2
BuildRequires: python-iso8601
BuildRequires: python-keystonemiddleware
BuildRequires: python-mox3
BuildRequires: python-novaclient
BuildRequires: python-oauth2client
BuildRequires: python-os-brick
BuildRequires: python-os-win
BuildRequires: python-oslo.concurrency
BuildRequires: python-oslo.context
BuildRequires: python-oslo.db
BuildRequires: python-oslo.i18n
BuildRequires: python-oslo.log
BuildRequires: python-oslo.middleware
BuildRequires: python-oslo.policy
BuildRequires: python-oslo.reports
BuildRequires: python-oslo.serialization
BuildRequires: python-oslo.service
BuildRequires: python-oslo.utils
BuildRequires: python-oslo.versionedobjects
BuildRequires: python-oslo.vmware
BuildRequires: python-oslosphinx
BuildRequires: python-oslotest
BuildRequires: python-osprofiler
BuildRequires: python-paramiko
BuildRequires: python-pbr
BuildRequires: python-stevedore
BuildRequires: python-suds-jurko
BuildRequires: python-swiftclient
BuildRequires: python-taskflow
BuildRequires: python-tooz
BuildRequires: systemd-rpm-macros
%{?systemd_requires}
Requires: logrotate
Requires: openstack-suse-sudo
Requires: python >= 2.7
Requires: python-cinder = %{version}
Requires(pre): pwdutils
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%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 >= 2.3.4
Requires: python-Paste
Requires: python-PasteDeploy >= 1.5.0
Requires: python-Routes >= 1.12.3
Requires: python-SQLAlchemy >= 1.0.10
Requires: python-WebOb >= 1.2.3
Requires: python-anyjson >= 0.3.3
Requires: python-barbicanclient >= 4.0.0
Requires: python-castellan >= 0.4.0
Requires: python-decorator >= 3.4.0
Requires: python-enum34
Requires: python-eventlet >= 0.18.2
Requires: python-glanceclient >= 2.3.0
Requires: python-greenlet >= 0.3.2
Requires: python-httplib2 >= 0.7.5
Requires: python-ipaddress >= 1.0.7
Requires: python-iso8601 >= 0.1.11
Requires: python-keystoneauth1 >= 2.10.0
Requires: python-keystoneclient >= 2.0.0
Requires: python-keystonemiddleware >= 4.0.0
Requires: python-lxml >= 2.3
Requires: python-novaclient >= 2.29.0
Requires: python-os-brick >= 1.6.1
Requires: python-oslo.concurrency >= 3.8.0
Requires: python-oslo.context >= 2.9.0
Requires: python-oslo.db >= 4.10.0
Requires: python-oslo.log >= 1.14.0
Requires: python-oslo.messaging >= 5.2.0
Requires: python-oslo.policy >= 1.9.0
Requires: python-oslo.privsep >= 1.9.0
Requires: python-oslo.reports >= 0.6.0
Requires: python-oslo.rootwrap >= 5.0.0
Requires: python-oslo.serialization >= 1.10.0
Requires: python-oslo.service >= 1.10.0
Requires: python-oslo.utils >= 3.16.0
Requires: python-oslo.versionedobjects >= 1.13.0
Requires: python-oslo.vmware >= 2.11.0
Requires: python-osprofiler >= 1.4.0
Requires: python-paramiko >= 2.0
Requires: python-pycrypto >= 2.6
Requires: python-pyparsing >= 2.0.1
Requires: python-pytz >= 2013.6
Requires: python-requests >= 2.10.0
Requires: python-retrying >= 1.2.3
Requires: python-rtslib-fb >= 2.1.41
Requires: python-simplejson >= 2.2.0
Requires: python-six >= 1.9.0
Requires: python-sqlalchemy-migrate >= 0.9.6
Requires: python-stevedore >= 1.16.0
Requires: python-suds-jurko >= 0.6
Requires: python-taskflow >= 1.26.0
Requires: python-tooz >= 1.28.0
%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}
Requires: python-google-api-python-client >= 1.4.2
Requires: python-oauth2client >= 1.5.0
%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}
# iSCSI backends need iscsiadm (for create volume from image)
Requires: open-iscsi
# needed by EMC and Fujitsu
Requires: python-pywbem
# needed by Boot from Volume (qemu-img)
Requires: qemu-tools
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-ddt >= 1.0.1
Requires: python-fixtures >= 3.0.0
Requires: python-glanceclient >= 2.3.0
Requires: python-mock >= 2.0
Requires: python-mox3 >= 0.7.0
Requires: python-os-api-ref >= 1.0.0
Requires: python-os-testr >= 0.7.0
Requires: python-oslotest >= 1.10.0
Requires: python-pbr >= 1.6
Requires: python-psycopg2 >= 2.5
Requires: python-python-subunit >= 0.0.18
Requires: python-reno >= 1.8.0
Requires: python-tempest-lib >= 0.14.0
Requires: python-testrepository >= 0.0.18
Requires: python-testresources >= 0.2.4
Requires: python-testscenarios >= 0.4
Requires: python-testtools >= 1.4.0
%description test
The OpenStack Cinder testsuite. It is used to verify the
functionality of OpenStack Cinder.
%prep
%setup -q -n cinder-%{version_unconverted}
%openstack_cleanup_prep
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
python setup.py build
PYTHONPATH=. python setup.py build_sphinx -b man
%install
python setup.py install --skip-build --prefix=%{_prefix} --root=%{buildroot}
PYTHONPATH=. oslo-config-generator --config-file=cinder/config/cinder-config-generator.conf --output-file etc/cinder/cinder.conf.sample
### directories
install -d -m 755 %{buildroot}%{_localstatedir}/{lib,log}/%{component}
install -d -m 750 %{buildroot}%{_localstatedir}/cache/%{component}
install -d -m 700 %{buildroot}%{_rundir}/%{component}
install -D -m 644 %{SOURCE3} %{buildroot}/%_tmpfilesdir/%name.conf
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d
install -d -m 755 %{buildroot}%{_sysconfdir}/%{component}/%{component}-volume.conf.d
### migratation script
install -D -m 755 %{SOURCE5} %{buildroot}/%{_bindir}/cinder-migrate-volume-names-to-cluster
### configuration files
install -p -D -m 640 %{SOURCE50} %{buildroot}%{_sysconfdir}/%{component}/README.config
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 %{SOURCE1} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# Install systemd unit services
mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_unitdir}
install -p -D -m 444 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 444 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-backup.service
install -p -D -m 444 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-scheduler.service
install -p -D -m 444 %{SOURCE13} %{buildroot}%{_unitdir}/%{name}-volume.service
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-api
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-backup
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-scheduler
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-volume
### sudoers configuration for cinder-rootwrap:
install -D -m 440 %{SOURCE2} %{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
%define cinder_conf %{buildroot}%{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
crudini --set %{cinder_conf} DEFAULT log_dir /var/log/%{component}
crudini --set %{cinder_conf} oslo_concurrency lock_path /var/run/%{component}
crudini --set %{cinder_conf} keystone_authtoken signing_dir /var/cache/%{component}/keystone-signing
%pre
%openstack_pre_user_group_create %{username} %{groupname}
%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%pre api
%service_add_pre openstack-cinder-api.service
%post api
%service_add_post openstack-cinder-api.service
%preun api
%service_del_preun openstack-cinder-api.service
%postun api
%restart_on_update %{name}-api.service
%service_del_postun openstack-cinder-api.service
%pre backup
%service_add_pre openstack-cinder-backup.service
%post backup
%service_add_post openstack-cinder-backup.service
%preun backup
%service_del_preun openstack-cinder-backup.service
%postun backup
%restart_on_update %{name}-backup.service
%service_del_postun openstack-cinder-backup.service
%pre scheduler
%service_add_pre openstack-cinder-scheduler.service
%post scheduler
%service_add_post openstack-cinder-scheduler.service
%preun scheduler
%service_del_preun openstack-cinder-scheduler.service
%postun scheduler
%restart_on_update %{name}-scheduler.service
%service_del_postun openstack-cinder-scheduler.service
%pre volume
%service_add_pre openstack-cinder-volume.service
%post volume
%service_add_post openstack-cinder-volume.service
%preun volume
%service_del_preun openstack-cinder-volume.service
%postun volume
%restart_on_update %{name}-volume.service
%service_del_postun openstack-cinder-volume.service
%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}
%_tmpfilesdir/%name.conf
%dir %{_tmpfilesdir}
%{_sysconfdir}/%{component}/README.config
%dir %{_sysconfdir}/%{component}
%dir %{_sysconfdir}/%{component}/%{component}.conf.d/
%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(noreplace) %attr(0640, root, %{groupname}) %{_sysconfdir}/%{component}/%{component}.conf.d/010-%{component}.conf
%config %{_sysconfdir}/%{component}/policy.json
%config %{_sysconfdir}/%{component}/rootwrap.conf
%{_bindir}/%{component}-all
%{_bindir}/%{component}-rtstool
%{_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
# don't exclude the tempest tests (must be in the python package
# because of the entrypoint in setup.cfg)
%exclude %{python_sitelib}/%{component}/tests/compliance
%exclude %{python_sitelib}/%{component}/tests/unit
%exclude %{python_sitelib}/%{component}/tests/functional
%files api
%defattr(-,root,root,-)
%doc LICENSE
%{_unitdir}/%{name}-api.service
%{_sbindir}/rc%{name}-api
%{_bindir}/%{component}-api
%{_bindir}/%{component}-wsgi
%files backup
%defattr(-,root,root,-)
%doc LICENSE
%{_unitdir}/%{name}-backup.service
%{_sbindir}/rc%{name}-backup
%{_bindir}/%{component}-backup
%files scheduler
%defattr(-,root,root,-)
%doc LICENSE
%{_unitdir}/%{name}-scheduler.service
%{_sbindir}/rc%{name}-scheduler
%{_bindir}/%{component}-scheduler
%files volume
%defattr(-,root,root,-)
%doc LICENSE
%dir %{_sysconfdir}/%{component}/%{component}-volume.conf.d/
%config %{_sysconfdir}/%{component}/rootwrap.d/volume.filters
%{_unitdir}/%{name}-volume.service
%{_sbindir}/rc%{name}-volume
%{_bindir}/%{component}-migrate-volume-names-to-cluster
%{_bindir}/%{component}-volume
%{_bindir}/%{component}-volume-usage-audit
%files test
%defattr(-,root,root)
%{_localstatedir}/lib/%{name}-test/
%{python_sitelib}/%{component}/tests/unit
%{python_sitelib}/%{component}/tests/compliance
%{python_sitelib}/%{component}/tests/functional
%changelog