Implement a proper cell_v2 setup

Rather than use simple_cell_setup which expects that there are already
existing computes, this change uses map_cell0 & create_cell to setup
cell_v2. Once the computes are configured, the cell_v2 discover_hosts
should be used to finalized the installation.

In addition, the db syncs need to be reordered as the api db sync
should run before the the cell_v2 setup. The main db sync should run
after.

map_cell0/simple_cell_setup now uses main nova DB connection instead
of the api DB connection.

Change-Id: I591b451197dc3bd0783978f5e3d2b1c830afe54e
Closes-Bug: #1656276
Related-Bug: #1656673
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
This commit is contained in:
Oliver Walsh 2017-01-18 21:26:43 +00:00 committed by Alex Schultz
parent 661e91b0d5
commit dc2f3a3586
21 changed files with 493 additions and 165 deletions

51
manifests/cell_v2/cell.pp Normal file
View File

@ -0,0 +1,51 @@
# == Type: nova::cell_v2::cell
#
# Resource for managing cell_v2 cells.
#
# === Parameters
#
# [*extra_params*]
# (String) Extra parameters to pass to the nova-manage commands.
# Defaults to ''.
#
# [*transport_url*]
# (String) AMQP transport url for the cell.
# If not defined, the [DEFAULT]/transport_url is used from the nova
# configuration file.
# Defaults to undef.
#
# [*database_connection*]
# (String) Database connection url for the cell.
# If not defined, the [DEFAULT]/database_connection is used from the nova
# configuration file.
# Defaults to undef.
#
define nova::cell_v2::cell (
$extra_params = '',
$transport_url = undef,
$database_connection = undef
) {
include ::nova::deps
if $transport_url {
$transport_url_real = "--transport-url=${transport_url}"
} else {
$transport_url_real = ''
}
if $database_connection {
$database_connection_real = "--database_connection=${database_connection}"
} else {
$database_connection_real = ''
}
exec { "nova-cell_v2-cell-${title}":
path => [ '/bin', '/usr/bin' ],
command => "nova-manage ${extra_params} cell_v2 create_cell --name=${title} ${transport_url_real} ${database_connection_real}",
unless => "nova-manage ${extra_params} cell_v2 list_cells | grep -q ${title}",
logoutput => on_failure,
subscribe => Anchor['nova::cell_v2::begin'],
notify => Anchor['nova::cell_v2::end'],
}
}

View File

@ -0,0 +1,23 @@
# == Class: nova::cell_v2::discover_hosts
#
# Class to run the discover_hosts action for cell v2
#
# === Parameters
#
# [*extra_params*]
# (String) Extra parameters to pass to the nova-manage commands.
# Defaults to ''.
#
class nova::cell_v2::discover_hosts (
$extra_params = '',
) {
include ::nova::deps
exec { 'nova-cell_v2-discover_hosts':
path => ['/bin', '/usr/bin'],
command => "nova-manage ${extra_params} cell_v2 discover_hosts",
refreshonly => true,
subscribe => Anchor['nova::service::end']
}
}

View File

@ -0,0 +1,29 @@
# == Class: nova::cell_v2::map_cell0
#
# Class to execute nova cell_v2 map_cell0
#
# === Parameters
#
# [*extra_params*]
# (optional) String of extra command line parameters to pass
# to the nova-manage command. These will be inserted in
# the command line between 'nova-manage' and 'cell_v2'.
# Defaults to ''
#
#
class nova::cell_v2::map_cell0 (
$extra_params = '',
) {
include ::nova::deps
exec { 'nova-cell_v2-map_cell0':
path => ['/bin', '/usr/bin'],
command => "nova-manage ${extra_params} cell_v2 map_cell0",
refreshonly => true,
returns => [0,1], # TODO(owalsh): Remove when this lands https://review.openstack.org/#/c/420132/ in packaging
logoutput => on_failure,
subscribe => Anchor['nova::cell_v2::begin'],
notify => Anchor['nova::cell_v2::end'],
}
}

View File

