Merge "Add cell0 database creation in postgresql"
This commit is contained in:
@@ -34,7 +34,7 @@
|
|||||||
# [*setup_cell0*]
|
# [*setup_cell0*]
|
||||||
# (Optional) Setup a cell0 for the cell_v2 functionality. This option will
|
# (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.
|
# 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(
|
class nova::db::mysql(
|
||||||
|
@@ -24,12 +24,18 @@
|
|||||||
# (Optional) Privileges given to the database user.
|
# (Optional) Privileges given to the database user.
|
||||||
# Default to 'ALL'
|
# 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(
|
class nova::db::postgresql(
|
||||||
$password,
|
$password,
|
||||||
$dbname = 'nova',
|
$dbname = 'nova',
|
||||||
$user = 'nova',
|
$user = 'nova',
|
||||||
$encoding = undef,
|
$encoding = undef,
|
||||||
$privileges = 'ALL',
|
$privileges = 'ALL',
|
||||||
|
$setup_cell0 = true,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ::nova::deps
|
include ::nova::deps
|
||||||
@@ -42,6 +48,17 @@ class nova::db::postgresql(
|
|||||||
privileges => $privileges,
|
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']
|
Anchor['nova::db::begin']
|
||||||
~> Class['nova::db::postgresql']
|
~> Class['nova::db::postgresql']
|
||||||
~> Anchor['nova::db::end']
|
~> 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
|
describe 'nova::db::postgresql' do
|
||||||
|
|
||||||
shared_examples_for 'nova::db::postgresql' do
|
shared_examples 'nova::db::postgresql' do
|
||||||
let :req_params do
|
let :req_params do
|
||||||
{ :password => 'pw' }
|
{ :password => 'pw' }
|
||||||
end
|
end
|
||||||
@@ -16,12 +16,30 @@ describe 'nova::db::postgresql' do
|
|||||||
req_params
|
req_params
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_postgresql__server__db('nova').with(
|
it { should contain_openstacklib__db__postgresql('nova').with(
|
||||||
:user => 'nova',
|
:password_hash => 'md557ae0608fad632bf0155cb9502a6b454',
|
||||||
:password => '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
|
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
|
end
|
||||||
|
|
||||||
on_supported_os({
|
on_supported_os({
|
||||||
|
Reference in New Issue
Block a user