From ffe44b0901971575f97f4e5078e3a0d54313cf25 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Mon, 25 Mar 2013 19:38:36 +0400 Subject: [PATCH] added cinder rpm files Change-Id: I3465bf529aa7f2e59b071efc73e99d24d191c767 --- ...-t-access-the-net-when-building-docs.patch | 22 ++ rpm/SOURCES/cinder-sudoers | 3 + rpm/SOURCES/cinder-tgt.conf | 5 + rpm/SOURCES/cinder.conf | 18 + rpm/SOURCES/cinder.logrotate | 9 + rpm/SOURCES/openstack-cinder-api.init | 110 +++++++ rpm/SOURCES/openstack-cinder-api.upstart | 8 + rpm/SOURCES/openstack-cinder-newdeps.patch | 78 +++++ rpm/SOURCES/openstack-cinder-scheduler.init | 102 ++++++ .../openstack-cinder-scheduler.upstart | 8 + rpm/SOURCES/openstack-cinder-volume.init | 110 +++++++ rpm/SOURCES/openstack-cinder-volume.upstart | 8 + rpm/SPECS/openstack-cinder.spec | 309 ++++++++++++++++++ 13 files changed, 790 insertions(+) create mode 100644 rpm/SOURCES/0001-Ensure-we-don-t-access-the-net-when-building-docs.patch create mode 100644 rpm/SOURCES/cinder-sudoers create mode 100644 rpm/SOURCES/cinder-tgt.conf create mode 100644 rpm/SOURCES/cinder.conf create mode 100644 rpm/SOURCES/cinder.logrotate create mode 100644 rpm/SOURCES/openstack-cinder-api.init create mode 100644 rpm/SOURCES/openstack-cinder-api.upstart create mode 100644 rpm/SOURCES/openstack-cinder-newdeps.patch create mode 100644 rpm/SOURCES/openstack-cinder-scheduler.init create mode 100644 rpm/SOURCES/openstack-cinder-scheduler.upstart create mode 100644 rpm/SOURCES/openstack-cinder-volume.init create mode 100644 rpm/SOURCES/openstack-cinder-volume.upstart create mode 100644 rpm/SPECS/openstack-cinder.spec diff --git a/rpm/SOURCES/0001-Ensure-we-don-t-access-the-net-when-building-docs.patch b/rpm/SOURCES/0001-Ensure-we-don-t-access-the-net-when-building-docs.patch new file mode 100644 index 000000000..852bae362 --- /dev/null +++ b/rpm/SOURCES/0001-Ensure-we-don-t-access-the-net-when-building-docs.patch @@ -0,0 +1,22 @@ +From 632fb0194715d52f2b03c5b4b8697d4271bd81f7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?P=C3=A1draig=20Brady?= +Date: Fri, 21 Sep 2012 13:33:26 +0100 +Subject: [PATCH] Ensure we don't access the net when building docs + +(Note, this has not been sent upstream) +--- + doc/source/conf.py | 1 - + 1 files changed, 0 insertions(+), 1 deletions(-) + +diff --git a/doc/source/conf.py b/doc/source/conf.py +index 7436039..9a5b826 100644 +--- a/doc/source/conf.py ++++ b/doc/source/conf.py +@@ -29,7 +29,6 @@ sys.path.insert(0, os.path.abspath('./')) + # or your custom ones. + + extensions = ['sphinx.ext.autodoc', +- 'sphinx.ext.intersphinx', + 'ext.cinder_todo', + 'sphinx.ext.coverage', + 'sphinx.ext.pngmath', diff --git a/rpm/SOURCES/cinder-sudoers b/rpm/SOURCES/cinder-sudoers new file mode 100644 index 000000000..ed5d479de --- /dev/null +++ b/rpm/SOURCES/cinder-sudoers @@ -0,0 +1,3 @@ +Defaults:cinder !requiretty + +cinder ALL = (root) NOPASSWD: /usr/bin/cinder-rootwrap /etc/cinder/rootwrap.conf * diff --git a/rpm/SOURCES/cinder-tgt.conf b/rpm/SOURCES/cinder-tgt.conf new file mode 100644 index 000000000..1581c7953 --- /dev/null +++ b/rpm/SOURCES/cinder-tgt.conf @@ -0,0 +1,5 @@ +# Note this config mode is not supported by scsi-target-utils in RHEL <= 6.4 +# include /etc/cinder/volumes/ +# So instead please add the following line (without the leading comment char) +# to the top of /etc/tgt/targets.conf +# include /etc/cinder/volumes/* diff --git a/rpm/SOURCES/cinder.conf b/rpm/SOURCES/cinder.conf new file mode 100644 index 000000000..89105a6b2 --- /dev/null +++ b/rpm/SOURCES/cinder.conf @@ -0,0 +1,18 @@ +[DEFAULT] +logdir = /var/log/cinder +state_path = /var/lib/cinder +lock_path = /var/lib/cinder/tmp +volumes_dir = /etc/cinder/volumes +iscsi_helper = tgtadm +sql_connection = mysql://cinder:cinder@localhost/cinder +rpc_backend = cinder.openstack.common.rpc.impl_qpid +rootwrap_config = /etc/cinder/rootwrap.conf + +[keystone_authtoken] +admin_tenant_name = %SERVICE_TENANT_NAME% +admin_user = %SERVICE_USER% +admin_password = %SERVICE_PASSWORD% +auth_host = 127.0.0.1 +auth_port = 35357 +auth_protocol = http +signing_dirname = /tmp/keystone-signing-cinder diff --git a/rpm/SOURCES/cinder.logrotate b/rpm/SOURCES/cinder.logrotate new file mode 100644 index 000000000..dae963158 --- /dev/null +++ b/rpm/SOURCES/cinder.logrotate @@ -0,0 +1,9 @@ +compress + +/var/log/cinder/*.log { + weekly + rotate 4 + missingok + compress + minsize 100k +} diff --git a/rpm/SOURCES/openstack-cinder-api.init b/rpm/SOURCES/openstack-cinder-api.init new file mode 100644 index 000000000..01045ebea --- /dev/null +++ b/rpm/SOURCES/openstack-cinder-api.init @@ -0,0 +1,110 @@ +#!/bin/sh +# +# openstack-cinder-api OpenStack cinder API Server +# +# chkconfig: - 98 02 +# description: At the heart of the cloud framework is an API Server. \ +# This API Server makes command and control of the \ +# hypervisor, storage, and networking programmatically \ +# available to users in realization of the definition \ +# of cloud computing. + +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $network $syslog +# Required-Stop: $remote_fs $syslog +# Default-Stop: 0 1 6 +# Short-Description: OpenStack cinder API Server +# Description: At the heart of the cloud framework is an API Server. +# This API Server makes command and control of the +# hypervisor, storage, and networking programmatically +# available to users in realization of the definition +# of cloud computing. +### END INIT INFO + +. /etc/rc.d/init.d/functions + +suffix=api +prog=openstack-cinder-$suffix +exec="/usr/bin/cinder-$suffix" +config="/etc/cinder/cinder.conf" +pidfile="/var/run/cinder/cinder-$suffix.pid" +logfile="/var/log/cinder/$suffix.log" + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + +start() { + [ -x $exec ] || exit 5 + [ -f $config ] || exit 6 + echo -n $"Starting $prog: " + daemon --user cinder --pidfile $pidfile "$exec --config-file $config --logfile $logfile &>/dev/null & echo \$! > $pidfile" + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p $pidfile $prog + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + status -p $pidfile $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac +exit $? diff --git a/rpm/SOURCES/openstack-cinder-api.upstart b/rpm/SOURCES/openstack-cinder-api.upstart new file mode 100644 index 000000000..f3111f28e --- /dev/null +++ b/rpm/SOURCES/openstack-cinder-api.upstart @@ -0,0 +1,8 @@ +description "OpenStack Cinder API Server" + +start on stopped rc RUNLEVEL=[2345] +stop on runlevel [S016] + +respawn + +exec su -s /bin/sh -c "exec /usr/bin/cinder-api --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/api.log" cinder diff --git a/rpm/SOURCES/openstack-cinder-newdeps.patch b/rpm/SOURCES/openstack-cinder-newdeps.patch new file mode 100644 index 000000000..19f2d0de9 --- /dev/null +++ b/rpm/SOURCES/openstack-cinder-newdeps.patch @@ -0,0 +1,78 @@ +--- cinder-2013.1-orig/cinder/__init__.py 2012-11-22 04:22:19.000000000 -0500 ++++ cinder-2013.1/cinder/__init__.py 2012-12-20 12:57:42.337489999 -0500 +@@ -31,6 +31,36 @@ + .. moduleauthor:: Andy Smith + """ + ++import sys ++import pkg_resources ++ ++# If there is a conflicting non egg module, ++# i.e. an older standard system module installed, ++# then replace it with this requirement ++def replace_dist(requirement): ++ try: ++ return pkg_resources.require(requirement) ++ except pkg_resources.VersionConflict: ++ e = sys.exc_info()[1] ++ dist=e.args[0] ++ req=e.args[1] ++ if dist.key == req.key and not dist.location.endswith('.egg'): ++ del pkg_resources.working_set.by_key[dist.key] ++ # We assume there is no need to adjust sys.path ++ # and the associated pkg_resources.working_set.entries ++ return pkg_resources.require(requirement) ++ ++replace_dist("WebOb >= 1.0") ++replace_dist("SQLAlchemy >= 0.6.3") ++replace_dist("Routes >= 1.12.3") ++ ++replace_dist("PasteDeploy >= 1.5.0") ++# This hack is needed because replace_dist() results in ++# the standard paste module path being at the start of __path__. ++# TODO: See can we get pkg_resources to do the right thing directly ++import paste ++paste.__path__.insert(0, paste.__path__.pop(-1)) ++ + import gettext + + +--- cinder-2013.1-orig/bin/cinder-manage 2012-11-22 04:22:19.000000000 -0500 ++++ cinder-2013.1/bin/cinder-manage 2012-12-20 12:58:01.014504835 -0500 +@@ -60,9 +60,6 @@ + import sys + import uuid + +-from sqlalchemy import create_engine, MetaData, Table +-from sqlalchemy.ext.declarative import declarative_base +-from sqlalchemy.orm import sessionmaker + + + # If ../cinder/__init__.py exists, add ../ to Python search path, so that +@@ -86,6 +83,10 @@ + from cinder import utils + from cinder import version + ++from sqlalchemy import create_engine, MetaData, Table ++from sqlalchemy.orm import sessionmaker ++from sqlalchemy.ext.declarative import declarative_base ++ + FLAGS = flags.FLAGS + + +--- cinder-2013.1-orig/cinder/db/sqlalchemy/migration.py 2012-11-22 04:22:19.000000000 -0500 ++++ cinder-2013.1/cinder/db/sqlalchemy/migration.py 2012-12-20 12:57:44.821491814 -0500 +@@ -57,7 +57,12 @@ + + + # NOTE(jkoelker) Delay importing migrate until we are patched +-from migrate import exceptions as versioning_exceptions ++try: ++ # Try the more specific path first (migrate <= 0.6) ++ from migrate.versioning import exceptions as versioning_exceptions ++except ImportError: ++ # Use the newer path (migrate >= 0.7) ++ from migrate import exceptions as versioning_exceptions + from migrate.versioning import api as versioning_api + from migrate.versioning.repository import Repository + diff --git a/rpm/SOURCES/openstack-cinder-scheduler.init b/rpm/SOURCES/openstack-cinder-scheduler.init new file mode 100644 index 000000000..637a0bbd3 --- /dev/null +++ b/rpm/SOURCES/openstack-cinder-scheduler.init @@ -0,0 +1,102 @@ +#!/bin/sh +# +# openstack-cinder-scheduler OpenStack cinder Scheduler +# +# chkconfig: - 98 02 +# description: Determines which physical hardware to allocate to a virtual resource + +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $network $syslog +# Required-Stop: $remote_fs $syslog +# Default-Stop: 0 1 6 +# Short-Description: OpenStack cinder Scheduler +# Description: Determines which physical hardware to allocate to a virtual resource +### END INIT INFO + +. /etc/rc.d/init.d/functions + +suffix=scheduler +prog=openstack-cinder-$suffix +exec="/usr/bin/cinder-$suffix" +config="/etc/cinder/cinder.conf" +pidfile="/var/run/cinder/cinder-$suffix.pid" +logfile="/var/log/cinder/$suffix.log" + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + +start() { + [ -x $exec ] || exit 5 + [ -f $config ] || exit 6 + echo -n $"Starting $prog: " + daemon --user cinder --pidfile $pidfile "$exec --config-file $config --logfile $logfile &>/dev/null & echo \$! > $pidfile" + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p $pidfile $prog + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + status -p $pidfile $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac +exit $? diff --git a/rpm/SOURCES/openstack-cinder-scheduler.upstart b/rpm/SOURCES/openstack-cinder-scheduler.upstart new file mode 100644 index 000000000..aef16c5cf --- /dev/null +++ b/rpm/SOURCES/openstack-cinder-scheduler.upstart @@ -0,0 +1,8 @@ +description "OpenStack Cinder Scheduler Server" + +start on stopped rc RUNLEVEL=[2345] +stop on runlevel [S016] + +respawn + +exec su -s /bin/sh -c "exec /usr/bin/cinder-scheduler --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/scheduler.log" cinder diff --git a/rpm/SOURCES/openstack-cinder-volume.init b/rpm/SOURCES/openstack-cinder-volume.init new file mode 100644 index 000000000..1ca1a8e90 --- /dev/null +++ b/rpm/SOURCES/openstack-cinder-volume.init @@ -0,0 +1,110 @@ +#!/bin/sh +# +# openstack-cinder-volume OpenStack cinder Volume Worker +# +# chkconfig: - 98 02 +# description: Volume Workers interact with iSCSI storage to manage \ +# LVM-based instance volumes. Specific functions include: \ +# * Create Volumes \ +# * Delete Volumes \ +# * Establish Compute volumes + +### BEGIN INIT INFO +# Provides: +# Required-Start: $remote_fs $network $syslog +# Required-Stop: $remote_fs $syslog +# Default-Stop: 0 1 6 +# Short-Description: OpenStack cinder Volume Worker +# Description: Volume Workers interact with iSCSI storage to manage +# LVM-based instance volumes. Specific functions include: +# * Create Volumes +# * Delete Volumes +# * Establish Compute volumes +### END INIT INFO + +. /etc/rc.d/init.d/functions + +suffix=volume +prog=openstack-cinder-$suffix +exec="/usr/bin/cinder-$suffix" +config="/etc/cinder/cinder.conf" +pidfile="/var/run/cinder/cinder-$suffix.pid" +logfile="/var/log/cinder/$suffix.log" + +[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog + +lockfile=/var/lock/subsys/$prog + +start() { + [ -x $exec ] || exit 5 + [ -f $config ] || exit 6 + echo -n $"Starting $prog: " + daemon --user cinder --pidfile $pidfile "$exec --config-file $config --logfile $logfile &>/dev/null & echo \$! > $pidfile" + retval=$? + echo + [ $retval -eq 0 ] && touch $lockfile + return $retval +} + +stop() { + echo -n $"Stopping $prog: " + killproc -p $pidfile $prog + retval=$? + echo + [ $retval -eq 0 ] && rm -f $lockfile + return $retval +} + +restart() { + stop + start +} + +reload() { + restart +} + +force_reload() { + restart +} + +rh_status() { + status -p $pidfile $prog +} + +rh_status_q() { + rh_status >/dev/null 2>&1 +} + + +case "$1" in + start) + rh_status_q && exit 0 + $1 + ;; + stop) + rh_status_q || exit 0 + $1 + ;; + restart) + $1 + ;; + reload) + rh_status_q || exit 7 + $1 + ;; + force-reload) + force_reload + ;; + status) + rh_status + ;; + condrestart|try-restart) + rh_status_q || exit 0 + restart + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" + exit 2 +esac +exit $? diff --git a/rpm/SOURCES/openstack-cinder-volume.upstart b/rpm/SOURCES/openstack-cinder-volume.upstart new file mode 100644 index 000000000..85730c9ef --- /dev/null +++ b/rpm/SOURCES/openstack-cinder-volume.upstart @@ -0,0 +1,8 @@ +description "OpenStack Cinder Volume Server" + +start on stopped rc RUNLEVEL=[2345] +stop on runlevel [S016] + +respawn + +exec su -s /bin/sh -c "exec /usr/bin/cinder-volume --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/volume.log" cinder diff --git a/rpm/SPECS/openstack-cinder.spec b/rpm/SPECS/openstack-cinder.spec new file mode 100644 index 000000000..65e8d85e6 --- /dev/null +++ b/rpm/SPECS/openstack-cinder.spec @@ -0,0 +1,309 @@ +%global with_doc %{!?_without_doc:1}%{?_without_doc:0} + +Name: openstack-cinder +Version: 2013.1 +Release: 0.4.g3%{?dist} +Summary: OpenStack Volume service + +Group: Applications/System +License: ASL 2.0 +URL: http://www.openstack.org/software/openstack-storage/ +Source0: https://launchpad.net/cinder/grizzly/grizzly-3/+download/cinder-2013.1.g3.tar.gz +Source1: cinder.conf +Source2: cinder.logrotate +Source3: cinder-tgt.conf + +Source10: openstack-cinder-api.init +Source100: openstack-cinder-api.upstart +Source11: openstack-cinder-scheduler.init +Source110: openstack-cinder-scheduler.upstart +Source12: openstack-cinder-volume.init +Source120: openstack-cinder-volume.upstart + +Source20: cinder-sudoers + +# +# patches_base=grizzly-3 +# +Patch0001: 0001-Ensure-we-don-t-access-the-net-when-building-docs.patch + +# This is EPEL specific and not upstream +Patch100: openstack-cinder-newdeps.patch + +BuildArch: noarch +BuildRequires: intltool +BuildRequires: python-sphinx10 +BuildRequires: python-setuptools +BuildRequires: python-netaddr +BuildRequires: openstack-utils +# These are required to build due to the requirements check added +BuildRequires: python-paste-deploy1.5 +BuildRequires: python-routes1.12 +BuildRequires: python-sqlalchemy0.7 +BuildRequires: python-webob1.0 + +Requires: openstack-utils +Requires: python-cinder = %{version}-%{release} + +# as convenience +Requires: python-cinderclient + +Requires(post): chkconfig +Requires(postun): initscripts +Requires(preun): chkconfig +Requires(pre): shadow-utils + +Requires: lvm2 +Requires: scsi-target-utils + +%description +OpenStack Volume (codename Cinder) provides services to manage and +access block storage volumes for use by Virtual Machine instances. + + +%package -n python-cinder +Summary: OpenStack Volume Python libraries +Group: Applications/System + +Requires: sudo + +Requires: MySQL-python + +Requires: python-paramiko + +Requires: python-qpid +Requires: python-kombu +Requires: python-amqplib + +Requires: python-eventlet +Requires: python-greenlet +Requires: python-iso8601 +Requires: python-netaddr +Requires: python-lxml +Requires: python-anyjson +Requires: python-cheetah +Requires: python-stevedore + +Requires: python-sqlalchemy0.7 +Requires: python-migrate + +Requires: python-paste-deploy1.5 +Requires: python-routes1.12 +Requires: python-webob1.0 + +Requires: python-glanceclient >= 1:0 + +%description -n python-cinder +OpenStack Volume (codename Cinder) provides services to manage and +access block storage volumes for use by Virtual Machine instances. + +This package contains the cinder Python library. + +%if 0%{?with_doc} +%package doc +Summary: Documentation for OpenStack Volume +Group: Documentation + +Requires: %{name} = %{version}-%{release} + +BuildRequires: graphviz + +# Required to build module documents +BuildRequires: python-eventlet +BuildRequires: python-routes1.12 +BuildRequires: python-sqlalchemy0.7 +BuildRequires: python-webob1.0 +# while not strictly required, quiets the build down when building docs. +BuildRequires: python-migrate, python-iso8601 + +%description doc +OpenStack Volume (codename Cinder) provides services to manage and +access block storage volumes for use by Virtual Machine instances. + +This package contains documentation files for cinder. +%endif + +%prep +%setup -q -n cinder-%{version}.g3 + +%patch0001 -p1 + +# Apply EPEL patch +%patch100 -p1 + +find . \( -name .gitignore -o -name .placeholder \) -delete + +find cinder -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} + + +# TODO: Have the following handle multi line entries +sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py + +%build + +# Move authtoken configuration out of paste.ini +openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_tenant_name +openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_user +openstack-config --del etc/cinder/api-paste.ini filter:authtoken admin_password +openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_host +openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_port +openstack-config --del etc/cinder/api-paste.ini filter:authtoken auth_protocol + +%{__python} setup.py build + +%install +%{__python} setup.py install -O1 --skip-build --root %{buildroot} + +# docs generation requires everything to be installed first +export PYTHONPATH="$( pwd ):$PYTHONPATH" + +pushd doc + +%if 0%{?with_doc} +SPHINX_DEBUG=1 sphinx-1.0-build -b html source build/html +# Fix hidden-file-or-dir warnings +rm -fr build/html/.doctrees build/html/.buildinfo +%endif + +# Create dir link to avoid a sphinx-build exception +mkdir -p build/man/.doctrees/ +ln -s . build/man/.doctrees/man +SPHINX_DEBUG=1 sphinx-1.0-build -b man -c source source/man build/man +mkdir -p %{buildroot}%{_mandir}/man1 +install -p -D -m 644 build/man/*.1 %{buildroot}%{_mandir}/man1/ + +popd + +# Setup directories +install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder +install -d -m 755 %{buildroot}%{_sharedstatedir}/cinder/tmp +install -d -m 755 %{buildroot}%{_localstatedir}/log/cinder + +# Install config files +install -d -m 755 %{buildroot}%{_sysconfdir}/cinder +install -p -D -m 640 %{SOURCE1} %{buildroot}%{_sysconfdir}/cinder/cinder.conf +install -d -m 755 %{buildroot}%{_sysconfdir}/cinder/volumes +install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/tgt/conf.d/cinder.conf +install -p -D -m 640 etc/cinder/rootwrap.conf %{buildroot}%{_sysconfdir}/cinder/rootwrap.conf +install -p -D -m 640 etc/cinder/api-paste.ini %{buildroot}%{_sysconfdir}/cinder/api-paste.ini +install -p -D -m 640 etc/cinder/policy.json %{buildroot}%{_sysconfdir}/cinder/policy.json + +# Install initscripts for services +install -p -D -m 755 %{SOURCE10} %{buildroot}%{_initrddir}/openstack-cinder-api +install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/openstack-cinder-scheduler +install -p -D -m 755 %{SOURCE12} %{buildroot}%{_initrddir}/openstack-cinder-volume + +# Install sudoers +install -p -D -m 440 %{SOURCE20} %{buildroot}%{_sysconfdir}/sudoers.d/cinder + +# Install logrotate +install -p -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/openstack-cinder + +# Install pid directory +install -d -m 755 %{buildroot}%{_localstatedir}/run/cinder + +# Install upstart jobs examples +install -d -m 755 %{buildroot}%{_datadir}/cinder +install -p -m 644 %{SOURCE100} %{buildroot}%{_datadir}/cinder/ +install -p -m 644 %{SOURCE110} %{buildroot}%{_datadir}/cinder/ +install -p -m 644 %{SOURCE120} %{buildroot}%{_datadir}/cinder/ + +# Install rootwrap files in /usr/share/cinder/rootwrap +mkdir -p %{buildroot}%{_datarootdir}/cinder/rootwrap/ +install -p -D -m 644 etc/cinder/rootwrap.d/* %{buildroot}%{_datarootdir}/cinder/rootwrap/ + +# Remove unneeded in production stuff +rm -f %{buildroot}%{_bindir}/cinder-debug +rm -fr %{buildroot}%{python_sitelib}/cinder/tests/ +rm -fr %{buildroot}%{python_sitelib}/run_tests.* +rm -f %{buildroot}/usr/share/doc/cinder/README* + +%pre +getent group cinder >/dev/null || groupadd -r cinder --gid 165 +if ! getent passwd cinder >/dev/null; then + useradd -u 165 -r -g cinder -G cinder,nobody -d %{_sharedstatedir}/cinder -s /sbin/nologin -c "OpenStack Cinder Daemons" cinder +fi +exit 0 + +%post +if [ $1 -eq 1 ] ; then + # Initial installation + for svc in volume api scheduler; do + /sbin/chkconfig --add openstack-cinder-$svc + done +fi + +%preun +if [ $1 -eq 0 ] ; then + for svc in volume api scheduler; do + /sbin/service openstack-cinder-${svc} stop > /dev/null 2>&1 + /sbin/chkconfig --del openstack-cinder-${svc} + done +fi + +%postun +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + for svc in volume api scheduler; do + /sbin/service openstack-cinder-${svc} condrestart > /dev/null 2>&1 || : + done +fi + +%files +%doc LICENSE + +%dir %{_sysconfdir}/cinder +%config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/cinder.conf +%config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/api-paste.ini +%config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/rootwrap.conf +%config(noreplace) %attr(-, root, cinder) %{_sysconfdir}/cinder/policy.json +%config(noreplace) %{_sysconfdir}/logrotate.d/openstack-cinder +%config(noreplace) %{_sysconfdir}/sudoers.d/cinder +%config(noreplace) %{_sysconfdir}/tgt/conf.d/cinder.conf + +%dir %attr(0755, cinder, root) %{_localstatedir}/log/cinder +%dir %attr(0755, cinder, root) %{_localstatedir}/run/cinder +%dir %attr(0755, cinder, root) %{_sysconfdir}/cinder/volumes + +%{_bindir}/cinder-* +%{_initrddir}/openstack-cinder-* +%{_datarootdir}/cinder +%{_mandir}/man1/cinder*.1.gz + +%defattr(-, cinder, cinder, -) +%dir %{_sharedstatedir}/cinder +%dir %{_sharedstatedir}/cinder/tmp + +%files -n python-cinder +%doc LICENSE +%{python_sitelib}/cinder +%{python_sitelib}/cinder-%{version}*.egg-info + +%if 0%{?with_doc} +%files doc +%doc doc/build/html +%endif + +%changelog +* Tue Mar 05 2013 Pádraig Brady - 2013.1.0.4.g3 +- Add dependency on python-stevedore + +* Wed Feb 27 2013 Eric Harney - 2013.1-0.2.g3 +- Update to Grizzly milestone 3 + +* Thu Jan 10 2013 Eric Harney - 2013.1-0.1.g2 +- Update to Grizzly milestone 2 + +* Thu Dec 20 2012 Eric Harney - 2013.1-0.1.g1 +- Update to Grizzly milestone 1 + +* Mon Dec 03 2012 Eric Harney - 2012.2.1-1 +- Update to Folsom stable release 1 + +* Wed Nov 14 2012 Eric Harney - 2012.2-4 +- Remove unused dependency on python-daemon + +* Wed Oct 31 2012 Pádraig Brady - 2012.2-3 +- Adjust to be compatible with python-migrate-0.6 + +* Wed Oct 24 2012 Pádraig Brady - 2012.2-2 +- Initial Folsom release -- 2.45.2