Add support for the Ceph storage driver in Gnocchi

Besides implementing the required configuration entries in gnocchi.conf,
this commit also introduces code to create a symlink for the Python
rados library when the Ceph storage driver is chosen by the deployer.

Creation of Ceph Python library symlinks is usually done by the
ceph_client role. However, Gnocchi is different because it needs Ceph
access to be working when the DB sync task is run. Because the venv may
not exist before the os_gnocchi role runs, or because it might be
destroyed and recreated by the role, we need to create the symlink in
the os_gnocchi role itself.

Change-Id: I6b831867079bc24964c323e2784782d4eae30763
This commit is contained in:
Paulo Matias 2016-09-21 21:36:01 -03:00 committed by Kevin Carter (cloudnull)
parent a4a71f7111
commit fb65850dbe
4 changed files with 44 additions and 10 deletions

View File

@ -72,6 +72,10 @@ gnocchi_db_sync_options: "--create-legacy-resource-types"
gnocchi_storage_driver: file
gnocchi_coordination_url: "mysql://{{ gnocchi_galera_user }}:{{ gnocchi_container_mysql_password }}@{{ gnocchi_galera_address }}/{{ gnocchi_galera_database }}?charset=utf8&timeout=5"
#: Default Ceph parameters
gnocchi_ceph_pool: "gnocchi"
gnocchi_ceph_username: "gnocchi"
#: Default Archive Policies
gnocchi_archive_policies:
- name: "low"

View File

@ -0,0 +1,29 @@
---
# Copyright 2014, Rackspace US, Inc.
#
# 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.
- name: Register rados module path
command: python -c 'import rados; print rados.__file__'
register: rados_module_path
- name: Link rados module into the venv
file:
src: "{{ rados_module_path.stdout }}"
dest: "{{ gnocchi_bin | dirname }}/lib/python2.7/site-packages/{{ rados_module_path.stdout | basename }}"
state: link
force: "yes"
notify:
- Restart Apache
- Restart Gnocchi API services
- Restart Gnocchi extra services

View File

@ -70,7 +70,14 @@
tags:
- gnocchi-install
# N.B. Must occur after identity setup, as this may perform calls to Swift
- include: gnocchi_ceph_python_libs.yml
when:
- gnocchi_storage_driver == 'ceph'
tags:
- gnocchi-install
# N.B. Must occur after identity setup, as this may perform calls to Swift.
# Similarly, when using Ceph, must occur after Ceph setup.
- include: gnocchi_db_setup.yml
when:
- inventory_hostname == groups['gnocchi_all'][0]

View File

@ -70,16 +70,10 @@ swift_container_prefix: gnocchi
## Ceph Storage
############
# Ceph pool name to use. (string value)
#ceph_pool = gnocchi
ceph_pool = {{ gnocchi_ceph_pool }}
# Ceph username (ie: client.admin). (string value)
#ceph_username = <None>
# Ceph keyring path. (string value)
#ceph_keyring = <None>
# Ceph configuration file. (string value)
#ceph_conffile = /etc/ceph/ceph.conf
# Ceph username (ie: admin without "client." prefix).
ceph_username = {{ gnocchi_ceph_username }}
{% endif %}
[metricd]