
Change default charset to utf8 and default collation order to utf8_unicode_ci to align with upstream defaults. Change-Id: I2aa59fd868476f599019e3029af36aa707139fe1 Closes-Bug: #1302088
100 lines
2.5 KiB
Puppet
100 lines
2.5 KiB
Puppet
# == Class: nova::db::mysql
|
|
#
|
|
# Class that configures mysql for nova
|
|
#
|
|
# === Parameters:
|
|
#
|
|
# [*password*]
|
|
# Password to use for the nova user
|
|
#
|
|
# [*dbname*]
|
|
# (optional) The name of the database
|
|
# Defaults to 'nova'
|
|
#
|
|
# [*user*]
|
|
# (optional) The mysql user to create
|
|
# Defaults to 'nova'
|
|
#
|
|
# [*host*]
|
|
# (optional) The IP address of the mysql server
|
|
# Defaults to '127.0.0.1'
|
|
#
|
|
# [*charset*]
|
|
# (optional) The charset to use for the nova database
|
|
# Defaults to 'utf8'
|
|
#
|
|
# [*collate*]
|
|
# (optional) The collate to use for the nova database
|
|
# Defaults to 'utf8_unicode_ci'
|
|
#
|
|
# [*allowed_hosts*]
|
|
# (optional) Additional hosts that are allowed to access this DB
|
|
# Defaults to undef
|
|
#
|
|
# [*cluster_id*]
|
|
# (optional) Deprecated. Does nothing
|
|
# Defaults to 'localzone'
|
|
#
|
|
# [*mysql_module*]
|
|
# (optional) Mysql puppet module version to use. Tested versions
|
|
# are 0.9 and 2.2.
|
|
# Defaults to '0.9'
|
|
#
|
|
class nova::db::mysql(
|
|
$password,
|
|
$dbname = 'nova',
|
|
$user = 'nova',
|
|
$host = '127.0.0.1',
|
|
$charset = 'utf8',
|
|
$collate = 'utf8_unicode_ci',
|
|
$allowed_hosts = undef,
|
|
$mysql_module = '0.9',
|
|
$cluster_id = undef
|
|
) {
|
|
|
|
if $cluster_id {
|
|
warning('The cluster_id parameter is deprecated and has no effect.')
|
|
}
|
|
|
|
if ($mysql_module >= 2.2) {
|
|
mysql::db { $dbname:
|
|
user => $user,
|
|
password => $password,
|
|
host => $host,
|
|
charset => $charset,
|
|
collate => $collate,
|
|
require => Class['mysql::server'],
|
|
}
|
|
} else {
|
|
require 'mysql::python'
|
|
|
|
mysql::db { $dbname:
|
|
user => $user,
|
|
password => $password,
|
|
host => $host,
|
|
charset => $charset,
|
|
require => Class['mysql::config'],
|
|
}
|
|
}
|
|
|
|
# Create the db instance before openstack-nova if its installed
|
|
Mysql::Db[$dbname] -> Anchor<| title == 'nova-start' |>
|
|
Mysql::Db[$dbname] ~> Exec<| title == 'nova-db-sync' |>
|
|
|
|
# Check allowed_hosts to avoid duplicate resource declarations
|
|
if is_array($allowed_hosts) and delete($allowed_hosts,$host) != [] {
|
|
$real_allowed_hosts = delete($allowed_hosts,$host)
|
|
} elsif is_string($allowed_hosts) and ($allowed_hosts != $host) {
|
|
$real_allowed_hosts = $allowed_hosts
|
|
}
|
|
|
|
if $real_allowed_hosts {
|
|
nova::db::mysql::host_access { $real_allowed_hosts:
|
|
user => $user,
|
|
password => $password,
|
|
database => $dbname,
|
|
mysql_module => $mysql_module,
|
|
}
|
|
}
|
|
}
|