@ -0,0 +1,52 @@
# == Class: nova::cell_v2::simple_setup
#
# Class to execute minimal nova cell_v2 setup. This is a manual implementation
# of the cell_v2 simple_cell_setup in puppet.
#
# === Parameters
#
# [*extra_params*]
# (optional) String of extra command line parameters to pass
# to the nova-manage command. These will be inserted in
# the command line between 'nova-manage' and 'cell_v2'.
# Defaults to ''
#
# [*transport_url*]
# (optional) This is the transport url to use for the cell_v2 commands.
# By default the command should look for the DEFAULT/transport_url from
# the nova configuration. If not available, you need to provide the
# transport url via the parameters. Prior to Ocata, the transport-url
# was a required parameter.
# Defaults to undef.
#
# [*database_connection*]
# (optional) This is the database url to use for the cell_v2 create command
# for the initial cell1 cell.
# By default the command should look for the DEFAULT/database_connection from
# the nova configuration. If not available, you need to provide the database
# url via the parameters.
# Defaults to undef.
#
class nova::cell_v2::simple_setup (
$extra_params = '',
$transport_url = undef,
$database_connection = undef,
) {
include ::nova::deps
include ::nova::cell_v2::map_cell0
nova::cell_v2::cell { 'default':
extra_params => $extra_params,
transport_url => $transport_url,
database_connection => $database_connection
}
include ::nova::cell_v2::discover_hosts
Class['nova::cell_v2::map_cell0'] ->
Nova::Cell_v2::Cell <| |> ~>
Class['nova::cell_v2::discover_hosts']
}

View File

