From ad20476a8c0c7ecbac19a3b5316c67adb289f2bf Mon Sep 17 00:00:00 2001 From: Angie Wang Date: Mon, 9 Jul 2018 10:05:16 -0400 Subject: [PATCH] Intergrate gnocchi storage backend Changes included in the patch: - Add missing init files - Update MANIFEST.in to include non-python files - Add the ability to launch gnocchi api with gunicorn Story: 2002825 Task: 22871 Change-Id: Iad1ed6e4d6cd4c4debfd8ed7845d4de69af3ea14 Signed-off-by: Jack Ding --- .../python-gnocchi/centos/build_srpm.data | 11 +++-- .../centos/openstack-gnocchi.spec | 16 +++++-- .../Integrate-gnocchi-storage-backend.patch | 47 +++++++++++++++++++ 3 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 openstack/python-gnocchi/centos/patches/Integrate-gnocchi-storage-backend.patch diff --git a/openstack/python-gnocchi/centos/build_srpm.data b/openstack/python-gnocchi/centos/build_srpm.data index 1dc004a3..11d172e0 100644 --- a/openstack/python-gnocchi/centos/build_srpm.data +++ b/openstack/python-gnocchi/centos/build_srpm.data @@ -1,4 +1,7 @@ -SRC_DIR="$CGCS_BASE/git/gnocchi" -COPY_LIST="$FILES_BASE/* $FILES_BASE/scripts/*" -TIS_BASE_SRCREV=60e608f70c8e13b17973809e84ec4d00c845da56 -TIS_PATCH_VER=GITREVCOUNT +VERSION=4.2.5 +TAR_NAME=gnocchi +COPY_LIST="$FILES_BASE/* \ + $FILES_BASE/scripts/* \ + $DISTRO/patches/* \ + $CGCS_BASE/downloads/$TAR_NAME-$VERSION.tar.gz" +TIS_PATCH_VER=1 diff --git a/openstack/python-gnocchi/centos/openstack-gnocchi.spec b/openstack/python-gnocchi/centos/openstack-gnocchi.spec index fded6928..0a49b5e6 100644 --- a/openstack/python-gnocchi/centos/openstack-gnocchi.spec +++ b/openstack/python-gnocchi/centos/openstack-gnocchi.spec @@ -5,7 +5,7 @@ %{!?upstream_version: %global upstream_version %{version}%{?milestone}} Name: %{service} -Version: 4.2.4 +Version: 4.2.5 Release: 1%{?_tis_dist}.%{tis_patch_ver} Summary: Gnocchi is a API to store metrics and index resources @@ -19,6 +19,9 @@ Source12: %{name}-statsd.service # WRS Source13: gnocchi-api.init Source14: gnocchi-metricd.init +# Include patches here +Patch1: Integrate-gnocchi-storage-backend.patch + BuildArch: noarch BuildRequires: python2-setuptools @@ -203,12 +206,16 @@ This package contains documentation files for %{service}. %prep %setup -q -n %{service}-%{upstream_version} +# Apply patches here +%patch1 -p1 + find . \( -name .gitignore -o -name .placeholder \) -delete find %{service} -name \*.py -exec sed -i '/\/usr\/bin\/env python/{d;q}' {} + sed -i '/setup_requires/d; /install_requires/d; /dependency_links/d' setup.py -%py_req_cleanup - +# Remove the requirements file so that pbr hooks don't add it +# to distutils requires_dist config +rm -rf {test-,}requirements.txt tools/{pip,test}-requires %build # Generate config file @@ -236,7 +243,7 @@ mkdir -p %{buildroot}/%{_sysconfdir}/%{service}/ mkdir -p %{buildroot}/%{_var}/log/%{name} # WRS mkdir -p %{buildroot}%{_sysconfdir}/init.d -install -p -D -m 640 %{service}/rest/%{service}-api.py %{buildroot}%{_datadir}/%{service}/%{service}-api.py +install -p -D -m 640 %{service}/rest/wsgi.py %{buildroot}%{_datadir}/%{service}/%{service}-api.py install -p -D -m 775 %{SOURCE13} %{buildroot}%{_sysconfdir}/init.d/gnocchi-api install -p -D -m 775 %{SOURCE14} %{buildroot}%{_sysconfdir}/init.d/gnocchi-metricd @@ -293,7 +300,6 @@ exit 0 %{_bindir}/%{service}-config-generator %{_bindir}/%{service}-change-sack-size %{_bindir}/%{service}-upgrade -%{_bindir}/%{service}-injector %dir %{_sysconfdir}/%{service} %{_datadir}/%{service}/%{service}-api.* %attr(-, root, %{service}) %{_datadir}/%{service}/%{service}-dist.conf diff --git a/openstack/python-gnocchi/centos/patches/Integrate-gnocchi-storage-backend.patch b/openstack/python-gnocchi/centos/patches/Integrate-gnocchi-storage-backend.patch new file mode 100644 index 00000000..09b5c994 --- /dev/null +++ b/openstack/python-gnocchi/centos/patches/Integrate-gnocchi-storage-backend.patch @@ -0,0 +1,47 @@ +From f56612a5d784e8f7de384f0e9b623adf50953ee6 Mon Sep 17 00:00:00 2001 +From: Angie Wang +Date: Mon, 9 Jul 2018 10:02:07 -0400 +Subject: [PATCH] Integrate gnocchi storage backend + +--- + MANIFEST.in | 2 ++ + gnocchi/indexer/alembic/__init__.py | 0 + gnocchi/indexer/alembic/versions/__init__.py | 0 + gnocchi/rest/wsgi.py | 5 ++++- + 4 files changed, 6 insertions(+), 1 deletion(-) + create mode 100644 gnocchi/indexer/alembic/__init__.py + create mode 100644 gnocchi/indexer/alembic/versions/__init__.py + +diff --git a/MANIFEST.in b/MANIFEST.in +index 8f248e6..df1afd3 100644 +--- a/MANIFEST.in ++++ b/MANIFEST.in +@@ -1 +1,3 @@ + include etc/gnocchi/gnocchi.conf ++ ++recursive-include gnocchi *.ini *.json *.xml *.cfg *.pem README *.po *.mo *.sql +diff --git a/gnocchi/indexer/alembic/__init__.py b/gnocchi/indexer/alembic/__init__.py +new file mode 100644 +index 0000000..e69de29 +diff --git a/gnocchi/indexer/alembic/versions/__init__.py b/gnocchi/indexer/alembic/versions/__init__.py +new file mode 100644 +index 0000000..e69de29 +diff --git a/gnocchi/rest/wsgi.py b/gnocchi/rest/wsgi.py +index 0ebe753..6bccf48 100644 +--- a/gnocchi/rest/wsgi.py ++++ b/gnocchi/rest/wsgi.py +@@ -10,7 +10,10 @@ + # implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-"""This file is loaded by gnocchi-api when executing uwsgi""" ++"""This file is loaded by gnocchi-api when executing uwsgi/gunicorn""" + from gnocchi.cli import api + from gnocchi.rest import app ++import sys ++ ++sys.argv = sys.argv[:1] + application = app.load_app(api.prepare_service()) +-- +1.8.3.1 +