2015-09-24 10:35:23 +02:00
|
|
|
# == Class: ceilometer::db
|
|
|
|
#
|
|
|
|
# Configures the ceilometer database
|
|
|
|
# This class will install the required libraries depending on the driver
|
|
|
|
# specified in the connection_string parameter
|
2013-04-23 11:22:31 +02:00
|
|
|
#
|
2016-01-10 20:26:28 +08:00
|
|
|
# === Parameters:
|
|
|
|
#
|
2016-05-09 16:25:48 +02:00
|
|
|
# [*database_db_max_retries*]
|
|
|
|
# (optional) Maximum retries in case of connection error or deadlock error
|
|
|
|
# before error is raised. Set to -1 to specify an infinite retry count.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2015-09-24 10:35:23 +02:00
|
|
|
# [*database_connection*]
|
2016-01-10 20:26:28 +08:00
|
|
|
# (Optional) Url used to connect to database.
|
2018-03-05 08:51:30 +08:00
|
|
|
# Defaults to 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer'.
|
2015-09-24 10:35:23 +02:00
|
|
|
#
|
|
|
|
# [*database_idle_timeout*]
|
2016-01-10 20:26:28 +08:00
|
|
|
# (Optional) Timeout when db connections should be reaped.
|
|
|
|
# Defaults to $::os_service_default.
|
2015-09-24 10:35:23 +02:00
|
|
|
#
|
|
|
|
# [*database_min_pool_size*]
|
2016-01-10 20:26:28 +08:00
|
|
|
# (Optional) Minimum number of SQL connections to keep open in a pool.
|
|
|
|
# Defaults to $::os_service_default.
|
2015-09-24 10:35:23 +02:00
|
|
|
#
|
|
|
|
# [*database_max_pool_size*]
|
2016-01-10 20:26:28 +08:00
|
|
|
# (Optional) Maximum number of SQL connections to keep open in a pool.
|
|
|
|
# Defaults to $::os_service_default.
|
2015-09-24 10:35:23 +02:00
|
|
|
#
|
|
|
|
# [*database_max_retries*]
|
2016-01-10 20:26:28 +08:00
|
|
|
# (Optional) Maximum db connection retries during startup.
|
2015-09-24 10:35:23 +02:00
|
|
|
# Setting -1 implies an infinite retry count.
|
2016-01-10 20:26:28 +08:00
|
|
|
# Defaults to $::os_service_default.
|
2015-09-24 10:35:23 +02:00
|
|
|
#
|
|
|
|
# [*database_retry_interval*]
|
2016-01-10 20:26:28 +08:00
|
|
|
# (Optional) Interval between retries of opening a sql connection.
|
|
|
|
# Defaults to $::os_service_default.
|
2015-09-24 10:35:23 +02:00
|
|
|
#
|
|
|
|
# [*database_max_overflow*]
|
2016-01-10 20:26:28 +08:00
|
|
|
# (Optional) If set, use this value for max_overflow with sqlalchemy.
|
|
|
|
# Defaults to $::os_service_default.
|
2012-12-10 16:52:40 +01:00
|
|
|
#
|
2016-01-10 20:26:28 +08:00
|
|
|
# [*sync_db*]
|
2016-11-11 06:28:35 -05:00
|
|
|
# (Optional) enable database schema installation.
|
2016-01-10 20:26:28 +08:00
|
|
|
# Defaults to true.
|
2014-02-19 13:50:34 -05:00
|
|
|
#
|
2018-03-22 11:09:50 +08:00
|
|
|
# [*database_pool_timeout*]
|
|
|
|
# (Optional) If set, use this value for pool_timeout with SQLAlchemy.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2012-12-10 17:22:46 +01:00
|
|
|
class ceilometer::db (
|
2016-05-09 16:25:48 +02:00
|
|
|
$database_db_max_retries = $::os_service_default,
|
2018-03-05 08:51:30 +08:00
|
|
|
$database_connection = 'mysql+pymysql://ceilometer:ceilometer@localhost/ceilometer',
|
2015-11-24 11:20:09 +00:00
|
|
|
$database_idle_timeout = $::os_service_default,
|
|
|
|
$database_min_pool_size = $::os_service_default,
|
|
|
|
$database_max_pool_size = $::os_service_default,
|
|
|
|
$database_max_retries = $::os_service_default,
|
|
|
|
$database_retry_interval = $::os_service_default,
|
|
|
|
$database_max_overflow = $::os_service_default,
|
2018-03-22 11:09:50 +08:00
|
|
|
$database_pool_timeout = $::os_service_default,
|
2015-09-24 10:35:23 +02:00
|
|
|
$sync_db = true,
|
2013-04-04 19:51:49 -04:00
|
|
|
) {
|
|
|
|
|
2016-11-29 09:21:48 +08:00
|
|
|
include ::ceilometer::deps
|
2012-12-10 17:22:46 +01:00
|
|
|
|
2016-03-29 15:58:33 +03:00
|
|
|
oslo::db { 'ceilometer_config':
|
2016-05-09 16:25:48 +02:00
|
|
|
db_max_retries => $database_db_max_retries,
|
2016-03-29 15:58:33 +03:00
|
|
|
connection => $database_connection,
|
|
|
|
idle_timeout => $database_idle_timeout,
|
|
|
|
min_pool_size => $database_min_pool_size,
|
|
|
|
max_retries => $database_max_retries,
|
|
|
|
retry_interval => $database_retry_interval,
|
|
|
|
max_pool_size => $database_max_pool_size,
|
|
|
|
max_overflow => $database_max_overflow,
|
2018-03-22 11:09:50 +08:00
|
|
|
pool_timeout => $database_pool_timeout,
|
2012-12-10 16:52:40 +01:00
|
|
|
}
|
2012-12-10 17:22:46 +01:00
|
|
|
|
2015-07-22 14:53:29 +02:00
|
|
|
if $sync_db {
|
|
|
|
include ::ceilometer::db::sync
|
2012-12-10 17:22:46 +01:00
|
|
|
}
|
|
|
|
|
2012-12-10 16:52:40 +01:00
|
|
|
}
|