puppet-nova/manifests/db/mysql.pp
Oliver Walsh dc2f3a3586 Implement a proper cell_v2 setup
Rather than use simple_cell_setup which expects that there are already
existing computes, this change uses map_cell0 & create_cell to setup
cell_v2. Once the computes are configured, the cell_v2 discover_hosts
should be used to finalized the installation.

In addition, the db syncs need to be reordered as the api db sync
should run before the the cell_v2 setup. The main db sync should run
after.

map_cell0/simple_cell_setup now uses main nova DB connection instead
of the api DB connection.

Change-Id: I591b451197dc3bd0783978f5e3d2b1c830afe54e
Closes-Bug: #1656276
Related-Bug: #1656673
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
2017-01-24 16:21:07 -07:00

83 lines
2.0 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_general_ci'
#
# [*allowed_hosts*]
# (optional) Additional hosts that are allowed to access this DB
# Defaults to undef
#
# [*setup_cell0*]
# (optional) Setup a cell0 for the cell_v2 functionality. This option will
# be set to true by default in Ocata when the cell v2 setup is mandatory.
# Defaults to false
#
class nova::db::mysql(
$password,
$dbname = 'nova',
$user = 'nova',
$host = '127.0.0.1',
$charset = 'utf8',
$collate = 'utf8_general_ci',
$allowed_hosts = undef,
$setup_cell0 = true,
) {
include ::nova::deps
$setup_cell0_real = pick($::nova::db::mysql_api::setup_cell0, $setup_cell0)
::openstacklib::db::mysql { 'nova':
user => $user,
password_hash => mysql_password($password),
dbname => $dbname,
host => $host,
charset => $charset,
collate => $collate,
allowed_hosts => $allowed_hosts,
}
if $setup_cell0_real {
# need for cell_v2
::openstacklib::db::mysql { 'nova_cell0':
user => $user,
password_hash => mysql_password($password),
dbname => "${dbname}_cell0",
host => $host,
charset => $charset,
collate => $collate,
allowed_hosts => $allowed_hosts,
create_user => false,
}
}
Anchor['nova::db::begin']
~> Class['nova::db::mysql']
~> Anchor['nova::db::end']
}