Switch default cloudkitty storage backend to influxdb

Backport: stein

In the Stein release, cloudkitty switched the default storage backend
from sqlalchemy to influxdb. In kolla-ansible stein configuration, we
did not explicitly set the storage backend, and so we automatically
picked up this change. However, prior to
https://review.opendev.org/#/c/615928/ we did not have full support for
InfluxDB as a storage backend, and so this has broken the Rocky-Stein
upgrade (https://bugs.launchpad.net/kolla-ansible/+bug/1838641), which
fails with this during the DB sync:

ERROR cloudkitty InfluxDBClientError: get_list_retention_policies()
requires a database as a parameter or the client to be using a database

This change synchronises our default with cloudkitty's (influxdb), and
also provides an upgrade transition to create the influxdb database.

We also move the cloudkitty_storage_backend variable to
group_vars/all.yml, since it is used to determine whether to enable
influxdb.

Finally, the section name in cloudkitty.conf was incorrect - it was
storage_influx,  but should be storage_influxdb.

Change-Id: I71f2ed11bd06f58e141d222e2709835b7ddb2c71
Closes-Bug: #1838641
This commit is contained in:
Mark Goddard 2019-09-11 18:15:02 +01:00
parent 5ff7bab46b
commit 27f4876eed
6 changed files with 45 additions and 8 deletions

View File

@ -597,7 +597,7 @@ enable_horizon_vitrage: "{{ enable_vitrage | bool }}"
enable_horizon_watcher: "{{ enable_watcher | bool }}"
enable_horizon_zun: "{{ enable_zun | bool }}"
enable_hyperv: "no"
enable_influxdb: "{{ enable_monasca | bool or (cloudkitty_storage_backend is defined and cloudkitty_storage_backend == 'influxdb') }}"
enable_influxdb: "{{ enable_monasca | bool or (enable_cloudkitty | bool and cloudkitty_storage_backend == 'influxdb') }}"
enable_ironic: "no"
enable_ironic_ipxe: "no"
enable_ironic_neutron_agent: "{{ enable_neutron | bool and enable_ironic | bool }}"
@ -861,6 +861,12 @@ cinder_backup_mount_options_nfs: ""
#######################
# Valid option is gnocchi
cloudkitty_collector_backend: "gnocchi"
# Valid options are 'sqlalchemy' or 'influxdb'. The default value is
# 'influxdb', which matches the default in Cloudkitty since the Stein release.
# When the backend is "influxdb", we also enable Influxdb.
# Also, when using 'influxdb' as the backend, we trigger the configuration/use
# of Cloudkitty storage backend version 2.
cloudkitty_storage_backend: "influxdb"
#######################
# Designate options

View File

@ -100,13 +100,12 @@ cloudkitty_custom_metrics_yaml_file: "metrics.yml"
####################
# Storage backend
####################
# Valid options are 'sqlalchemy' or 'influxdb'. The default value in
# Kolla-ansible is 'sqlalchemy' (for backwards compatibility).
# When cloudkitty_storage_backend is define with "influxdb" as its value,
# we also trigger the deployment of Influxdb via Kolla-ansible.
# Valid options are 'sqlalchemy' or 'influxdb'. The default value is
# 'influxdb', which matches the default in Cloudkitty since the Stein release.
# When the backend is "influxdb", we also enable Influxdb.
# Also, when using 'influxdb' as the backend, we trigger the configuration/use
# of Cloudkitty storage backend version 2.
cloudkitty_storage_backend: "sqlalchemy"
cloudkitty_storage_backend: "influxdb"
# InfluxDB retention policy to use (defaults to autogen).
# cloudkitty_influxdb_retention_policy: "autogen"

View File

@ -1,6 +1,19 @@
---
- include_tasks: config.yml
# NOTE(mgoddard): Transition support for upgrades from Rocky or Stein which may
# be using the SQLAlchemy storage backend.
# TODO(mgoddard): Remove in U cycle.
- name: Creating Cloudkitty influxdb database
become: true
kolla_toolbox:
module_name: influxdb_database
module_args:
hostname: "{{ influxdb_address }}"
port: "{{ influxdb_http_port }}"
database_name: "{{ cloudkitty_influxdb_name }}"
when: cloudkitty_storage_backend == 'influxdb'
- include_tasks: bootstrap_service.yml
- name: Flush handlers

View File

@ -72,7 +72,7 @@ version = 1
{% endif %}
{% if cloudkitty_storage_backend == 'influxdb' %}
[storage_influx]
[storage_influxdb]
database = {{ cloudkitty_influxdb_name }}
host = {{ influxdb_address }}
port = {{ influxdb_http_port }}

View File

@ -268,7 +268,7 @@
#enable_horizon_watcher: "{{ enable_watcher | bool }}"
#enable_horizon_zun: "{{ enable_zun | bool }}"
#enable_hyperv: "no"
#enable_influxdb: "{{ enable_monasca | bool or (cloudkitty_storage_backend is defined and cloudkitty_storage_backend == 'influxdb') }}"
#enable_influxdb: "{{ enable_monasca | bool or (enable_cloudkitty | bool and cloudkitty_storage_backend == 'influxdb') }}"
#enable_ironic: "no"
#enable_ironic_ipxe: "no"
#enable_ironic_neutron_agent: "{{ enable_neutron | bool and enable_ironic | bool }}"
@ -446,6 +446,17 @@
#cinder_backup_share: ""
#cinder_backup_mount_options_nfs: ""
#######################
# Cloudkitty options
#######################
# Valid option is gnocchi
#cloudkitty_collector_backend: "gnocchi"
# Valid options are 'sqlalchemy' or 'influxdb'. The default value is
# 'influxdb', which matches the default in Cloudkitty since the Stein release.
# When the backend is "influxdb", we also enable Influxdb.
# Also, when using 'influxdb' as the backend, we trigger the configuration/use
# of Cloudkitty storage backend version 2.
#cloudkitty_storage_backend: "influxdb"
###################
# Designate options

View File

@ -0,0 +1,8 @@
---
upgrade:
- |
Modifies the default storage backend for Cloudkitty to InfluxDB, to match
the default in Cloudkitty from Stein onwards. This is controlled via
``cloudkitty_storage_backend``. To use the previous default, set
``cloudkitty_storage_backend`` to ``sqlalchemy``. See `bug 1838641
<https://bugs.launchpad.net/kolla-ansible/+bug/1838641>`__ for details.