Fix mysql connection

URL mysql://scott:***@some_host/some_db does not contain a '+drivername'
portion, and will make use of a default driver. A full dbname+drivername://
protocol is recommended. For MySQL, it is strongly recommended that
mysql+pymysql:// be specified for maximum service compatibility.

Change-Id: Ic51da9a9d0c6380eeb4da85d192a5a19ebf96c79
Closes-Bug: #1753342
(cherry picked from commit 785ab85b29)
This commit is contained in:
ZhongShengping 2018-03-05 08:57:21 +08:00 committed by zhongshengping
parent 694465fcfc
commit 54b4f8d847
2 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@
#
# [*database_connection*]
# (Optional) Url used to connect to database.
# Defaults to "mysql://magnum:magnum@localhost:3306/magnum".
# Defaults to "mysql+pymysql://magnum:magnum@localhost:3306/magnum".
#
# [*database_idle_timeout*]
# (Optional) Timeout when db connections should be reaped.
@ -39,7 +39,7 @@
# Defaults to $::os_service_default
#
class magnum::db (
$database_connection = 'mysql://magnum:magnum@localhost:3306/magnum',
$database_connection = 'mysql+pymysql://magnum:magnum@localhost:3306/magnum',
$database_idle_timeout = $::os_service_default,
$database_min_pool_size = $::os_service_default,
$database_max_pool_size = $::os_service_default,

View File

@ -6,7 +6,7 @@ describe 'magnum::db' do
context 'with default parameters' do
it { is_expected.to contain_oslo__db('magnum_config').with(
:db_max_retries => '<SERVICE DEFAULT>',
:connection => 'mysql://magnum:magnum@localhost:3306/magnum',
:connection => 'mysql+pymysql://magnum:magnum@localhost:3306/magnum',
:idle_timeout => '<SERVICE DEFAULT>',
:min_pool_size => '<SERVICE DEFAULT>',
:max_pool_size => '<SERVICE DEFAULT>',
@ -18,7 +18,7 @@ describe 'magnum::db' do
context 'with specific parameters' do
let :params do
{ :database_connection => 'mysql://magnum:magnum@localhost/magnum',
{ :database_connection => 'mysql+pymysql://magnum:magnum@localhost/magnum',
:database_idle_timeout => '3601',
:database_min_pool_size => '2',
:database_max_retries => '11',
@ -31,7 +31,7 @@ describe 'magnum::db' do
it { is_expected.to contain_oslo__db('magnum_config').with(
:db_max_retries => '-1',
:connection => 'mysql://magnum:magnum@localhost/magnum',
:connection => 'mysql+pymysql://magnum:magnum@localhost/magnum',
:idle_timeout => '3601',
:min_pool_size => '2',
:max_pool_size => '11',