Initial step to clean up db and mq attributes
Here we move db and mq attributes already present in default.rb
attributes into new files (database.rb,messaging.rb). Additionally, we
pull in rabbit/mq attributes from
openstack-{block-storage,compute,image,metering,network} while
transforming namespace from openstack.SERVICE.mq and
openstack.SERVICE.rabbit to openstack.mq.SERVICE
and openstack.mq.SERVICE.rabbit. Lastly, we copy
openstack.SERVICE.db.username attribute from
openstack-{compute,dashboard,identity,image,metering,network} while
transforming namespace to openstack.db.SERVICE.username.
Change-Id: I50c900aa2ba92ce53f4a6ad05aeabd59e701b514
Implements: blueprint clean-up-attr-for-mq-and-db
2014-01-15 15:11:58 +00:00
|
|
|
#
|
2020-01-07 16:33:05 -08:00
|
|
|
# Cookbook:: openstack-common
|
Initial step to clean up db and mq attributes
Here we move db and mq attributes already present in default.rb
attributes into new files (database.rb,messaging.rb). Additionally, we
pull in rabbit/mq attributes from
openstack-{block-storage,compute,image,metering,network} while
transforming namespace from openstack.SERVICE.mq and
openstack.SERVICE.rabbit to openstack.mq.SERVICE
and openstack.mq.SERVICE.rabbit. Lastly, we copy
openstack.SERVICE.db.username attribute from
openstack-{compute,dashboard,identity,image,metering,network} while
transforming namespace to openstack.db.SERVICE.username.
Change-Id: I50c900aa2ba92ce53f4a6ad05aeabd59e701b514
Implements: blueprint clean-up-attr-for-mq-and-db
2014-01-15 15:11:58 +00:00
|
|
|
# Attributes:: database
|
|
|
|
#
|
2021-10-13 23:28:32 -07:00
|
|
|
# Copyright:: 2012-2021, AT&T Services, Inc.
|
|
|
|
# Copyright:: 2013-2021, SUSE Linux GmbH
|
|
|
|
# Copyright:: 2020-2021, Oregon State University
|
Initial step to clean up db and mq attributes
Here we move db and mq attributes already present in default.rb
attributes into new files (database.rb,messaging.rb). Additionally, we
pull in rabbit/mq attributes from
openstack-{block-storage,compute,image,metering,network} while
transforming namespace from openstack.SERVICE.mq and
openstack.SERVICE.rabbit to openstack.mq.SERVICE
and openstack.mq.SERVICE.rabbit. Lastly, we copy
openstack.SERVICE.db.username attribute from
openstack-{compute,dashboard,identity,image,metering,network} while
transforming namespace to openstack.db.SERVICE.username.
Change-Id: I50c900aa2ba92ce53f4a6ad05aeabd59e701b514
Implements: blueprint clean-up-attr-for-mq-and-db
2014-01-15 15:11:58 +00:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
# ======================== OpenStack DB Support ================================
|
|
|
|
#
|
|
|
|
# This section of node attributes stores information about the database hosts
|
|
|
|
# used in an OpenStack deployment.
|
|
|
|
#
|
|
|
|
# There is no 'scheme' key. Instead, there is a 'service_type' key that should
|
2015-08-27 14:27:08 -05:00
|
|
|
# contain one of 'sqlite', 'mysql', or 'postgresql'
|
Initial step to clean up db and mq attributes
Here we move db and mq attributes already present in default.rb
attributes into new files (database.rb,messaging.rb). Additionally, we
pull in rabbit/mq attributes from
openstack-{block-storage,compute,image,metering,network} while
transforming namespace from openstack.SERVICE.mq and
openstack.SERVICE.rabbit to openstack.mq.SERVICE
and openstack.mq.SERVICE.rabbit. Lastly, we copy
openstack.SERVICE.db.username attribute from
openstack-{compute,dashboard,identity,image,metering,network} while
transforming namespace to openstack.db.SERVICE.username.
Change-Id: I50c900aa2ba92ce53f4a6ad05aeabd59e701b514
Implements: blueprint clean-up-attr-for-mq-and-db
2014-01-15 15:11:58 +00:00
|
|
|
#
|
|
|
|
# The ::Openstack::db(<SERVICE_NAME>) library routine allows a lookup from any recipe
|
|
|
|
# to this array, returning the host information for the server that contains
|
|
|
|
# the database for <SERVICE_NAME>, where <SERVICE_NAME> is one of 'compute' (Nova),
|
|
|
|
# 'image' (Glance), 'identity' (Keystone), 'network' (Neutron), or 'volume' (Cinder)
|
|
|
|
#
|
|
|
|
# The ::Openstack::db_connection(<SERVICE_NAME>, <USER>, <PASSWORD>) library routine
|
|
|
|
# returns the SQLAlchemy DB URI for <SERVICE_NAME>, with the supplied user and password
|
|
|
|
# that a calling service might be using when connecting to the database.
|
|
|
|
#
|
|
|
|
# For example, let's assume that the database that is used by the OpenStack Identity
|
|
|
|
# service (Keystone) is configured as follows:
|
|
|
|
#
|
|
|
|
# host: 192.168.0.3
|
|
|
|
# port: 3306
|
|
|
|
# service_type: mysql
|
|
|
|
# db_name: keystone
|
|
|
|
#
|
|
|
|
# Further suppose that a node running the OpenStack Identity API service needs to
|
|
|
|
# connect to the above identity database server. It has the following in it's node
|
|
|
|
# attributes:
|
|
|
|
#
|
|
|
|
# node['openstack']['db']['identity']['username'] = 'keystone'
|
|
|
|
#
|
|
|
|
# In a 'keystone' recipe, you might find the following code:
|
|
|
|
#
|
|
|
|
# user = node['openstack']['db']['identity']['username']
|
|
|
|
# pass = get_password 'db', 'keystone'
|
|
|
|
#
|
|
|
|
# sql_connection = ::Openstack::db_uri('identity', user, pass)
|
|
|
|
#
|
|
|
|
# The sql_connection variable would then be set to "mysql://keystone:password@192.168.0.3:keystone"
|
|
|
|
# and could then be written to the keystone.conf file in a template.
|
|
|
|
#
|
|
|
|
# Database Migrations:
|
|
|
|
#
|
|
|
|
# node['openstack']['db'][<SERVICE_NAME>]['migrate']
|
|
|
|
#
|
|
|
|
# The above attribute causes database migrations to be executed for the given
|
|
|
|
# service. There are cases where migrations should not be executed. For
|
|
|
|
# example when upgrading a zone, and the image or identity database are replicated
|
|
|
|
# across many zones.
|
|
|
|
#
|
|
|
|
|
2014-02-18 14:35:20 -05:00
|
|
|
# ******************** Database Endpoint **************************************
|
2016-02-11 06:40:54 +01:00
|
|
|
%w(endpoints bind_service).each do |type|
|
|
|
|
default['openstack'][type]['db']['host'] = '127.0.0.1'
|
|
|
|
default['openstack'][type]['db']['port'] = '3306'
|
|
|
|
end
|
|
|
|
default['openstack']['bind_service']['db']['interface'] = nil
|
2015-07-09 02:04:39 -05:00
|
|
|
default['openstack']['endpoints']['db']['enabled_slave'] = false
|
|
|
|
default['openstack']['endpoints']['db']['slave_host'] = '127.0.0.1'
|
|
|
|
default['openstack']['endpoints']['db']['slave_port'] = '3316'
|
2014-02-18 14:35:20 -05:00
|
|
|
|
2016-02-11 06:40:54 +01:00
|
|
|
# If you bind the database to a specific ip-address (you can only choose one
|
|
|
|
# here for mysql, so 127.0.0.1 + external address is not an option), to allow
|
|
|
|
# the services and applications to access it via this one, you probably do not
|
|
|
|
# want to allow the db root user to access it via this external address. In this
|
|
|
|
# case you have the option to allow root access only via localhost, which
|
|
|
|
# will work for mysql databases, since it will use a direct connection via
|
|
|
|
# the socket, so the database does not have not to listen on 127.0.0.1.
|
|
|
|
# Set this to 'localhost' for mysql to connect via socket.
|
2017-08-02 01:01:23 -04:00
|
|
|
default['openstack']['endpoints']['db']['host_for_db_root_user'] = 'localhost'
|
2016-02-11 06:40:54 +01:00
|
|
|
|
Initial step to clean up db and mq attributes
Here we move db and mq attributes already present in default.rb
attributes into new files (database.rb,messaging.rb). Additionally, we
pull in rabbit/mq attributes from
openstack-{block-storage,compute,image,metering,network} while
transforming namespace from openstack.SERVICE.mq and
openstack.SERVICE.rabbit to openstack.mq.SERVICE
and openstack.mq.SERVICE.rabbit. Lastly, we copy
openstack.SERVICE.db.username attribute from
openstack-{compute,dashboard,identity,image,metering,network} while
transforming namespace to openstack.db.SERVICE.username.
Change-Id: I50c900aa2ba92ce53f4a6ad05aeabd59e701b514
Implements: blueprint clean-up-attr-for-mq-and-db
2014-01-15 15:11:58 +00:00
|
|
|
# Default database attributes
|
|
|
|
default['openstack']['db']['server_role'] = 'os-ops-database'
|
2014-08-15 01:00:28 +00:00
|
|
|
# Database charset during create database
|
|
|
|
default['openstack']['db']['charset'] = {
|
2015-05-28 12:11:23 -05:00
|
|
|
mysql: 'utf8',
|
2015-06-05 16:02:38 +02:00
|
|
|
'percona-cluster' => 'utf8',
|
2015-05-28 12:11:23 -05:00
|
|
|
mariadb: 'utf8',
|
|
|
|
postgresql: nil,
|
|
|
|
pgsql: nil,
|
|
|
|
sqlite: nil,
|
2015-06-16 05:47:46 -05:00
|
|
|
nosql: nil,
|
2017-08-20 11:16:38 -04:00
|
|
|
galera: 'utf8',
|
2014-08-15 01:00:28 +00:00
|
|
|
}
|
|
|
|
|
2014-05-27 11:13:39 -05:00
|
|
|
# Database connection options. Should include starting '?'
|
|
|
|
default['openstack']['db']['options'] = {
|
2015-05-28 12:11:23 -05:00
|
|
|
mysql: "?charset=#{node['openstack']['db']['charset']['mysql']}",
|
2015-06-05 16:02:38 +02:00
|
|
|
'percona-cluster' => "?charset=#{node['openstack']['db']['charset']['percona-cluster']}",
|
2015-05-28 12:11:23 -05:00
|
|
|
mariadb: "?charset=#{node['openstack']['db']['charset']['mariadb']}",
|
|
|
|
sqlite: '',
|
2015-06-16 05:47:46 -05:00
|
|
|
nosql: '',
|
2017-08-20 11:16:38 -04:00
|
|
|
galera: "?charset=#{node['openstack']['db']['charset']['galera']}",
|
2014-05-27 11:13:39 -05:00
|
|
|
}
|
Initial step to clean up db and mq attributes
Here we move db and mq attributes already present in default.rb
attributes into new files (database.rb,messaging.rb). Additionally, we
pull in rabbit/mq attributes from
openstack-{block-storage,compute,image,metering,network} while
transforming namespace from openstack.SERVICE.mq and
openstack.SERVICE.rabbit to openstack.mq.SERVICE
and openstack.mq.SERVICE.rabbit. Lastly, we copy
openstack.SERVICE.db.username attribute from
openstack-{compute,dashboard,identity,image,metering,network} while
transforming namespace to openstack.db.SERVICE.username.
Change-Id: I50c900aa2ba92ce53f4a6ad05aeabd59e701b514
Implements: blueprint clean-up-attr-for-mq-and-db
2014-01-15 15:11:58 +00:00
|
|
|
|
2015-03-26 14:02:18 +08:00
|
|
|
# platform and DBMS-specific python client packages
|
|
|
|
default['openstack']['db']['python_packages'] = {
|
2017-11-26 22:40:50 -08:00
|
|
|
postgresql: [],
|
2017-08-20 11:16:38 -04:00
|
|
|
sqlite: [],
|
2015-03-26 14:02:18 +08:00
|
|
|
}
|
2015-02-12 16:04:13 +08:00
|
|
|
case node['platform_family']
|
|
|
|
when 'rhel'
|
|
|
|
default['openstack']['db']['service_type'] = 'mariadb'
|
2021-10-15 15:08:36 -07:00
|
|
|
if node['platform_version'].to_i >= 8
|
|
|
|
default['openstack']['db']['python_packages']['mariadb'] = ['python3-PyMySQL']
|
|
|
|
default['openstack']['db']['python_packages']['percona-cluster'] = ['python3-PyMySQL']
|
|
|
|
default['openstack']['db']['python_packages']['galera'] = ['python3-PyMySQL']
|
|
|
|
else
|
|
|
|
default['openstack']['db']['python_packages']['mariadb'] = ['MySQL-python']
|
|
|
|
default['openstack']['db']['python_packages']['percona-cluster'] = ['MySQL-python']
|
|
|
|
default['openstack']['db']['python_packages']['galera'] = ['MySQL-python']
|
|
|
|
end
|
2015-02-12 16:04:13 +08:00
|
|
|
when 'debian'
|
2017-11-26 22:40:50 -08:00
|
|
|
default['openstack']['db']['service_type'] = 'mariadb'
|
2019-09-18 11:07:21 +00:00
|
|
|
default['openstack']['db']['python_packages']['mariadb'] = ['python3-mysqldb']
|
|
|
|
default['openstack']['db']['python_packages']['percona-cluster'] = ['python3-mysqldb']
|
|
|
|
default['openstack']['db']['python_packages']['galera'] = ['python3-mysqldb']
|
2015-02-12 16:04:13 +08:00
|
|
|
end
|
|
|
|
|
2017-08-02 01:01:23 -04:00
|
|
|
# database sockets, because different
|
|
|
|
case node['platform_family']
|
|
|
|
when 'rhel'
|
|
|
|
default['openstack']['db']['socket'] = '/var/lib/mysql/mysql.sock'
|
|
|
|
when 'debian'
|
2017-11-26 22:40:50 -08:00
|
|
|
default['openstack']['db']['socket'] = '/var/run/mysqld/mysqld.sock'
|
2017-08-02 01:01:23 -04:00
|
|
|
end
|
|
|
|
|
2015-04-22 09:39:30 +08:00
|
|
|
# Database used by the OpenStack services
|
|
|
|
node['openstack']['common']['services'].each do |service, project|
|
|
|
|
default['openstack']['db'][service]['service_type'] = node['openstack']['db']['service_type']
|
|
|
|
default['openstack']['db'][service]['host'] = node['openstack']['endpoints']['db']['host']
|
|
|
|
default['openstack']['db'][service]['port'] = node['openstack']['endpoints']['db']['port']
|
|
|
|
default['openstack']['db'][service]['db_name'] = project
|
|
|
|
default['openstack']['db'][service]['username'] = project
|
|
|
|
default['openstack']['db'][service]['options'] = node['openstack']['db']['options']
|
|
|
|
|
2015-07-09 02:04:39 -05:00
|
|
|
default['openstack']['db'][service]['slave_host'] = node['openstack']['endpoints']['db']['slave_host']
|
|
|
|
default['openstack']['db'][service]['slave_port'] = node['openstack']['endpoints']['db']['slave_port']
|
|
|
|
|
2017-08-02 01:01:23 -04:00
|
|
|
default['openstack']['db'][service]['socket'] = node['openstack']['db']['socket']
|
|
|
|
|
2015-04-22 09:39:30 +08:00
|
|
|
case service
|
|
|
|
when 'dashboard'
|
|
|
|
default['openstack']['db'][service]['migrate'] = true
|
|
|
|
when 'identity'
|
|
|
|
default['openstack']['db'][service]['migrate'] = true
|
|
|
|
when 'image'
|
|
|
|
default['openstack']['db'][service]['migrate'] = true
|
|
|
|
when 'network'
|
|
|
|
# The SQLAlchemy connection string used to connect to the slave database
|
|
|
|
default['openstack']['db'][service]['slave_connection'] = ''
|
|
|
|
|
|
|
|
# Database reconnection retry times - in event connectivity is lost
|
|
|
|
default['openstack']['db'][service]['max_retries'] = 10
|
|
|
|
|
|
|
|
# Database reconnection interval in seconds - if the initial connection to the database fails
|
|
|
|
default['openstack']['db'][service]['retry_interval'] = 10
|
|
|
|
|
|
|
|
# Minimum number of SQL connections to keep open in a pool
|
|
|
|
default['openstack']['db'][service]['min_pool_size'] = 1
|
|
|
|
|
|
|
|
# Maximum number of SQL connections to keep open in a pool
|
|
|
|
default['openstack']['db'][service]['max_pool_size'] = 10
|
|
|
|
|
|
|
|
# Timeout in seconds before idle sql connections are reaped
|
|
|
|
default['openstack']['db'][service]['idle_timeout'] = 3600
|
|
|
|
|
|
|
|
# If set, use this value for max_overflow with sqlalchemy
|
|
|
|
default['openstack']['db'][service]['max_overflow'] = 20
|
|
|
|
|
|
|
|
# Verbosity of SQL debugging information. 0=None, 100=Everything
|
|
|
|
default['openstack']['db'][service]['connection_debug'] = 0
|
|
|
|
|
|
|
|
# Add python stack traces to SQL as comment strings
|
|
|
|
default['openstack']['db'][service]['connection_trace'] = false
|
|
|
|
|
|
|
|
# If set, use this value for pool_timeout with sqlalchemy
|
|
|
|
default['openstack']['db'][service]['pool_timeout'] = 10
|
|
|
|
when 'telemetry'
|
|
|
|
default['openstack']['db'][service]['nosql']['used'] = false
|
|
|
|
default['openstack']['db'][service]['nosql']['port'] = '27017'
|
|
|
|
end
|
|
|
|
end
|
2015-01-20 15:54:36 +08:00
|
|
|
|
2015-02-12 15:12:32 -06:00
|
|
|
# DB key to the get_password library routine
|
Initial step to clean up db and mq attributes
Here we move db and mq attributes already present in default.rb
attributes into new files (database.rb,messaging.rb). Additionally, we
pull in rabbit/mq attributes from
openstack-{block-storage,compute,image,metering,network} while
transforming namespace from openstack.SERVICE.mq and
openstack.SERVICE.rabbit to openstack.mq.SERVICE
and openstack.mq.SERVICE.rabbit. Lastly, we copy
openstack.SERVICE.db.username attribute from
openstack-{compute,dashboard,identity,image,metering,network} while
transforming namespace to openstack.db.SERVICE.username.
Change-Id: I50c900aa2ba92ce53f4a6ad05aeabd59e701b514
Implements: blueprint clean-up-attr-for-mq-and-db
2014-01-15 15:11:58 +00:00
|
|
|
default['openstack']['db']['root_user_key'] = 'mysqlroot'
|