@ -31,6 +31,12 @@
# (optional) Additional hosts that are allowed to access this DB
# Defaults to undef
#
# [*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
#
class nova::db::mysql(
$password,
$dbname = 'nova',
@ -39,10 +45,13 @@ class nova::db::mysql(
$charset = 'utf8',
$collate = 'utf8_general_ci',
$allowed_hosts = undef,
$setup_cell0 = true,
) {
include ::nova::deps
$setup_cell0_real = pick($::nova::db::mysql_api::setup_cell0, $setup_cell0)
::openstacklib::db::mysql { 'nova':
user => $user,
password_hash => mysql_password($password),
@ -53,6 +62,20 @@ class nova::db::mysql(
allowed_hosts => $allowed_hosts,
}
if $setup_cell0_real {
# need for cell_v2
::openstacklib::db::mysql { 'nova_cell0':
user => $user,
password_hash => mysql_password($password),
dbname => "${dbname}_cell0",
host => $host,
charset => $charset,
collate => $collate,
allowed_hosts => $allowed_hosts,
create_user => false,
}
}
Anchor['nova::db::begin']
~> Class['nova::db::mysql']
~> Anchor['nova::db::end']

View File

@ -31,10 +31,14 @@
# (optional) Additional hosts that are allowed to access this DB
# Defaults to undef
#
# === DEPRECATED
#
# TODO(aschultz): we can just remove this after tripleo gets fixed to use
# the new param
# [*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 undef
#
class nova::db::mysql_api(
$password,
@ -44,9 +48,14 @@ class nova::db::mysql_api(
$charset = 'utf8',
$collate = 'utf8_general_ci',
$allowed_hosts = undef,
$setup_cell0 = false,
# DEPREACTED
$setup_cell0 = undef
) {
if $setup_cell0 {
warning('nova::db::mysql_api::setup_cell0 is deprecated, use nova::db::mysql::setup_cell0 instead. This will be removed in Pike')
}
include ::nova::deps
::openstacklib::db::mysql { 'nova_api':
@ -59,20 +68,6 @@ class nova::db::mysql_api(
allowed_hosts => $allowed_hosts,
}
if $setup_cell0 {
# need for cell_v2
::openstacklib::db::mysql { 'nova_api_cell0':
user => $user,
password_hash => mysql_password($password),
dbname => "${dbname}_cell0",
host => $host,
charset => $charset,
collate => $collate,
allowed_hosts => $allowed_hosts,
create_user => false,
}
}
Anchor['nova::db::begin']
~> Class['nova::db::mysql_api']
~> Anchor['nova::db::end']

View File

@ -31,6 +31,7 @@ class nova::db::sync(
subscribe => [
Anchor['nova::install::end'],
Anchor['nova::config::end'],
Anchor['nova::db::end'],
Anchor['nova::dbsync::begin']
],
notify => Anchor['nova::dbsync::end'],

View File

@ -10,9 +10,11 @@
# Defaults to undef
#
# [*cellv2_setup*]
# (optional) This flag toggles if we run the cell_v2 simple_cell_setup action
# with nova-manage. This flag will be set to true in Ocata when the cell v2
# setup is mandatory.
# (optional) This flag toggles if we preform a minimal cell_v2 setup of a
# a single cell.
# NOTE: 'nova-manage cell_v2 discover_hosts' must be
# run after any nova-compute hosts have been deployed.
# This flag will be set to true in Ocata when the cell v2 setup is mandatory.
# Defaults to false.
#
# [*db_sync_timeout*]
@ -21,8 +23,8 @@
#
class nova::db::sync_api(
$extra_params = undef,
$db_sync_timeout = 300,
$cellv2_setup = false,
$db_sync_timeout = 300,
) {
include ::nova::deps
@ -38,12 +40,13 @@ class nova::db::sync_api(
subscribe => [
Anchor['nova::install::end'],
Anchor['nova::config::end'],
Anchor['nova::db::end'],
Anchor['nova::dbsync_api::begin']
],
notify => Anchor['nova::dbsync_api::end'],
}
if $cellv2_setup {
include ::nova::db::sync_cell_v2
include ::nova::cell_v2::simple_setup
}
}

View File

@ -1,46 +0,0 @@
#
# Class to execute nova cell_v2 setup
#
# ==Parameters
#
# [*extra_params*]
# (optional) String of extra command line parameters to append
# to the nova-manage db sync command. These will be inserted in
# the command line between 'nova-manage' and 'db sync'.
# Defaults to ''
#
# [*transport_url*]
# (optional) This is the transport url to use for the simple cell setup.
# By default the command should look for the DEFAULT/transport_url from
# the nova configuration. If not available, you need to provide the
# transport url via the parameters. Prior to Ocata, the transport-url
# was a required parameter.
# Defaults to undef.
#
class nova::db::sync_cell_v2 (
$extra_params = '',
$transport_url = undef,
) {
include ::nova::deps
if $transport_url {
$transport_url_real = "--transport-url=${transport_url}"
} else {
$transport_url_real = ''
}
exec { 'nova-cell_v2-simple-cell-setup':
command => "/usr/bin/nova-manage ${extra_params} cell_v2 simple_cell_setup ${transport_url_real}",
refreshonly => true,
try_sleep => 5,
tries => 10,
logoutput => on_failure,
subscribe => [
Anchor['nova::install::end'],
Anchor['nova::config::end'],
Anchor['nova::dbsync_api::end'],
Anchor['nova::cell_v2::begin']
],
notify => Anchor['nova::cell_v2::end'],
}
}

View File

@ -18,12 +18,6 @@ class nova::deps {
~> anchor { 'nova::config::end': }
-> anchor { 'nova::db::begin': }
-> anchor { 'nova::db::end': }
~> anchor { 'nova::dbsync::begin': }
-> anchor { 'nova::dbsync::end': }
~> anchor { 'nova::dbsync_api::begin': }
-> anchor { 'nova::dbsync_api::end': }
~> anchor { 'nova::cell_v2::begin': }
-> anchor { 'nova::cell_v2::end': }
~> anchor { 'nova::service::begin': }
~> Service<| tag == 'nova-service' |>
~> anchor { 'nova::service::end': }
@ -44,16 +38,22 @@ class nova::deps {
-> Package<| tag == 'nova-support-package'|>
-> Anchor['nova::install::end']
# TODO(aschultz): check if we can remove these as I think they are no longer
# valid since nova_cells is replaced by cell_v2 and the others are part of
# nova network
# The following resourcs are managed by calling 'nova manage' and so the
# database must be provisioned before they can be applied.
Anchor['nova::dbsync::end']
-> Anchor['nova::dbsync_api::end']
Anchor['nova::dbsync_api::end']
-> Nova_cells<||>
Anchor['nova::dbsync::end']
-> Anchor['nova::dbsync_api::end']
-> Nova_cells<||>
Anchor['nova::dbsync_api::end']
-> Nova_floating<||>
Anchor['nova::dbsync::end']
-> Anchor['nova::dbsync_api::end']
-> Nova_floating<||>
Anchor['nova::dbsync_api::end']
-> Nova_network<||>
Anchor['nova::dbsync::end']
-> Nova_network<||>
# all db settings should be applied and all packages should be installed
@ -71,4 +71,40 @@ class nova::deps {
require => Anchor['nova::install::end'],
before => Anchor['nova::config::begin'],
}
#############################################################################
# NOTE(aschultz): these are defined here because this syntax allows us
# to override the subscribe/notify order using the spaceship operator.
# The ->/~> does not seem to be able to be updated after the fact. Since
# we have to flip cell v2 ordering for the N->O upgrade process, we need
# to not use the chaining arrows. ugh.
#############################################################################
# Wedge this in after the db creation and before the services
anchor { 'nova::dbsync_api::begin':
subscribe => Anchor['nova::db::end']
} ->
anchor { 'nova::dbsync_api::end':
notify => Anchor['nova::service::begin'],
}
# Wedge this after db creation and api sync but before the services
anchor { 'nova::dbsync::begin':
subscribe => [
Anchor['nova::db::end'],
Anchor['nova::dbsync_api::end']
]
} ->
anchor { 'nova::dbsync::end':
notify => Anchor['nova::service::begin']
}
# Wedge cell_v2 put this between api sync and db sync by default but can
# be overridden using the spaceship operator to move it around when needed
anchor { 'nova::cell_v2::begin':
subscribe => Anchor['nova::dbsync_api::end']
} ->
Nova::Cell_v2::Cell<||> ~>
anchor { 'nova::cell_v2::end':
notify => Anchor['nova::dbsync::begin']
}
}

View File

@ -1,5 +1,12 @@
---
features:
- Adds cell_v2 simple_cell_setup as part of the nova-api database setup.
- |
Adds the ability to perform a simple cell v2 setup using map_cell0,
create_cell and discover_hosts via nova::cell_v2::simple_setup.
upgrade:
- The cell_v2 setup will become mandatory in Ocata.
- |
Cell v2 must be setup prior to upgrading to Ocata or the db api sync will
fail. If upgrading from from an evironment with existing compute nodes and
planning to use puppet to manage your hosts, DO NOT use the
'nova-manage cell_v2 cell_simple_setup' and nova::cell_v2::simple_setup as
they will clash on the default cell management.

View File

@ -55,11 +55,12 @@ describe 'basic nova' do
class { '::nova::keystone::authtoken':
password => 'a_big_secret',
}
# TODO(aschultz): remove this once https://review.openstack.org/#/c/409970/ lands
# TODO(aschultz): don't do this until resolution for LP#1656276
#class { '::nova::db::sync_cell_v2':
# transport_url => 'rabbit://nova:an_even_bigger_secret@127.0.0.1:5672/',
#}
# TODO(aschultz): ubuntu's version of these commands are too old. Only
# run the cell_v2 on the redhat test until after Ocata-m3 is available
# from UCA
if $::osfamily == 'RedHat' {
include '::nova::cell_v2::simple_setup'
}
class { '::nova::api':
service_name => 'httpd',
}

View File

@ -0,0 +1,49 @@
require 'spec_helper'
describe 'nova::cell_v2::discover_hosts' do
shared_examples_for 'nova::cell_v2::discover_hosts' do
context 'with defaults' do
it {
is_expected.to contain_exec('nova-cell_v2-discover_hosts').with(
:path => ['/bin', '/usr/bin'],
:command => 'nova-manage cell_v2 discover_hosts',
:refreshonly => true,
:subscribe => 'Anchor[nova::service::end]'
)
}
end
context "overriding extra_params" do
let :params do
{
:extra_params => '--config-file /etc/nova/nova.conf'
}
end
it {
is_expected.to contain_exec('nova-cell_v2-discover_hosts').with(
:path => ['/bin', '/usr/bin'],
:command => 'nova-manage --config-file /etc/nova/nova.conf cell_v2 discover_hosts',
:refreshonly => true,
:subscribe => 'Anchor[nova::service::end]'
)
}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_configures 'nova::cell_v2::discover_hosts'
end
end
end

View File

@ -0,0 +1,53 @@
require 'spec_helper'
describe 'nova::cell_v2::map_cell0' do
shared_examples_for 'nova::cell_v2::map_cell0' do
context 'with defaults' do
it {
is_expected.to contain_exec('nova-cell_v2-map_cell0').with(
:path => ['/bin', '/usr/bin'],
:command => 'nova-manage cell_v2 map_cell0',
:refreshonly => 'true',
:logoutput => 'on_failure',
:subscribe => 'Anchor[nova::cell_v2::begin]',
:notify => 'Anchor[nova::cell_v2::end]',
)
}
end
context "overriding extra_params" do
let :params do
{
:extra_params => '--config-file /etc/nova/nova.conf',
}
end
it {
is_expected.to contain_exec('nova-cell_v2-map_cell0').with(
:path => ['/bin', '/usr/bin'],
:command => 'nova-manage --config-file /etc/nova/nova.conf cell_v2 map_cell0',
:refreshonly => 'true',
:logoutput => 'on_failure',
:subscribe => 'Anchor[nova::cell_v2::begin]',
:notify => 'Anchor[nova::cell_v2::end]',
)
}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_configures 'nova::cell_v2::map_cell0'
end
end
end

View File

@ -0,0 +1,53 @@
require 'spec_helper'
describe 'nova::cell_v2::simple_setup' do
shared_examples_for 'nova::cell_v2::simple_setup' do
context 'with defaults' do
it {
is_expected.to contain_class('nova::cell_v2::map_cell0')
is_expected.to contain_nova__cell_v2__cell('default').with(
:extra_params => '',
:transport_url => nil,
:database_conneciton => nil
)
is_expected.to contain_class('nova::cell_v2::discover_hosts')
}
end
context "overriding extra_params" do
let :params do
{
:extra_params => '--config-file /etc/nova/nova.conf',
:transport_url => 'rabbit://user:pass@host:1234/virt',
:database_connection => 'mysql://nova:pass@host:1234/nova'
}
end
it {
is_expected.to contain_class('nova::cell_v2::map_cell0')
is_expected.to contain_nova__cell_v2__cell('default').with(
:extra_params => params[:extra_params],
:transport_url => params[:transport_url],
:database_connection => params[:database_connection]
)
is_expected.to contain_class('nova::cell_v2::discover_hosts')
}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_configures 'nova::cell_v2::simple_setup'
end
end
end

View File

@ -22,8 +22,6 @@ describe 'nova::db::mysql_api' do
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
it { is_expected.to_not contain_openstacklib__db__mysql('nova_api_cell0') }
end
context 'overriding allowed_hosts param to array' do
@ -70,20 +68,6 @@ describe 'nova::db::mysql_api' do
)}
end
context 'when enabling cell0 setup' do
let :params do
{ :setup_cell0 => true }.merge(required_params)
end
it { is_expected.to contain_openstacklib__db__mysql('nova_api_cell0').with(
:user => 'nova_api',
:password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:create_user => false,
)}
end
end
on_supported_os({

View File

@ -22,6 +22,14 @@ describe 'nova::db::mysql' do
:charset => 'utf8',
:collate => 'utf8_general_ci',
)}
it { is_expected.to contain_openstacklib__db__mysql('nova_cell0').with(
:user => 'nova',
:password_hash => '*AA1420F182E88B9E5F874F6FBE7459291E8F4601',
:charset => 'utf8',
:collate => 'utf8_general_ci',
:create_user => false,
)}
end
context 'overriding allowed_hosts param to array' do
@ -68,6 +76,13 @@ describe 'nova::db::mysql' do
)}
end
context 'when disabling cell0 setup' do
let :params do
{ :setup_cell0 => false}.merge(required_params)
end
it { is_expected.to_not contain_openstacklib__db__mysql('nova_cell0') }
end
end
on_supported_os({

View File

@ -12,18 +12,19 @@ describe 'nova::db::sync_api' do
:logoutput => 'on_failure',
:subscribe => ['Anchor[nova::install::end]',
'Anchor[nova::config::end]',
'Anchor[nova::db::end]',
'Anchor[nova::dbsync_api::begin]'],
:notify => 'Anchor[nova::dbsync_api::end]',
)
}
it { is_expected.to_not contain_class('nova::db::sync_cell_v2') }
it { is_expected.to_not contain_class('nova::cell_v2::simple_setup') }
end
context "overriding extra_params" do
let :params do
{
:extra_params => '--config-file /etc/nova/nova.conf',
:cellv2_setup => true
:cellv2_setup => false
}
end
@ -35,11 +36,12 @@ describe 'nova::db::sync_api' do
:logoutput => 'on_failure',
:subscribe => ['Anchor[nova::install::end]',
'Anchor[nova::config::end]',
'Anchor[nova::db::end]',
'Anchor[nova::dbsync_api::begin]'],
:notify => 'Anchor[nova::dbsync_api::end]',
)
}
it { is_expected.to contain_class('nova::db::sync_cell_v2') }
it { is_expected.to_not contain_class('nova::cell_v2::simple_setup') }
end
context "overriding db_sync_timeout" do
@ -57,6 +59,7 @@ describe 'nova::db::sync_api' do
:logoutput => 'on_failure',
:subscribe => ['Anchor[nova::install::end]',
'Anchor[nova::config::end]',
'Anchor[nova::db::end]',
'Anchor[nova::dbsync_api::begin]'],
:notify => 'Anchor[nova::dbsync_api::end]',
)

View File

@ -1,62 +0,0 @@
require 'spec_helper'
describe 'nova::db::sync_cell_v2' do
shared_examples_for 'nova-db-sync-cell_v2' do
context 'with defaults' do
it {
is_expected.to contain_exec('nova-cell_v2-simple-cell-setup').with(
:command => '/usr/bin/nova-manage cell_v2 simple_cell_setup ',
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:logoutput => 'on_failure',
:subscribe => ['Anchor[nova::install::end]',
'Anchor[nova::config::end]',
'Anchor[nova::dbsync_api::end]',
'Anchor[nova::cell_v2::begin]'],
:notify => 'Anchor[nova::cell_v2::end]',
)
}
end
context "overriding extra_params" do
let :params do
{
:extra_params => '--config-file /etc/nova/nova.conf',
:transport_url => 'rabbit://user:pass@host:1234/virt'
}
end
it {
is_expected.to contain_exec('nova-cell_v2-simple-cell-setup').with(
:command => '/usr/bin/nova-manage --config-file /etc/nova/nova.conf cell_v2 simple_cell_setup --transport-url=rabbit://user:pass@host:1234/virt',
:refreshonly => 'true',
:try_sleep => 5,
:tries => 10,
:logoutput => 'on_failure',
:subscribe => ['Anchor[nova::install::end]',
'Anchor[nova::config::end]',
'Anchor[nova::dbsync_api::end]',
'Anchor[nova::cell_v2::begin]'],
:notify => 'Anchor[nova::cell_v2::end]',
)
}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_configures 'nova-db-sync-cell_v2'
end
end
end

View File

@ -14,6 +14,7 @@ describe 'nova::db::sync' do
:logoutput => 'on_failure',
:subscribe => ['Anchor[nova::install::end]',
'Anchor[nova::config::end]',
'Anchor[nova::db::end]',
'Anchor[nova::dbsync::begin]'],
:notify => 'Anchor[nova::dbsync::end]',
)
@ -36,6 +37,7 @@ describe 'nova::db::sync' do
:logoutput => 'on_failure',
:subscribe => ['Anchor[nova::install::end]',
'Anchor[nova::config::end]',
'Anchor[nova::db::end]',
'Anchor[nova::dbsync::begin]'],
:notify => 'Anchor[nova::dbsync::end]',
)
@ -59,6 +61,7 @@ describe 'nova::db::sync' do
:logoutput => 'on_failure',
:subscribe => ['Anchor[nova::install::end]',
'Anchor[nova::config::end]',
'Anchor[nova::db::end]',
'Anchor[nova::dbsync::begin]'],
:notify => 'Anchor[nova::dbsync::end]',
)

