Merge "Allows to use cradox with ceph storage"
This commit is contained in:
commit
ba43108634
@ -319,6 +319,10 @@ function preinstall_gnocchi {
|
||||
else
|
||||
install_package postgresql-devel
|
||||
fi
|
||||
if [[ "$GNOCCHI_STORAGE_BACKEND" = 'ceph' ]] ; then
|
||||
install_package cython
|
||||
install_package librados-dev
|
||||
fi
|
||||
}
|
||||
|
||||
# install_gnocchi() - Collect source and prepare
|
||||
@ -332,6 +336,10 @@ function install_gnocchi {
|
||||
pip_install influxdb
|
||||
fi
|
||||
|
||||
if [[ "$GNOCCHI_STORAGE_BACKEND" = 'ceph' ]] ; then
|
||||
pip_install cradox
|
||||
fi
|
||||
|
||||
if is_service_enabled gnocchi-grafana
|
||||
then
|
||||
_gnocchi_install_grafana
|
||||
|
@ -36,7 +36,7 @@ GNOCCHI_STATSD_RESOURCE_ID=${GNOCCHI_STATSD_RESOURCE_ID:-$(uuidgen)}
|
||||
GNOCCHI_STATSD_USER_ID=${GNOCCHI_STATSD_USER_ID:-$(uuidgen)}
|
||||
GNOCCHI_STATSD_PROJECT_ID=${GNOCCHI_STATSD_PROJECT_ID:-$(uuidgen)}
|
||||
|
||||
# ceph gnochi info
|
||||
# ceph gnocchi info
|
||||
GNOCCHI_CEPH_USER=${GNOCCHI_CEPH_USER:-gnocchi}
|
||||
GNOCCHI_CEPH_POOL=${GNOCCHI_CEPH_POOL:-gnocchi}
|
||||
GNOCCHI_CEPH_POOL_PG=${GNOCCHI_CEPH_POOL_PG:-8}
|
||||
|
@ -167,4 +167,21 @@ result from:
|
||||
So, in realistic scenarios, the direct relation between the archive policy and
|
||||
the size of the rados objects created by Gnocchi is not a problem.
|
||||
|
||||
|
||||
Also Gnocchi can use `cradox`_ Python libary if installed. This library is a
|
||||
Python binding to librados written with `Cython`_, aiming to replace the one
|
||||
written with `ctypes`_ provided by Ceph.
|
||||
This new library will be part of next Ceph release (10.0.4).
|
||||
|
||||
The new Cython binding divides the gnocchi-metricd times to process measures
|
||||
by a large factor.
|
||||
|
||||
So, if the Ceph installation doesn't use latest Ceph version, `cradox`_ can be
|
||||
installed to improve the Ceph backend performance.
|
||||
|
||||
|
||||
.. _`Ceph extended attributes documentation`: http://docs.ceph.com/docs/master/rados/configuration/filestore-config-ref/#extended-attributes
|
||||
.. _`cradox`: https://pypi.python.org/pypi/cradox
|
||||
.. _`Cython`: http://cython.org/
|
||||
.. _`ctypes`: https://docs.python.org/2/library/ctypes.html
|
||||
.. _`rados.py`: https://docs.python.org/2/library/ctypes.htm://github.com/ceph/ceph/blob/hammer/src/pybind/rados.py
|
||||
|
@ -29,8 +29,13 @@ from gnocchi.storage import _carbonara
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
# NOTE(sileht): rados module is not available on pypi
|
||||
rados = importutils.try_import('rados')
|
||||
for RADOS_MODULE_NAME in ('cradox', 'rados'):
|
||||
rados = importutils.try_import(RADOS_MODULE_NAME)
|
||||
if rados is not None:
|
||||
break
|
||||
else:
|
||||
RADOS_MODULE_NAME = None
|
||||
|
||||
if rados is not None and hasattr(rados, 'run_in_thread'):
|
||||
rados.run_in_thread = lambda target, args, timeout=None: target(*args)
|
||||
LOG.info("rados.run_in_thread is monkeypatched.")
|
||||
@ -59,6 +64,12 @@ class CephStorage(_carbonara.CarbonaraBasedStorage):
|
||||
if conf.ceph_keyring:
|
||||
options['keyring'] = conf.ceph_keyring
|
||||
|
||||
if not rados:
|
||||
raise ImportError("No module named 'rados' nor 'cradox'")
|
||||
|
||||
LOG.info("Ceph storage backend use '%s' python library" %
|
||||
RADOS_MODULE_NAME)
|
||||
|
||||
# NOTE(sileht): librados handles reconnection itself,
|
||||
# by default if a call timeout (30sec), it raises
|
||||
# a rados.Timeout exception, and librados
|
||||
|
Loading…
Reference in New Issue
Block a user