From 21d1032b5e1b97962391a92eba80971f23ec474e Mon Sep 17 00:00:00 2001 From: Andrey Brindeyev Date: Thu, 2 Dec 2010 03:13:06 -0800 Subject: [PATCH] Added specfiles --- openstack-nova-cc-config.spec | 75 +++++++ openstack-nova.spec | 412 ++++++++++++++++++++++++++++++++++ rebuild_nova.sh | 33 +++ 3 files changed, 520 insertions(+) create mode 100644 openstack-nova-cc-config.spec create mode 100644 openstack-nova.spec create mode 100755 rebuild_nova.sh diff --git a/openstack-nova-cc-config.spec b/openstack-nova-cc-config.spec new file mode 100644 index 0000000..e4bf768 --- /dev/null +++ b/openstack-nova-cc-config.spec @@ -0,0 +1,75 @@ +Name: openstack-nova-cc-config +Version: 2011.1 +Release: 4 +Summary: OpenStack Compute (nova) - Cloud Controller config + +Group: Development/Languages +License: ASL 2.0 +URL: http://openstack.org/projects/compute/ +Source1: %{name}-api.conf +Source3: %{name}-compute.conf +Source5: %{name}-dhcpbridge.conf +Source7: %{name}-manage.conf +Source8: %{name}-network.conf +Source10: %{name}-objectstore.conf +Source12: %{name}-scheduler.conf +Source14: %{name}-volume.conf +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildArch: noarch + +Requires: openstack-nova = %{version} +Provides: openstack-nova-config = %{version} + +%description +Configuration files for Nova as Cloud Controller. + +%prep +#setup -q -n nova-%{version} + +%build +#{__python} setup.py build + +%install +rm -rf %{buildroot} + +# Setup directories +install -d -m 755 %{buildroot}%{_sysconfdir}/nova + +# Install config files +install -p -D -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/nova/nova-api.conf +install -p -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/nova/nova-compute.conf +install -p -D -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/nova/nova-dhcpbridge.conf +install -p -D -m 644 %{SOURCE7} %{buildroot}%{_sysconfdir}/nova/nova-manage.conf +install -p -D -m 644 %{SOURCE8} %{buildroot}%{_sysconfdir}/nova/nova-network.conf +install -p -D -m 644 %{SOURCE10} %{buildroot}%{_sysconfdir}/nova/nova-objectstore.conf +install -p -D -m 644 %{SOURCE12} %{buildroot}%{_sysconfdir}/nova/nova-scheduler.conf +install -p -D -m 644 %{SOURCE14} %{buildroot}%{_sysconfdir}/nova/nova-volume.conf + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root,-) +%config(noreplace) %{_sysconfdir}/nova/nova-api.conf +%config(noreplace) %{_sysconfdir}/nova/nova-compute.conf +%config(noreplace) %{_sysconfdir}/nova/nova-dhcpbridge.conf +%config(noreplace) %{_sysconfdir}/nova/nova-manage.conf +%config(noreplace) %{_sysconfdir}/nova/nova-network.conf +%config(noreplace) %{_sysconfdir}/nova/nova-objectstore.conf +%config(noreplace) %{_sysconfdir}/nova/nova-scheduler.conf +%config(noreplace) %{_sysconfdir}/nova/nova-volume.conf + +%changelog +* Wed Dec 01 2010 Andrey Brindeyev - 2011.1-4 +- Added missed --cc_host parameter + +* Wed Dec 01 2010 Andrey Brindeyev - 2011.1-3 +- Changed configs to multiple server setup in accordance with Wiki page: + http://wiki.openstack.org/NovaInstall/MultipleServer + +* Wed Dec 01 2010 Andrey Brindeyev - 2011.1-2 +- Added version to Provides + +* Wed Dec 01 2010 Andrey Brindeyev - 2011.1-1 +- Initial build diff --git a/openstack-nova.spec b/openstack-nova.spec new file mode 100644 index 0000000..35f2583 --- /dev/null +++ b/openstack-nova.spec @@ -0,0 +1,412 @@ +%global with_doc 1 + +%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5) +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")} +%endif + +Name: openstack-nova +Version: 2011.1 +Release: bzr435 +Summary: OpenStack Compute (nova) + +Group: Development/Languages +License: ASL 2.0 +URL: http://openstack.org/projects/compute/ +Source0: http://nova.openstack.org/tarballs/nova-%{version}~%{release}.tar.gz +Source2: %{name}-api.init +Source4: %{name}-compute.init +Source6: %{name}.logrotate +Source9: %{name}-network.init +Source11: %{name}-objectstore.init +Source13: %{name}-scheduler.init +Source15: %{name}-volume.init +Source20: %{name}-sudoers +BuildRoot: %{_tmppath}/nova-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildArch: noarch +BuildRequires: python-devel +BuildRequires: python-setuptools + +Requires: python-nova = %{version}-%{release} +Requires: openstack-nova-config = %{version} +Requires: sudo + +Requires(post): chkconfig +Requires(postun): initscripts +Requires(preun): chkconfig +Requires(pre): shadow-utils + +%description +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +Nova is intended to be easy to extend, and adapt. For example, it currently +uses an LDAP server for users and groups, but also includes a fake LDAP server, +that stores data in Redis. It has extensive test coverage, and uses the Sphinx +toolkit (the same as Python itself) for code and user documentation. + +%package -n python-nova +Summary: Nova Python libraries +Group: Applications/System + +Requires: PyXML +Requires: curl +Requires: m2crypto +Requires: libvirt-python +Requires: python-anyjson >= 0.2.4 +Requires: python-IPy >= 0.70 +Requires: python-boto >= 1.9b +Requires: python-carrot >= 0.10.5 +Requires: python-daemon >= 1.5.5 +Requires: python-eventlet >= 0.9.12 +Requires: python-gflags >= 1.3 +Requires: python-lockfile = 0.8 +Requires: python-mox >= 0.5.0 +Requires: python-redis +Requires: python-routes +Requires: python-sqlalchemy >= 0.6 +Requires: python-tornado +Requires: python-twisted-core +Requires: python-twisted-web +Requires: python-webob = 0.9.8 + +%description -n python-nova +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains the %{name} Python library. + +%package api +Summary: A nova api server +Group: Applications/System + +Requires: %{name} = %{version}-%{release} + +%description api +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains the %{name} api server. + +%package compute +Summary: A nova compute server +Group: Applications/System + +Requires: %{name} = %{version}-%{release} +Requires: libvirt-python +Requires: libxml2-python +Requires: rabbitmq-server + +%description compute +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains the %{name} compute server. + +%package instancemonitor +Summary: A nova instancemonitor server +Group: Applications/System + +Requires: %{name} = %{version}-%{release} + +%description instancemonitor +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains the %{name} instance monitor. + +%package network +Summary: A nova network server +Group: Applications/System + +Requires: %{name} = %{version}-%{release} + +%description network +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains the %{name} network server. + +%package objectstore +Summary: A nova objectstore server +Group: Applications/System + +Requires: %{name} = %{version}-%{release} + +%description objectstore +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains the %{name} object store server. + +%package scheduler +Summary: A nova scheduler server +Group: Applications/System + +Requires: %{name} = %{version}-%{release} + +%description scheduler +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains the %{name} scheduler server. + +%package volume +Summary: A nova volume server +Group: Applications/System + +Requires: %{name} = %{version}-%{release} + +%description volume +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains the %{name} volume server. + +%if 0%{?with_doc} +%package doc +Summary: Documentation for %{name} +Group: Documentation + +BuildRequires: python-sphinx +BuildRequires: python-nose +# Required to build module documents +BuildRequires: python-IPy +BuildRequires: python-boto +#BuildRequires: python-carrot +BuildRequires: python-daemon +BuildRequires: python-eventlet +BuildRequires: python-gflags +#BuildRequires: python-mox +#BuildRequires: python-redis +BuildRequires: python-routes +BuildRequires: python-sqlalchemy +BuildRequires: python-tornado +BuildRequires: python-twisted-core +BuildRequires: python-twisted-web +BuildRequires: python-webob + +%description doc +Nova is a cloud computing fabric controller (the main part of an IaaS system) +built to match the popular AWS EC2 and S3 APIs. It is written in Python, using +the Tornado and Twisted frameworks, and relies on the standard AMQP messaging +protocol, and the Redis KVS. + +This package contains documentation files for %{name}. +%endif + +%prep +%setup -q -n nova-%{version} + +%build +%{__python} setup.py build + +%install +rm -rf %{buildroot} +%{__python} setup.py install -O1 --skip-build --root %{buildroot} + +%if 0%{?with_doc} +export PYTHONPATH="$( pwd ):$PYTHONPATH" +pushd doc +sphinx-build -b html source build/html +popd + +# Fix hidden-file-or-dir warnings +rm -fr doc/build/html/.doctrees doc/build/html/.buildinfo +%endif + +# Setup directories +install -d -m 755 %{buildroot}%{_sharedstatedir}/nova +install -d -m 755 %{buildroot}%{_sharedstatedir}/nova/images +install -d -m 755 %{buildroot}%{_sharedstatedir}/nova/instances +install -d -m 755 %{buildroot}%{_sharedstatedir}/nova/keys +install -d -m 755 %{buildroot}%{_sharedstatedir}/nova/networks +install -d -m 755 %{buildroot}%{_sharedstatedir}/nova/tmp +install -d -m 755 %{buildroot}%{_localstatedir}/log/nova +cp -rp CA %{buildroot}%{_sharedstatedir}/nova + +# Install init files +install -p -D -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}-api +install -p -D -m 755 %{SOURCE4} %{buildroot}%{_initrddir}/%{name}-compute +install -p -D -m 755 %{SOURCE9} %{buildroot}%{_initrddir}/%{name}-network +install -p -D -m 755 %{SOURCE11} %{buildroot}%{_initrddir}/%{name}-objectstore +install -p -D -m 755 %{SOURCE13} %{buildroot}%{_initrddir}/%{name}-scheduler +install -p -D -m 755 %{SOURCE15} %{buildroot}%{_initrddir}/%{name}-volume + +# Install sudoers +install -p -D -m 440 %{SOURCE20} %{buildroot}%{_sysconfdir}/sudoers.d/%{name} + +# Install logrotate +install -p -D -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} + +# Install pid directory +install -d -m 755 %{buildroot}%{_localstatedir}/run/nova + +# Install template files +install -p -D -m 644 nova/auth/novarc.template %{buildroot}%{_datarootdir}/nova/novarc.template +install -p -D -m 644 nova/cloudpipe/client.ovpn.template %{buildroot}%{_datarootdir}/nova/client.ovpn.template +install -p -D -m 644 nova/virt/libvirt.qemu.xml.template %{buildroot}%{_datarootdir}/nova/libvirt.qemu.xml.template +install -p -D -m 644 nova/virt/libvirt.xen.xml.template %{buildroot}%{_datarootdir}/nova/libvirt.xen.xml.template +install -p -D -m 644 nova/virt/libvirt.uml.xml.template %{buildroot}%{_datarootdir}/nova/libvirt.uml.xml.template +install -p -D -m 644 nova/virt/libvirt.rescue.qemu.xml.template %{buildroot}%{_datarootdir}/nova/libvirt.rescue.qemu.xml.template +install -p -D -m 644 nova/virt/libvirt.rescue.xen.xml.template %{buildroot}%{_datarootdir}/nova/libvirt.rescue.xen.xml.template +install -p -D -m 644 nova/virt/libvirt.rescue.uml.xml.template %{buildroot}%{_datarootdir}/nova/libvirt.rescue.uml.xml.template +install -p -D -m 644 nova/virt/interfaces.template %{buildroot}%{_datarootdir}/nova/interfaces.template + +# Clean CA directory +find %{buildroot}%{_sharedstatedir}/nova/CA -name .gitignore -delete +find %{buildroot}%{_sharedstatedir}/nova/CA -name .placeholder -delete + +%clean +rm -rf %{buildroot} + +%pre +getent group nova >/dev/null || groupadd -r nova +getent passwd nova >/dev/null || \ +useradd -r -g nova -d %{_sharedstatedir}/nova -s /sbin/nologin \ +-c "OpenStack Nova Daemons" nova +exit 0 + +%post api +/sbin/chkconfig --add openstack-nova-api + +%preun api +if [ $1 = 0 ] ; then + /sbin/service openstack-nova-api stop >/dev/null 2>&1 + /sbin/chkconfig --del openstack-nova-api +fi + +%post compute +/sbin/chkconfig --add openstack-nova-compute + +%preun compute +if [ $1 = 0 ] ; then + /sbin/service openstack-nova-compute stop >/dev/null 2>&1 + /sbin/chkconfig --del openstack-nova-compute +fi + +%post network +/sbin/chkconfig --add openstack-nova-network + +%preun network +if [ $1 = 0 ] ; then + /sbin/service openstack-nova-network stop >/dev/null 2>&1 + /sbin/chkconfig --del openstack-nova-network +fi + +%post objectstore +/sbin/chkconfig --add openstack-nova-objectstore + +%preun objectstore +if [ $1 = 0 ] ; then + /sbin/service openstack-nova-objectstore stop >/dev/null 2>&1 + /sbin/chkconfig --del openstack-nova-objectstore +fi + +%post scheduler +/sbin/chkconfig --add openstack-nova-scheduler + +%preun scheduler +if [ $1 = 0 ] ; then + /sbin/service openstack-nova-scheduler stop >/dev/null 2>&1 + /sbin/chkconfig --del openstack-nova-scheduler +fi + +%post volume +/sbin/chkconfig --add openstack-nova-volume + +%preun volume +if [ $1 = 0 ] ; then + /sbin/service openstack-nova-volume stop >/dev/null 2>&1 + /sbin/chkconfig --del openstack-nova-volume +fi + +%files +%defattr(-,root,root,-) +%doc README +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/sudoers.d/%{name} +%dir %attr(0755, nova, root) %{_localstatedir}/log/nova +%dir %attr(0755, nova, root) %{_localstatedir}/run/nova +%{_bindir}/nova-manage +%{_datarootdir}/nova +%defattr(-,nova,nobody,-) +%{_sharedstatedir}/nova + +%files -n python-nova +%defattr(-,root,root,-) +%doc LICENSE +%{python_sitelib}/nova +%{python_sitelib}/nova-%{version}-*.egg-info + +%files api +%defattr(-,root,root,-) +%{_initrddir}/%{name}-api +%{_bindir}/nova-api + +%files compute +%defattr(-,root,root,-) +%{_bindir}/nova-compute +%{_bindir}/nova-debug +%{_initrddir}/%{name}-compute + +%files instancemonitor +%defattr(-,root,root,-) +%{_bindir}/nova-instancemonitor + +%files network +%defattr(-,root,root,-) +%{_bindir}/nova-network +%{_bindir}/nova-dhcpbridge +%{_initrddir}/%{name}-network + +%files objectstore +%defattr(-,root,root,-) +%{_bindir}/nova-import-canonical-imagestore +%{_bindir}/nova-objectstore +%{_initrddir}/%{name}-objectstore + +%files scheduler +%defattr(-,root,root,-) +%{_bindir}/nova-scheduler +%{_initrddir}/%{name}-scheduler + +%files volume +%defattr(-,root,root,-) +%{_bindir}/nova-volume +%{_initrddir}/%{name}-volume + +%if 0%{?with_doc} +%files doc +%defattr(-,root,root,-) +%doc LICENSE doc/build/html +%endif + +%changelog +* Wed Dec 01 2010 Andrey Brindeyev - 2011.1-bzr435 +- Moved config files to separate package openstack-nova-cc-config for easy + package-based deployment + +* Thu Nov 04 2010 Silas Sewell - 2010.1-2 +- Fix various issues (init, permissions, config, etc..) + +* Thu Oct 21 2010 Silas Sewell - 2010.1-1 +- Initial build diff --git a/rebuild_nova.sh b/rebuild_nova.sh new file mode 100755 index 0000000..471235e --- /dev/null +++ b/rebuild_nova.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +NOVAVER="2011.1" + +if [ $1 ]; then + BUILD=$1 +else + echo "Specify build to package it" + exit -1 +fi + +REPOPATH="/var/www/html/openstack-nova" +RPMSANDBOX="$HOME/rpmbuild/" +SRCFILE="nova-$NOVAVER~bzr$BUILD.tar.gz" +RPMSRC="$RPMSANDBOX/SOURCES/$SRCFILE" +TARBALLURL="http://nova.openstack.org/tarballs/$SRCFILE" + +NOVASPEC="$RPMSANDBOX/SPECS/openstack-nova.spec" + +if [ ! -f "$RPMSRC" ]; then + wget -O "$RPMSRC" "$TARBALLURL" +fi + +perl -pi -e "s/bzr(\d+)/bzr$BUILD/" "$NOVASPEC" +rm -f "$RPMSANDBOX/RPMS/*/*bzr$BUILD*.rpm" +rpmbuild -bb $NOVASPEC + +#if [ -f "$RPMSANDBOX/RPMS/noarch/python-nova*bzr$BUILD*.rpm" ]; then + rm -fr $REPOPATH/*bzr*.rpm + mv $RPMSANDBOX/RPMS/noarch/*bzr$BUILD*.rpm "$REPOPATH" + createrepo "$REPOPATH" +#fi +