Move nova cells db sync into nova-api profile
Having the db_sync code live in the mysql profile causes coupling that doesn't work unless your MySQL server has the latest Nova packages installed. This may not work for some baremetal setups (where an isolated database exists) or with containers where the MySQL container definately doesn't have nova packages installed. Moving this code into the nova-api role also matches where we were already db syncing the normal API database so it should be fine and safe. Change-Id: Ib625e2ac9c8d6bd1d335c58e291facc4ea5839ae Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
parent
77cd102c9a
commit
7af9ff39e9
|
@ -66,37 +66,6 @@
|
|||
# for more details.
|
||||
# Defaults to hiera('step')
|
||||
#
|
||||
# [*nova_messaging_driver*]
|
||||
# Driver for messaging service. Will fallback to looking up in hiera
|
||||
# using hiera('messaging_service_name', 'rabbit') if the parameter is not
|
||||
# specified.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*nova_messaging_hosts*]
|
||||
# list of the messaging host fqdns. Will fallback to looking up in hiera
|
||||
# using hiera('rabbitmq_node_names') if the parameter is not specified.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*nova_messaging_port*]
|
||||
# IP port for messaging service. Will fallback to looking up in hiera using
|
||||
# hiera('nova::rabbit_port', 5672) if the parameter is not specified.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*nova_messaging_username*]
|
||||
# Username for messaging nova queue. Will fallback to looking up in hiera
|
||||
# using hiera('nova::rabbit_userid', 'guest') if the parameter is not
|
||||
# specified.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*nova_messaging_password*]
|
||||
# Password for messaging nova queue. Will fallback to looking up in hiera
|
||||
# using hiera('nova::rabbit_password') if the parameter is not specified.
|
||||
# Defaults to undef.
|
||||
#
|
||||
# [*nova_messaging_use_ssl*]
|
||||
# Flag indicating ssl usage. Will fallback to looking up in hiera using
|
||||
# hiera('nova::rabbit_use_ssl', '0') if the parameter is not specified.
|
||||
# Defaults to undef.
|
||||
#
|
||||
class tripleo::profile::base::database::mysql (
|
||||
$bind_address = $::hostname,
|
||||
|
@ -108,12 +77,6 @@ class tripleo::profile::base::database::mysql (
|
|||
$mysql_server_options = {},
|
||||
$remove_default_accounts = true,
|
||||
$step = hiera('step'),
|
||||
$nova_messaging_driver = undef,
|
||||
$nova_messaging_hosts = undef,
|
||||
$nova_messaging_password = undef,
|
||||
$nova_messaging_port = undef,
|
||||
$nova_messaging_username = undef,
|
||||
$nova_messaging_use_ssl = undef,
|
||||
) {
|
||||
|
||||
if $::hostname == downcase($bootstrap_node) {
|
||||
|
@ -214,35 +177,7 @@ class tripleo::profile::base::database::mysql (
|
|||
}
|
||||
if hiera('nova_api_enabled', false) {
|
||||
include ::nova::db::mysql
|
||||
# NOTE(aschultz): I am generally opposed to this, however given that the
|
||||
# nova api is optional, we need to do this lookups only if not provided
|
||||
# via parameters.
|
||||
$messaging_driver_real = pick($nova_messaging_driver,
|
||||
hiera('messaging_service_name', 'rabbit'))
|
||||
$messaging_hosts_real = any2array(
|
||||
pick($nova_messaging_hosts, hiera('rabbitmq_node_names')))
|
||||
# TODO(aschultz): remove sprintf once we properly type the port, needs
|
||||
# to be a string for the os_transport_url function.
|
||||
$messaging_port_real = sprintf('%s',
|
||||
pick($nova_messaging_port, hiera('nova::rabbit_port', '5672')))
|
||||
$messaging_username_real = pick($nova_messaging_username,
|
||||
hiera('nova::rabbit_userid', 'guest'))
|
||||
$messaging_password_real = pick($nova_messaging_password,
|
||||
hiera('nova::rabbit_password'))
|
||||
$messaging_use_ssl_real = sprintf('%s', bool2num(str2bool(
|
||||
pick($nova_messaging_use_ssl, hiera('nova::rabbit_user_ssl', '0')))))
|
||||
|
||||
include ::nova::db::mysql_api
|
||||
class { '::nova::db::sync_cell_v2':
|
||||
transport_url => os_transport_url({
|
||||
'transport' => $messaging_driver_real,
|
||||
'hosts' => $messaging_hosts_real,
|
||||
'port' => $messaging_port_real,
|
||||
'username' => $messaging_username_real,
|
||||
'password' => $messaging_password_real,
|
||||
'ssl' => $messaging_use_ssl_real,
|
||||
}),
|
||||
}
|
||||
}
|
||||
if hiera('sahara_api_enabled', false) {
|
||||
include ::sahara::db::mysql
|
||||
|
|
|
@ -50,6 +50,10 @@
|
|||
# Username for messaging nova queue
|
||||
# Defaults to hiera('nova::rabbit_userid', 'guest')
|
||||
#
|
||||
# [*messaging_use_ssl*]
|
||||
# Flag indicating ssl usage.
|
||||
# Defaults to hiera('nova::rabbit_use_ssl', '0')
|
||||
#
|
||||
# [*nova_compute_enabled*]
|
||||
# (Optional) Whether or not nova-compute is enabled.
|
||||
# Defaults to false
|
||||
|
@ -67,6 +71,7 @@ class tripleo::profile::base::nova (
|
|||
$messaging_password = hiera('nova::rabbit_password'),
|
||||
$messaging_port = hiera('nova::rabbit_port', '5672'),
|
||||
$messaging_username = hiera('nova::rabbit_userid', 'guest'),
|
||||
$messaging_use_ssl = hiera('nova::rabbit_use_ssl', '0'),
|
||||
$nova_compute_enabled = false,
|
||||
$step = hiera('step'),
|
||||
) {
|
||||
|
@ -83,6 +88,7 @@ class tripleo::profile::base::nova (
|
|||
}
|
||||
|
||||
if hiera('step') >= 4 or (hiera('step') >= 3 and $sync_db) {
|
||||
$messaging_use_ssl_real = sprintf('%s', bool2num(str2bool($messaging_use_ssl)))
|
||||
# TODO(ccamacho): remove sprintf once we properly type the port, needs
|
||||
# to be a string for the os_transport_url function.
|
||||
class { '::nova' :
|
||||
|
@ -92,6 +98,7 @@ class tripleo::profile::base::nova (
|
|||
'port' => sprintf('%s', $messaging_port),
|
||||
'username' => $messaging_username,
|
||||
'password' => $messaging_password,
|
||||
'ssl' => $messaging_use_ssl_real,
|
||||
}),
|
||||
}
|
||||
include ::nova::config
|
||||
|
|
|
@ -85,6 +85,25 @@ class tripleo::profile::base::nova::api (
|
|||
$tls_keyfile = undef
|
||||
}
|
||||
|
||||
if ($step >= 3 and $sync_db) {
|
||||
$messaging_hosts_real = any2array($::tripleo::profile::base::nova::messaging_hosts)
|
||||
# TODO(aschultz): remove sprintf once we properly type the port, needs
|
||||
# to be a string for the os_transport_url function.
|
||||
$messaging_port_real = sprintf('%s', $::tripleo::profile::base::nova::messaging_port)
|
||||
$messaging_use_ssl_real = sprintf('%s', bool2num(str2bool($::tripleo::profile::base::nova::messaging_use_ssl)))
|
||||
|
||||
class { '::nova::db::sync_cell_v2':
|
||||
transport_url => os_transport_url({
|
||||
'transport' => $::tripleo::profile::base::nova::messaging_driver,
|
||||
'hosts' => $messaging_hosts_real,
|
||||
'port' => $messaging_port_real,
|
||||
'username' => $::tripleo::profile::base::nova::messaging_username,
|
||||
'password' => $::tripleo::profile::base::nova::messaging_password,
|
||||
'ssl' => $messaging_use_ssl_real,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
if $step >= 4 or ($step >= 3 and $sync_db) {
|
||||
|
||||
if hiera('nova::use_ipv6', false) {
|
||||
|
|
Loading…
Reference in New Issue