View File

@ -0,0 +1,55 @@
require 'spec_helper'
describe 'nova::cell_v2::cell' do
let (:title) { 'foo' }
shared_examples_for 'nova::cell_v2::cell' do
context 'with defaults' do
it {
is_expected.to contain_exec("nova-cell_v2-cell-#{title}").with(
:path => ['/bin', '/usr/bin'],
:command => "nova-manage cell_v2 create_cell --name=#{title} ",
:logoutput => 'on_failure',
:subscribe => 'Anchor[nova::cell_v2::begin]',
:notify => 'Anchor[nova::cell_v2::end]',
)
}
end
context "overriding extra_params" do
let :params do
{
:extra_params => '--config-file /etc/nova/nova.conf',
:transport_url => 'rabbit://user:pass@host:1234/vhost',
:database_connection => 'mysql://user:pass@host:3306/nova'
}
end
it {
is_expected.to contain_exec("nova-cell_v2-cell-#{title}").with(
:path => ['/bin', '/usr/bin'],
:command => "nova-manage --config-file /etc/nova/nova.conf cell_v2 create_cell --name=#{title} --transport-url=#{params[:transport_url]} --database_connection=#{params[:database_connection]}",
:logoutput => 'on_failure',
:subscribe => 'Anchor[nova::cell_v2::begin]',
:notify => 'Anchor[nova::cell_v2::end]',
)
}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge(OSDefaults.get_facts())
end
it_configures 'nova::cell_v2::cell'
end
end
end