From b6f79567e23709b87e538ac75f7be20a306f7438 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Fri, 16 Dec 2016 16:22:54 -0700 Subject: Add cell_v2 setup for nova We need to run the basic cell v2 setup for nova as it is required for Ocata. Change-Id: I693239ff5026f58a65eb6278b1a8fcb97af4f561 Depends-On: I43ba77cd4c8da7c6dc117ab0bd53e5cd330dc3de Depends-On: I9462ef16fd64a577c3f950bd121f0bd28670fabc Closes-Bug: #1649341 --- manifests/profile/base/database/mysql.pp | 71 +++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) (limited to 'manifests/profile/base/database') diff --git a/manifests/profile/base/database/mysql.pp b/manifests/profile/base/database/mysql.pp index a039439..634b615 100644 --- a/manifests/profile/base/database/mysql.pp +++ b/manifests/profile/base/database/mysql.pp @@ -66,6 +66,38 @@ # 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, $bootstrap_node = hiera('bootstrap_nodeid', undef), @@ -76,6 +108,12 @@ 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) { @@ -176,7 +214,38 @@ class tripleo::profile::base::database::mysql ( } if hiera('nova_api_enabled', false) { include ::nova::db::mysql - include ::nova::db::mysql_api + # 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'))))) + + # TODO(aschultz): switch this back to an include once setup_cell0 in THT + class { '::nova::db::mysql_api': + setup_cell0 => true, + } + 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 -- cgit 1.2.3-korg