Add cell0 database creation in postgresql
Add cell0 database creation like stx patched in [1]. Also fixes an faulty comment in the same resource for mysql. [1] https://git.starlingx.io/cgit/stx-integ/tree/config/puppet-modules/openstack/puppet-nova-11.4.0/centos/patches/0003-Create-nova_cell0-database.patch Change-Id: I4183ed4417c9beeccf8b7355ac217088302d0160
This commit is contained in:
parent
aea8506c0a
commit
9171b9b8b7
@ -34,7 +34,7 @@
|
||||
# [*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
|
||||
# Defaults to true
|
||||
#
|
||||
|
||||
class nova::db::mysql(
|
||||
|
@ -24,12 +24,18 @@
|
||||
# (Optional) Privileges given to the database user.
|
||||
# Default to 'ALL'
|
||||
#
|
||||
# [*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 true
|
||||
#
|
||||
class nova::db::postgresql(
|
||||
$password,
|
||||
$dbname = 'nova',
|
||||
$user = 'nova',
|
||||
$encoding = undef,
|
||||
$privileges = 'ALL',
|
||||
$dbname = 'nova',
|
||||
$user = 'nova',
|
||||
$encoding = undef,
|
||||
$privileges = 'ALL',
|
||||
$setup_cell0 = true,
|
||||
) {
|
||||
|
||||
include ::nova::deps
|
||||
@ -42,6 +48,17 @@ class nova::db::postgresql(
|
||||
privileges => $privileges,
|
||||
}
|
||||
|
||||
if $setup_cell0 {
|
||||
# need for cell_v2
|
||||
::openstacklib::db::postgresql { 'nova_cell0':
|
||||
password_hash => postgresql_password($user, $password),
|
||||
dbname => "${dbname}_cell0",
|
||||
user => $user,
|
||||
encoding => $encoding,
|
||||
privileges => $privileges,
|
||||
}
|
||||
}
|
||||
|
||||
Anchor['nova::db::begin']
|
||||
~> Class['nova::db::postgresql']
|
||||
~> Anchor['nova::db::end']
|
||||
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
nova::db::postgresql now creates the nova_cell0 database
|
||||
upgrade:
|
||||
- |
|
||||
nova::db::postgresql now creates the nova_cell0 database, you can disable
|
||||
this behaviour by setting setup_cell0 to false.
|
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe 'nova::db::postgresql' do
|
||||
|
||||
shared_examples_for 'nova::db::postgresql' do
|
||||
shared_examples 'nova::db::postgresql' do
|
||||
let :req_params do
|
||||
{ :password => 'pw' }
|
||||
end
|
||||
@ -16,12 +16,30 @@ describe 'nova::db::postgresql' do
|
||||
req_params
|
||||
end
|
||||
|
||||
it { is_expected.to contain_postgresql__server__db('nova').with(
|
||||
:user => 'nova',
|
||||
:password => 'md557ae0608fad632bf0155cb9502a6b454'
|
||||
it { should contain_openstacklib__db__postgresql('nova').with(
|
||||
:password_hash => 'md557ae0608fad632bf0155cb9502a6b454',
|
||||
:dbname => 'nova',
|
||||
:user => 'nova',
|
||||
:encoding => nil,
|
||||
:privileges => 'ALL',
|
||||
)}
|
||||
|
||||
it { should contain_openstacklib__db__postgresql('nova_cell0').with(
|
||||
:password_hash => 'md557ae0608fad632bf0155cb9502a6b454',
|
||||
:dbname => 'nova_cell0',
|
||||
:user => 'nova',
|
||||
:encoding => nil,
|
||||
:privileges => 'ALL',
|
||||
)}
|
||||
end
|
||||
|
||||
context 'when disabling cell0 setup' do
|
||||
let :params do
|
||||
{ :setup_cell0 => false}.merge(req_params)
|
||||
end
|
||||
|
||||
it { is_expected.to_not contain_openstacklib__db__postgresql('nova_cell0') }
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
|
Loading…
x
Reference in New Issue
Block a user