Integrate gnocchi for OpenStack Telemetry

Add python-gnocchi and python-gnocchiclient.
Update in python-openstackclient:
 Remove the support of celiometer CLI extensions.
Update in python-ceilometer:
 Install ceilometer publisher instead of dispatcher.

Story: 2002825
Task: 22871
Depends-On: https://review.openstack.org/587279

Change-Id: I3b0dde2c8668f7e623bcf128a13010b26667d802
Signed-off-by: Don Penney <don.penney@windriver.com>
Signed-off-by: Jack Ding <jack.ding@windriver.com>
This commit is contained in:
Angie Wang 2018-06-13 01:21:21 -04:00 committed by Jack Ding
parent 1a7e61ed51
commit 71aaf7b58c
18 changed files with 850 additions and 492 deletions

View File

@ -19,6 +19,8 @@ openstack/python-cinderclient
openstack/python-glance
openstack/python-glance-store
openstack/python-glanceclient
openstack/python-gnocchi
openstack/python-gnocchiclient
openstack/python-heat/openstack-heat
openstack/python-heat/wrs-heat-template
openstack/python-heatclient

View File

@ -445,7 +445,7 @@ install -p -D -m 640 ceilometer/pipeline/data/event_definitions.yaml %{buildroot
install -p -D -m 640 etc/ceilometer/api_paste.ini %{buildroot}%{_sysconfdir}/ceilometer/api_paste.ini
install -p -D -m 640 etc/ceilometer/rootwrap.conf %{buildroot}%{_sysconfdir}/ceilometer/rootwrap.conf
install -p -D -m 640 etc/ceilometer/rootwrap.d/ipmi.filters %{buildroot}/%{_sysconfdir}/ceilometer/rootwrap.d/ipmi.filters
install -p -D -m 640 ceilometer/dispatcher/data/gnocchi_resources.yaml %{buildroot}%{_sysconfdir}/ceilometer/gnocchi_resources.yaml
install -p -D -m 640 ceilometer/publisher/data/gnocchi_resources.yaml %{buildroot}%{_sysconfdir}/ceilometer/gnocchi_resources.yaml
install -p -D -m 640 ceilometer/data/meters.d/meters.yaml %{buildroot}%{_sysconfdir}/ceilometer/meters.d/meters.yaml
# WRS
install -p -D -m 640 etc/ceilometer/controller.yaml %{buildroot}%{_sysconfdir}/ceilometer/controller.yaml

View File

@ -0,0 +1,4 @@
SRC_DIR="$CGCS_BASE/git/gnocchi"
COPY_LIST="$FILES_BASE/* $FILES_BASE/scripts/*"
TIS_BASE_SRCREV=60e608f70c8e13b17973809e84ec4d00c845da56
TIS_PATCH_VER=GITREVCOUNT

View File

@ -0,0 +1,12 @@
[Unit]
Description=Gnocchi API service
After=syslog.target network.target
[Service]
Type=simple
User=root
ExecStart=/bin/python /usr/bin/gunicorn --config /usr/share/gnocchi/gnocchi-api.conf --pythonpath /usr/share/gnocchi gnocchi-api --log-file /var/log/gnocchi/api.log
#Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,4 @@
[DEFAULT]
#log_dir = /var/log/gnocchi
use_stderr = False

View File

@ -0,0 +1,12 @@
[Unit]
Description=Gnocchi metricd service
After=syslog.target network.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/gnocchi-metricd --log-file /var/log/gnocchi/metricd.log
#Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=Gnocchi statsd service
After=syslog.target network.target
[Service]
Type=simple
User=gnocchi
ExecStart=/usr/bin/gnocchi-statsd --log-file /var/log/gnocchi/statsd.log
Restart=on-failure
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
compress
/var/log/gnocchi/*.log {
weekly
rotate 4
size 10M
missingok
compress
minsize 100k
}

View File

@ -0,0 +1,109 @@
#!/bin/sh
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# The right to copy, distribute, modify, or otherwise make use
# of this software may be licensed only pursuant to the terms
# of an applicable Wind River license agreement.
#
### BEGIN INIT INFO
# Provides: Gnocchi API
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Gnocchi REST API daemon
### END INIT INFO
RETVAL=0
DESC="gnocchi-api"
PIDFILE="/var/run/$DESC.pid"
PYTHON=`which python`
EXEC="/usr/bin/gunicorn"
CONFIGFILE="/usr/share/gnocchi/gnocchi-api.conf"
LOGFILE="/var/log/gnocchi/api.log"
start()
{
if [ -e $PIDFILE ]; then
PIDDIR=/proc/$(cat $PIDFILE)
if [ -d ${PIDDIR} ]; then
echo "$DESC already running."
return
else
echo "Removing stale PID file $PIDFILE"
rm -f $PIDFILE
fi
fi
echo -n "Starting $DESC..."
start-stop-daemon --start --quiet --background --pidfile ${PIDFILE} \
--make-pidfile --exec ${PYTHON} -- ${EXEC} --config ${CONFIGFILE} \
--pythonpath '/usr/share/gnocchi' gnocchi-api --log-file ${LOGFILE}
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Gnocchi API started."
else
echo "Gnocchi API start failed."
fi
}
stop()
{
if [ ! -e $PIDFILE ]; then
echo "Gnocchi API already stopped."
return
fi
echo -n "Stopping $DESC..."
start-stop-daemon --stop --quiet --pidfile $PIDFILE
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Gnocchi API stopped."
else
echo "Gnocchi API stop failed."
fi
rm -f $PIDFILE
}
status()
{
pid=`cat $PIDFILE 2>/dev/null`
if [ -n "$pid" ]; then
if ps -p $pid &> /dev/null ; then
echo "$DESC is running"
RETVAL=0
return
else
echo "$DESC is not running but has pid file"
RETVAL=1
fi
fi
echo "$DESC is not running"
RETVAL=3
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload|reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|force-reload|restart|reload|status}"
RETVAL=1
;;
esac
exit $RETVAL

View File

@ -0,0 +1,108 @@
#!/bin/sh
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# The right to copy, distribute, modify, or otherwise make use
# of this software may be licensed only pursuant to the terms
# of an applicable Wind River license agreement.
#
### BEGIN INIT INFO
# Provides: Gnocchi metricd
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Gnocchi metricd service
### END INIT INFO
RETVAL=0
DESC="gnocchi-metricd"
DAEMON="/usr/bin/gnocchi-metricd"
PIDFILE="/var/run/$DESC.pid"
CONFIGFILE="/etc/gnocchi/gnocchi.conf"
LOGFILE="/var/log/gnocchi/metricd.log"
start()
{
if [ -e $PIDFILE ]; then
PIDDIR=/proc/$(cat $PIDFILE)
if [ -d ${PIDDIR} ]; then
echo "$DESC already running."
return
else
echo "Removing stale PID file $PIDFILE"
rm -f $PIDFILE
fi
fi
echo -n "Starting $DESC..."
start-stop-daemon --start --quiet --background --pidfile ${PIDFILE} \
--make-pidfile --exec ${DAEMON} -- --config-file ${CONFIGFILE} \
--log-file ${LOGFILE}
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Gnocchi metricd started."
else
echo "Gnocchi metricd start failed."
fi
}
stop()
{
if [ ! -e $PIDFILE ]; then
echo "Gnocchi metricd already stopped."
return
fi
echo -n "Stopping $DESC..."
start-stop-daemon --stop --quiet --pidfile $PIDFILE
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo "Gnocchi metricd stopped."
else
echo "Gnocchi metricd stop failed."
fi
rm -f $PIDFILE
}
status()
{
pid=`cat $PIDFILE 2>/dev/null`
if [ -n "$pid" ]; then
if ps -p $pid &> /dev/null ; then
echo "$DESC is running"
RETVAL=0
return
else
echo "$DESC is not running but has pid file"
RETVAL=1
fi
fi
echo "$DESC is not running"
RETVAL=3
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload|reload)
stop
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|force-reload|restart|reload|status}"
RETVAL=1
;;
esac
exit $RETVAL

View File

@ -0,0 +1,329 @@
%global pypi_name gnocchi
%global with_doc %{!?_without_doc:1}%{?_without_doc:0}
%global service gnocchi
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
Name: %{service}
Version: 4.2.4
Release: 1%{?_tis_dist}.%{tis_patch_ver}
Summary: Gnocchi is a API to store metrics and index resources
License: ASL 2.0
URL: http://github.com/gnocchixyz/%{service}
Source0: https://pypi.io/packages/source/g/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
Source1: %{pypi_name}-dist.conf
Source10: %{name}-api.service
Source11: %{name}-metricd.service
Source12: %{name}-statsd.service
# WRS
Source13: gnocchi-api.init
Source14: gnocchi-metricd.init
BuildArch: noarch
BuildRequires: python2-setuptools
BuildRequires: python2-sphinx
BuildRequires: python2-pbr
BuildRequires: python2-devel
BuildRequires: systemd
BuildRequires: python2-tenacity >= 4.0.0
BuildRequires: openstack-macros
%description
HTTP API to store metrics and index resources.
%package -n python-%{service}
Summary: %{service} python libraries
Requires: numpy >= 1.9.0
Requires: python2-daiquiri
Requires: python-futures
Requires: python2-iso8601
Requires: python2-jinja2
Requires: python2-keystonemiddleware >= 4.0.0
Requires: python2-lz4 >= 0.9.0
Requires: python-monotonic
Requires: python-msgpack
Requires: python2-oslo-config >= 2:3.22.0
Requires: python2-oslo-db >= 4.17.0
Requires: python2-oslo-log >= 2.3.0
Requires: python2-oslo-middleware >= 3.22.0
Requires: python2-oslo-policy >= 0.3.0
Requires: python2-oslo-sphinx >= 2.2.0
Requires: python2-oslo-serialization >= 1.4.0
Requires: python2-pandas >= 0.18.0
Requires: python-paste
Requires: python-paste-deploy
Requires: python2-pbr
Requires: python2-pecan >= 0.9
Requires: python-pytimeparse >= 1.1.5
Requires: python2-requests
Requires: python2-scipy
Requires: python2-swiftclient >= 3.1.0
Requires: python2-six
Requires: python2-sqlalchemy
Requires: python-sqlalchemy-utils
Requires: python2-stevedore
Requires: python-sysv_ipc
Requires: python-tooz >= 0.30
Requires: python-trollius
Requires: python2-tenacity >= 4.0.0
Requires: python2-ujson
Requires: python-voluptuous
Requires: python-werkzeug
Requires: python2-pytz
Requires: PyYAML
Requires: python-webob >= 1.4.1
Requires: python-alembic
Requires: python-psycopg2
Requires: python2-prettytable
Requires: python2-cotyledon >= 1.5.0
Requires: python2-jsonpatch
Requires: python-cachetools
Requires: python2-pyparsing
%description -n python-%{service}
%{service} provides API to store metrics from components
and index resources.
This package contains the %{service} python library.
%package api
Summary: %{service} api
Requires: %{name}-common = %{version}-%{release}
Obsoletes: openstack-%{service}-api < 4.1.3
Provides: openstack-%{service}-api = %{version}-%{release}
%description api
%{service} provides API to store metrics from components
and index resources.
This package contains the %{service} API service.
%package common
Summary: Components common to all %{service} services
# Config file generation
BuildRequires: python2-daiquiri
BuildRequires: python2-jsonpatch
BuildRequires: python2-oslo-config >= 2:3.22.0
BuildRequires: python2-oslo-concurrency
BuildRequires: python2-oslo-db
BuildRequires: python2-oslo-log
BuildRequires: python2-oslo-messaging
BuildRequires: python2-oslo-policy
BuildRequires: python2-oslo-reports
BuildRequires: python2-oslo-service
BuildRequires: python2-lz4 >= 0.9.0
BuildRequires: python2-pandas >= 0.18.0
BuildRequires: python2-pecan >= 0.9
BuildRequires: python-pytimeparse >= 1.1.5
BuildRequires: python-tooz
BuildRequires: python2-ujson
BuildRequires: python-werkzeug
BuildRequires: python2-gnocchiclient >= 2.1.0
Requires: python-%{service} = %{version}-%{release}
Requires(pre): shadow-utils
Provides: openstack-%{service}-common = %{version}-%{release}
Obsoletes: openstack-%{service}-common < 4.1.3
Obsoletes: openstack-%{service}-carbonara
# openstack-gnocchi-indexer-sqlalchemy is removed and merged into common
Provides: openstack-%{service}-indexer-sqlalchemy = %{version}-%{release}
Obsoletes: openstack-%{service}-indexer-sqlalchemy < 4.1.3
# Obsolete old openstack-gnocchi packages
%description common
%{service} provides services to measure and
collect metrics from components.
%package metricd
Summary: %{service} metricd daemon
Requires: %{name}-common = %{version}-%{release}
Obsoletes: openstack-%{service}-metricd < 4.1.3
Provides: openstack-%{service}-metricd = %{version}-%{release}
%description metricd
%{service} provides API to store metrics from OpenStack
components and index resources.
This package contains the %{service} metricd daemon
%package statsd
Summary: %{service} statsd daemon
Requires: %{name}-common = %{version}-%{release}
Obsoletes: openstack-%{service}-statsd < 4.1.3
Provides: openstack-%{service}-statsd = %{version}-%{release}
%description statsd
%{service} provides API to store metrics from OpenStack
components and index resources.
This package contains the %{service} statsd daemon
%package -n python-%{service}-tests
Summary: Gnocchi tests
Requires: python-%{service} = %{version}-%{release}
Requires: python2-gabbi >= 1.30.0
%description -n python-%{service}-tests
This package contains the Gnocchi test files.
%if 0%{?with_doc}
%package doc
Summary: Documentation for %{service}
Requires: python-%{service} = %{version}-%{release}
Provides: openstack-%{service}-doc = %{version}-%{release}
Obsoletes: openstack-%{service}-doc < 4.1.3
%description doc
%{service} provides services to measure and
collect metrics from components.
This package contains documentation files for %{service}.
%endif
%prep
%setup -q -n %{service}-%{upstream_version}
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
%build
# Generate config file
PYTHONPATH=. oslo-config-generator --config-file=%{service}/%{service}-config-generator.conf --output-file=%{service}/%{service}.conf
export PBR_VERSION=%{version}
%{__python2} setup.py build
# Programmatically update defaults in sample config
# which is installed at /etc/gnocchi/gnocchi.conf
# TODO: Make this more robust
# Note it only edits the first occurrence, so assumes a section ordering in sample
# and also doesn't support multi-valued variables.
while read name eq value; do
test "$name" && test "$value" || continue
sed -i "0,/^# *$name=/{s!^# *$name=.*!#$name=$value!}" %{service}/%{service}.conf
done < %{SOURCE1}
%install
export PBR_VERSION=%{version}
%{__python2} setup.py install --skip-build --root %{buildroot}
mkdir -p %{buildroot}/%{_sysconfdir}/sysconfig/
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 775 %{SOURCE13} %{buildroot}%{_sysconfdir}/init.d/gnocchi-api
install -p -D -m 775 %{SOURCE14} %{buildroot}%{_sysconfdir}/init.d/gnocchi-metricd
install -p -D -m 640 %{SOURCE1} %{buildroot}%{_datadir}/%{service}/%{service}-dist.conf
install -p -D -m 640 %{service}/%{service}.conf %{buildroot}%{_sysconfdir}/%{service}/%{service}.conf
#TODO(prad): build the docs at run time, once the we get rid of postgres setup dependency
# Configuration
cp -R %{service}/rest/policy.json %{buildroot}/%{_sysconfdir}/%{service}
# Setup directories
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{service}
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{service}/tmp
install -d -m 755 %{buildroot}%{_localstatedir}/log/%{service}
# Install systemd unit services
install -p -D -m 644 %{SOURCE10} %{buildroot}%{_unitdir}/%{name}-api.service
install -p -D -m 644 %{SOURCE11} %{buildroot}%{_unitdir}/%{name}-metricd.service
install -p -D -m 644 %{SOURCE12} %{buildroot}%{_unitdir}/%{name}-statsd.service
# Backward compatibility unit services
ln -sf %{_unitdir}/%{name}-api.service %{buildroot}%{_unitdir}/openstack-%{name}-api.service
ln -sf %{_unitdir}/%{name}-metricd.service %{buildroot}%{_unitdir}/openstack-%{name}-metricd.service
ln -sf %{_unitdir}/%{name}-statsd.service %{buildroot}%{_unitdir}/openstack-%{name}-statsd.service
# Remove all of the conf files that are included in the buildroot/usr/etc dir since we installed them above
rm -f %{buildroot}/usr/etc/%{service}/*
%pre common
getent group %{service} >/dev/null || groupadd -r %{service}
if ! getent passwd %{service} >/dev/null; then
useradd -r -g %{service} -G %{service},nobody -d %{_sharedstatedir}/%{service} -s /sbin/nologin -c "%{service} Daemons" %{service}
fi
exit 0
%files -n python-%{service}
%{python2_sitelib}/%{service}
%{python2_sitelib}/%{service}-*.egg-info
%exclude %{python2_sitelib}/%{service}/tests
%files -n python-%{service}-tests
%license LICENSE
%{python2_sitelib}/%{service}/tests
%files api
%defattr(-,root,root,-)
%{_bindir}/%{service}-api
%{_unitdir}/%{name}-api.service
%{_unitdir}/openstack-%{name}-api.service
%{_sysconfdir}/init.d/gnocchi-api
%files common
%{_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
%config(noreplace) %attr(-, root, %{service}) %{_sysconfdir}/%{service}/policy.json
%config(noreplace) %attr(-, root, %{service}) %{_sysconfdir}/%{service}/%{service}.conf
%dir %attr(0750, %{service}, root) %{_localstatedir}/log/%{service}
%defattr(-, %{service}, %{service}, -)
%dir %{_sharedstatedir}/%{service}
%dir %{_sharedstatedir}/%{service}/tmp
%files metricd
%{_bindir}/%{service}-metricd
%{_unitdir}/%{name}-metricd.service
%{_unitdir}/openstack-%{name}-metricd.service
%{_sysconfdir}/init.d/gnocchi-metricd
%files statsd
%{_bindir}/%{service}-statsd
%{_unitdir}/%{name}-statsd.service
%{_unitdir}/openstack-%{name}-statsd.service
%if 0%{?with_doc}
%files doc
%doc doc/source/
%endif
%changelog
* Tue Mar 27 2018 Jon Schlueter <jschluet@redhat.com> 4.2.1-1
- Update to 4.2.1
* Wed Feb 21 2018 RDO <dev@lists.rdoproject.org> 4.2.0-1
- Update to 4.2.0

View File

@ -0,0 +1,5 @@
VERSION=7.0.1
TAR_NAME=gnocchiclient
COPY_LIST="$CGCS_BASE/downloads/$TAR_NAME-$VERSION.tar.gz"
TIS_PATCH_VER=1

View File

@ -0,0 +1,233 @@
%{!?python2_shortver: %global python2_shortver %(%{__python2} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')}
%{!?python3_shortver: %global python3_shortver %(%{__python3} -c 'import sys; print(str(sys.version_info.major) + "." + str(sys.version_info.minor))')}
%global pypi_name gnocchiclient
%{!?upstream_version: %global upstream_version %{version}%{?milestone}}
%if 0%{?fedora} >= 24
%global with_python3 1
%endif
%global common_desc \
This is a client library for Gnocchi built on the Gnocchi API. It \
provides a Python API (the gnocchiclient module) and a command-line tool.
Name: python-gnocchiclient
Version: 7.0.1
Release: 1%{?_tis_dist}.%{tis_patch_ver}
Summary: Python API and CLI for OpenStack Gnocchi
License: ASL 2.0
URL: https://github.com/openstack/%{name}
Source0: https://pypi.io/packages/source/g/%{pypi_name}/%{pypi_name}-%{upstream_version}.tar.gz
BuildArch: noarch
%package -n python2-%{pypi_name}
Summary: Python API and CLI for OpenStack Gnocchi
%{?python_provide:%python_provide python2-gnocchiclient}
BuildRequires: python2-setuptools
BuildRequires: python2-devel
BuildRequires: python2-pbr
BuildRequires: python2-tools
Requires: python-cliff >= 1.16.0
Requires: python2-osc-lib >= 1.7.0
Requires: python2-keystoneauth1 >= 2.0.0
Requires: python2-six >= 1.10.0
Requires: python2-futurist
Requires: python2-ujson
Requires: python2-pbr
Requires: python2-iso8601
Requires: python-dateutil
Requires: python2-debtcollector
%if 0%{?fedora} || 0%{?rhel} > 7
Requires: python2-monotonic
%else
Requires: python-monotonic
%endif
%description -n python2-%{pypi_name}
%{common_desc}
%package -n python-%{pypi_name}-doc
Summary: Documentation for OpenStack Gnocchi API Client
Group: Documentation
BuildRequires: python2-sphinx
BuildRequires: python2-oslo-sphinx
BuildRequires: python2-openstack-doc-tools
BuildRequires: python-cliff
BuildRequires: python2-keystoneauth1
BuildRequires: python2-six
BuildRequires: python2-futurist
BuildRequires: python2-ujson
BuildRequires: python2-sphinx_rtd_theme
# test
BuildRequires: python2-babel
# Runtime requirements needed during documentation build
BuildRequires: python2-osc-lib
BuildRequires: python-dateutil
%description doc
%{common_desc}
This package contains auto-generated documentation.
%package -n python2-%{pypi_name}-tests
Summary: Python API and CLI for OpenStack Gnocchi Tests
Requires: python2-%{pypi_name} = %{version}-%{release}
%description -n python2-%{pypi_name}-tests
%{common_desc}
%if 0%{?with_python3}
%package -n python3-%{pypi_name}
Summary: Python API and CLI for OpenStack Gnocchi
%{?python_provide:%python_provide python3-%{pypi_name}}
BuildRequires: python3-devel
BuildRequires: python3-pbr
BuildRequires: python3-setuptools
BuildRequires: python3-tools
Requires: python3-cliff >= 1.16.0
Requires: python3-osc-lib >= 1.7.0
Requires: python3-keystoneauth1 >= 2.0.0
Requires: python3-six >= 1.10.0
Requires: python3-futurist
Requires: python3-ujson
Requires: python3-pbr
Requires: python3-monotonic
Requires: python3-iso8601
Requires: python3-dateutil
Requires: python3-debtcollector
%description -n python3-%{pypi_name}
%{common_desc}
%package -n python3-%{pypi_name}-tests
Summary: Python API and CLI for OpenStack Gnocchi Tests
Requires: python3-%{pypi_name} = %{version}-%{release}
%description -n python3-%{pypi_name}-tests
%{common_desc}
%endif
%description
%{common_desc}
%package sdk
Summary: SDK files for %{pypi_name}
%description sdk
Contains SDK files for %{pypi_name} package
%prep
%autosetup -n %{pypi_name}-%{upstream_version} -S git
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
2to3 --write --nobackups %{py3dir}
%endif
# Remove bundled egg-info
rm -rf gnocchiclient.egg-info
# Let RPM handle the requirements
rm -f test-requirements.txt
%build
export PBR_VERSION=%{version}
%py2_build
%if 0%{?with_python3}
pushd %{py3dir}
LANG=en_US.UTF-8 %{__python3} setup.py build
popd
%endif
%install
export PBR_VERSION=%{version}
%if 0%{?with_python3}
pushd %{py3dir}
LANG=en_US.UTF-8 %{__python3} setup.py install --skip-build --root %{buildroot}
mv %{buildroot}%{_bindir}/gnocchi %{buildroot}%{_bindir}/python3-gnocchi
popd
%endif
%{__python2} setup.py install --skip-build --root %{buildroot}
# rename binaries, make compat symlinks
install -m 755 -d %{buildroot}/%{_bindir}
pushd %{buildroot}%{_bindir}
for i in gnocchi-{2,%{?python2_shortver}}; do
ln -s gnocchi $i
done
%if 0%{?with_python3}
for i in gnocchi-{3,%{?python3_shortver}}; do
ln -s python3-gnocchi $i
done
%endif
popd
# Some env variables required to successfully build our doc
export PATH=$PATH:%{buildroot}%{_bindir}
export PYTHONPATH=.
export LANG=en_US.utf8
python setup.py build_sphinx -b html
# Fix hidden-file-or-dir warnings
rm -rf doc/build/html/.doctrees doc/build/html/.buildinfo
# prep SDK package
mkdir -p %{buildroot}/usr/share/remote-clients
tar zcf %{buildroot}/usr/share/remote-clients/%{pypi_name}-%{version}.tgz --exclude='.gitignore' --exclude='.gitreview' -C .. %{pypi_name}-%{version}
%files -n python2-%{pypi_name}
%doc README.rst
%license LICENSE
%{_bindir}/gnocchi
%{_bindir}/gnocchi-2*
%{python2_sitelib}/gnocchiclient
%{python2_sitelib}/*.egg-info
%exclude %{python2_sitelib}/gnocchiclient/tests
%files -n python2-%{pypi_name}-tests
%license LICENSE
%{python2_sitelib}/gnocchiclient/tests
%if 0%{?with_python3}
%files -n python3-%{pypi_name}
%doc README.rst
%license LICENSE
%{_bindir}/python3-gnocchi
%{_bindir}/gnocchi-3*
%{python3_sitelib}/gnocchiclient
%{python3_sitelib}/*.egg-info
%exclude %{python3_sitelib}/gnocchiclient/tests
%files -n python3-%{pypi_name}-tests
%license LICENSE
%{python3_sitelib}/gnocchiclient/tests
%endif
%files -n python-%{pypi_name}-doc
%doc doc/build/html
%files sdk
/usr/share/remote-clients/%{pypi_name}-%{version}.tgz
%changelog
* Tue Feb 13 2018 RDO <dev@lists.rdoproject.org> 7.0.1-1
- Update to 7.0.1

View File

@ -1,24 +0,0 @@
From 9d598a1ee8f1a98ce5f14d76f88123d4a7614e1c Mon Sep 17 00:00:00 2001
From: Sen Yang <sen.yang@windriver.com>
Date: Thu, 15 Feb 2018 11:52:09 -0500
Subject: [PATCH 1/1] US106901 Openstack-CLI-Adoption
---
SPECS/python-openstackclient.spec | 1 +
1 file changed, 1 insertion(+)
diff --git a/SPECS/python-openstackclient.spec b/SPECS/python-openstackclient.spec
index 4b1682e..6b582ce 100644
--- a/SPECS/python-openstackclient.spec
+++ b/SPECS/python-openstackclient.spec
@@ -26,6 +26,7 @@ Patch0005: 0001-US101470-Openstackclient-implementation-of-novaclien.patc
Patch0006: 0002-US101470-Openstackclient-implementation-of-novaclien.patch
Patch0007: 0001-US106901-Openstack-CLI-Adoption.patch
Patch0008: 0002-US106901-Openstack-CLI-Adoption.patch
+Patch0009: 0003-US106901-Openstack-CLI-Adoption.patch
BuildArch: noarch
--
1.8.3.1

View File

@ -1,20 +0,0 @@
diff --git a/SPECS/python-openstackclient.spec b/SPECS/python-openstackclient.spec
index 6b582ce..5d75107 100644
--- a/SPECS/python-openstackclient.spec
+++ b/SPECS/python-openstackclient.spec
@@ -55,6 +55,7 @@ BuildRequires: python-keystoneclient
BuildRequires: python-novaclient
BuildRequires: python-cinderclient
BuildRequires: python-neutronclient
+BuildRequires: python-ceilometerclient
BuildRequires: python-mock
BuildRequires: python-requests-mock
BuildRequires: python-os-client-config
@@ -84,6 +85,7 @@ Requires: python-keystoneclient
Requires: python-novaclient
Requires: python-cinderclient
Requires: python-neutronclient
+Requires: python-ceilometerclient
Requires: python-six
Requires: python-osc-lib
Requires: python-%{client}-lang = %{version}-%{release}

View File

@ -1,24 +1,23 @@
From ab8fc2b85ab7b60bdfeca496a32e90bc8f575478 Mon Sep 17 00:00:00 2001
From: Kam Nasim <kam.nasim@windriver.com>
Date: Fri, 11 May 2018 13:13:15 -0400
From ac2faa010188a6d824a8958c2971bcefe2a56ab9 Mon Sep 17 00:00:00 2001
From: Angie Wang <angie.Wang@windriver.com>
Date: Fri, 8 Jun 2018 16:05:52 -0400
Subject: [PATCH] meta patch for endpoint groups
Signed-off-by: Kam Nasim <kam.nasim@windriver.com>
---
SPECS/python-openstackclient.spec | 3 +++
1 file changed, 3 insertions(+)
diff --git a/SPECS/python-openstackclient.spec b/SPECS/python-openstackclient.spec
index 5d75107..26941e4 100644
index 4b1682e..c192b2b 100644
--- a/SPECS/python-openstackclient.spec
+++ b/SPECS/python-openstackclient.spec
@@ -27,6 +27,9 @@ Patch0006: 0002-US101470-Openstackclient-implementation-of-novaclien.patc
@@ -26,6 +26,9 @@ Patch0005: 0001-US101470-Openstackclient-implementation-of-novaclien.patc
Patch0006: 0002-US101470-Openstackclient-implementation-of-novaclien.patch
Patch0007: 0001-US106901-Openstack-CLI-Adoption.patch
Patch0008: 0002-US106901-Openstack-CLI-Adoption.patch
Patch0009: 0003-US106901-Openstack-CLI-Adoption.patch
+Patch0010: 0001-Optimize-getting-endpoint-list.patch
+Patch0011: 0002-Add-support-for-endpoing-filter-commands.patch
+Patch0012: 0003-Add-support-for-endpoint-group-commands.patch
+Patch0009: 0001-Optimize-getting-endpoint-list.patch
+Patch0010: 0002-Add-support-for-endpoing-filter-commands.patch
+Patch0011: 0003-Add-support-for-endpoint-group-commands.patch
BuildArch: noarch

View File

@ -12,6 +12,4 @@
0002-meta-us101470.patch
0001-meta-US106901-Openstack-CLI-Adoption.patch
0002-meta-US106901-Openstack-CLI-Adoption.patch
0003-meta-US106901-Openstack-CLI-Adoption.patch
1002-require-python-ceilometerclient.patch
1003-meta-patch-for-endpoint-groups.patch

View File

@ -1,435 +0,0 @@
From 6f1c69328515b4aa1591c999dedbbf88eefacfbe Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 14 Feb 2018 22:19:17 -0500
Subject: [PATCH 1/1] US106901: OSC equivalence for Ceilometer OSC
equivalence achieved for the following ceilometer commands
ceilometer clis:
ceilometer metertype-list
ceilometer pipeline-list
ceilometer pipeline-show
ceilometer pipeline-update
OSC equivalence:
openstack telemetry metertype list
openstack telemetry pipeline list
openstack telemetry pipeline show
openstack telemetry pipeline update
---
openstackclient/common/extension.py | 22 +++++
openstackclient/common/module.py | 2 +-
openstackclient/telemetry/__init__.py | 0
openstackclient/telemetry/client.py | 68 ++++++++++++++
openstackclient/telemetry/v2/__init__.py | 0
openstackclient/telemetry/v2/metertype.py | 67 ++++++++++++++
openstackclient/telemetry/v2/pipeline.py | 146 ++++++++++++++++++++++++++++++
requirements.txt | 1 +
setup.cfg | 6 ++
9 files changed, 311 insertions(+), 1 deletion(-)
create mode 100644 openstackclient/telemetry/__init__.py
create mode 100644 openstackclient/telemetry/client.py
create mode 100644 openstackclient/telemetry/v2/__init__.py
create mode 100644 openstackclient/telemetry/v2/metertype.py
create mode 100644 openstackclient/telemetry/v2/pipeline.py
diff --git a/openstackclient/common/extension.py b/openstackclient/common/extension.py
index 139f43a..c1b0347 100644
--- a/openstackclient/common/extension.py
+++ b/openstackclient/common/extension.py
@@ -12,6 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
#
+# Copyright (c) 2013-2018 Wind River Systems, Inc.
+#
+#
+#
+#
+#
"""Extension action implementations"""
@@ -55,6 +61,13 @@ class ListExtension(command.Lister):
default=False,
help=_('List extensions for the Block Storage API'),
)
+ # WRS extension
+ parser.add_argument(
+ '--telemetry',
+ action='store_true',
+ default=False,
+ help=_('List extensions for Ceilometer API'),
+ )
parser.add_argument(
'--long',
action='store_true',
@@ -111,6 +124,15 @@ class ListExtension(command.Lister):
message = _("Failed to retrieve extensions list "
"from Network API")
LOG.warning(message)
+ # WRS extension
+ if parsed_args.telemetry or show_all:
+ telemetry_client = self.app.client_manager.telemetry
+ try:
+ data += telemetry_client.list_extensions.show_all()
+ except Exception:
+ message = _("Extensions list not supported by "
+ "Ceilometer API")
+ LOG.warning(message)
extension_tuples = (
utils.get_item_properties(
diff --git a/openstackclient/common/module.py b/openstackclient/common/module.py
index 20497f2..12d2038 100644
--- a/openstackclient/common/module.py
+++ b/openstackclient/common/module.py
@@ -35,7 +35,7 @@ class ListCommand(command.Lister):
'--group',
metavar='<group-keyword>',
help=_('Show commands filtered by a command group, for example: '
- 'identity, volume, compute, image, network and '
+ 'identity, volume, compute, image, network, telemetry and '
'other keywords'),
)
return parser
diff --git a/openstackclient/telemetry/__init__.py b/openstackclient/telemetry/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/openstackclient/telemetry/client.py b/openstackclient/telemetry/client.py
new file mode 100644
index 0000000..0698a20
--- /dev/null
+++ b/openstackclient/telemetry/client.py
@@ -0,0 +1,68 @@
+# Copyright 2012-2018 OpenStack Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# Copyright (c) 2013-2018 Wind River Systems, Inc.
+#
+#
+#
+#
+#
+
+# WRS extension
+
+
+from osc_lib import utils
+from openstackclient.i18n import _
+
+import logging
+LOG = logging.getLogger(__name__)
+
+DEFAULT_API_VERSION = '2'
+API_VERSION_OPTION = 'telemetry_api_version'
+API_NAME = "telemetry"
+API_VERSIONS = {
+ "2": "ceilometerclient.v2.client.Client",
+}
+
+
+def make_client(instance):
+ """Returns an ceilometer service client"""
+ ceilometer_client = utils.get_client_class(
+ API_NAME,
+ instance._api_version[API_NAME],
+ API_VERSIONS)
+ LOG.debug('Instantiating ceilometer client: %s', ceilometer_client)
+
+ # Remember interface only if interface is set
+ kwargs = utils.build_kwargs_dict('endpoint_type', instance.interface)
+
+ client = ceilometer_client(
+ session=instance.session,
+ region_name=instance.region_name,
+ **kwargs
+ )
+
+ return client
+
+
+def build_option_parser(parser):
+ """Hook to add global options"""
+ parser.add_argument(
+ '--os-telemetry-api-version',
+ metavar='<telemetry-api-version>',
+ default=utils.env('TELEMETRY_API_VERSION'),
+ help=_('Ceilometer API version, default=%s (Env: TELEMETRY_API_VERSION)') %
+ DEFAULT_API_VERSION,
+ )
+ return parser
diff --git a/openstackclient/telemetry/v2/__init__.py b/openstackclient/telemetry/v2/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/openstackclient/telemetry/v2/metertype.py b/openstackclient/telemetry/v2/metertype.py
new file mode 100644
index 0000000..5472123
--- /dev/null
+++ b/openstackclient/telemetry/v2/metertype.py
@@ -0,0 +1,67 @@
+# Copyright 2012-2018 OpenStack Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# Copyright (c) 2013-2018 Wind River Systems, Inc.
+#
+#
+#
+#
+#
+# Copyright (c) 2013-2018 Wind River Systems, Inc.
+#
+#
+#
+#
+#
+# WRS extension
+
+from osc_lib.command import command
+from osc_lib import utils
+
+from openstackclient.i18n import _
+
+
+class ListMetertype(command.Lister):
+ """List the user's meter types."""
+
+ def get_parser(self, prog_name):
+ parser = super(ListMetertype, self).get_parser(prog_name)
+ parser.add_argument(
+ "-q", "--query",
+ metavar="<QUERY>",
+ help=_("key[op]data_type::value; list. data_type is optional, "
+ "but if supplied must be string, integer, float, or boolean.")
+ )
+ parser.add_argument(
+ "-l", "--limit",
+ metavar="<NUMBER>",
+ help=_("Maximum number of meters to return.")
+ )
+ return parser
+
+ def take_action(self, parsed_args):
+ ceilometer_client = self.app.client_manager.telemetry
+
+ columns = (
+ "Name",
+ "Type",
+ "Unit",
+ )
+
+ metertypes = ceilometer_client.metertypes.list()
+
+ return (columns,
+ (utils.get_item_properties(
+ s, columns,
+ ) for s in metertypes))
diff --git a/openstackclient/telemetry/v2/pipeline.py b/openstackclient/telemetry/v2/pipeline.py
new file mode 100644
index 0000000..cbe077a
--- /dev/null
+++ b/openstackclient/telemetry/v2/pipeline.py
@@ -0,0 +1,146 @@
+# Copyright 2012-2018 OpenStack Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+# Copyright (c) 2013-2018 Wind River Systems, Inc.
+#
+#
+#
+#
+#
+
+# WRS extension
+
+from osc_lib.command import command
+from osc_lib import utils
+import six
+
+from openstackclient.i18n import _
+
+from oslo_utils import strutils
+from ceilometerclient import exc
+from ceilometerclient.common import utils as ceilometer_utils
+
+
+class ListPipeline(command.Lister):
+ """List the pipelines ."""
+
+ def get_parser(self, prog_name):
+ parser = super(ListPipeline, self).get_parser(prog_name)
+ parser.add_argument(
+ "-q", "--query",
+ metavar="<QUERY>",
+ help=_("key[op]value; list.")
+ )
+ return parser
+
+ def take_action(self, parsed_args):
+ ceilometer_client = self.app.client_manager.telemetry
+
+ columns = (
+ "Name",
+ "Enabled",
+ "Location",
+ "Max Bytes",
+ "Backup Count",
+ "Compress",
+ )
+
+ pipelines = ceilometer_client.pipelines.list()
+
+ return (columns,
+ (utils.get_item_properties(
+ s, columns,
+ ) for s in pipelines))
+
+
+class ShowPipeline(command.ShowOne):
+ """Show details of a given pipeline."""
+
+ def get_parser(self, prog_name):
+ parser = super(ShowPipeline, self).get_parser(prog_name)
+ parser.add_argument(
+ "-n", "--name",
+ metavar="<PIPELINE_NAME>",
+ help=_("Name of the pipeline to show.")
+ )
+ return parser
+
+ def take_action(self, parsed_args):
+ ceilometer_client = self.app.client_manager.telemetry
+ pipelines = ceilometer_client.pipelines.get(parsed_args.name)
+ data = pipelines._info.copy()
+ return zip(*sorted(six.iteritems(data)))
+
+
+def _show_pipeline(pipeline):
+ fields = ['name', 'enabled', 'location', 'max_bytes',
+ 'backup_count', 'compress']
+ data = dict([(f, getattr(pipeline, f, '')) for f in fields])
+ ceilometer_utils.print_dict(data, wrap=72)
+
+
+class UpdatePipeline(command.Command):
+ """Update output values for an existing csv pipeline"""
+
+ def get_parser(self, prog_name):
+ parser = super(UpdatePipeline, self).get_parser(prog_name)
+ parser.add_argument(
+ "-n", "--name",
+ required=True,
+ metavar="<PIPELINE_NAME>",
+ help=_("Name of the pipeline to update.")
+ )
+ parser.add_argument(
+ "--enabled",
+ type=strutils.bool_from_string,
+ metavar="{True|False}",
+ help=_("True if enabling this pipeline")
+ )
+ parser.add_argument(
+ "--location",
+ metavar="<LOCATION>",
+ help=_("Full Path of the output file.")
+ )
+ parser.add_argument(
+ "--backup_count",
+ type=int,
+ metavar="<BACKUP_COUNT>",
+ help=_("Number of backup files to keep.")
+ )
+ parser.add_argument(
+ "--max_bytes",
+ type=int,
+ metavar="<MAX_BYTES>",
+ help=_("Maximum size of the file in bytes.")
+ )
+ parser.add_argument(
+ "--compress",
+ type=strutils.bool_from_string,
+ metavar="{True|False}",
+ help=_("True if compressing backups.")
+ )
+ return parser
+
+ def take_action(self, parsed_args):
+ """Update output values for an existing csv pipeline."""
+ ceilometer_client = self.app.client_manager.telemetry
+
+ fields = dict(filter(lambda x: not (x[1] is None), vars(parsed_args).items()))
+ fields = ceilometer_utils.key_with_slash_to_nested_dict(fields)
+ fields.pop('name')
+ try:
+ pipeline = ceilometer_client.pipelines.update(parsed_args.name, **fields)
+ except exc.HTTPNotFound:
+ raise exc.CommandError('Pipeline not found: %s' % parsed_args.name)
+ _show_pipeline(pipeline)
diff --git a/requirements.txt b/requirements.txt
index 24e4672..56a5705 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -15,3 +15,4 @@ python-glanceclient>=2.7.0 # Apache-2.0
python-keystoneclient>=3.8.0 # Apache-2.0
python-novaclient>=9.0.0 # Apache-2.0
python-cinderclient>=3.0.0 # Apache-2.0
+python-ceilometerclient>=2.9.0 # Apache-2.0
diff --git a/setup.cfg b/setup.cfg
index 11f7261..1b8e006 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -37,6 +37,7 @@ openstack.cli.base =
network = openstackclient.network.client
object_store = openstackclient.object.client
volume = openstackclient.volume.client
+ telemetry = openstackclient.telemetry.client
openstack.common =
availability_zone_list = openstackclient.common.availability_zone:ListAvailabilityZone
configuration_show = openstackclient.common.configuration:ShowConfiguration
@@ -632,6 +633,11 @@ openstack.volume.v3 =
volume_transfer_request_delete = openstackclient.volume.v2.volume_transfer_request:DeleteTransferRequest
volume_transfer_request_list = openstackclient.volume.v2.volume_transfer_request:ListTransferRequest
volume_transfer_request_show = openstackclient.volume.v2.volume_transfer_request:ShowTransferRequest
+openstack.telemetry.v2 =
+ telemetry_metertype_list = openstackclient.telemetry.v2.metertype:ListMetertype
+ telemetry_pipeline_list = openstackclient.telemetry.v2.pipeline:ListPipeline
+ telemetry_pipeline_show = openstackclient.telemetry.v2.pipeline:ShowPipeline
+ telemetry_pipeline_update = openstackclient.telemetry.v2.pipeline:UpdatePipeline
[pbr]
autodoc_tree_index_modules = True
--
1.8.3.1