Deprecate nova::cell_v2::cell and add reno for new cell_v2 type.

Change-Id: Id47b85550ad0e058b25cab237e4950f1da385895
Related-Bug: #1670488
This commit is contained in:
Oliver Walsh 2017-04-11 10:51:38 +01:00
parent d19c93c551
commit 5dcd344d3f
3 changed files with 25 additions and 53 deletions

View File

@ -1,13 +1,10 @@
# == Type: nova::cell_v2::cell
#
# Resource for managing cell_v2 cells.
# DEPRECATED by the nova_cell_v2 type.
#
# === 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
@ -20,32 +17,26 @@
# configuration file.
# Defaults to undef.
#
# DEPRECATED
#
# [*extra_params*]
# This parameter is deprecated and will be ignored
#
define nova::cell_v2::cell (
$extra_params = '',
$transport_url = undef,
$database_connection = undef
$extra_params = undef,
$transport_url = 'default',
$database_connection = 'default'
) {
warning('nova::cell_v2::cell is deprecated by the nova_cell_v2 type in Pike and will be removed in the future.')
if $extra_params {
warning('The nova::cell_v2::cell::extra_params parameter is deprecated and will be ignored')
}
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'],
nova_cell_v2 { "${title}":
transport_url => $transport_url,
database_connection => $database_connection
}
}

View File

@ -0,0 +1,5 @@
---
features:
- Adds a "nova_cell_v2" provider and type for creating and updating cell_v2 cells.
deprecations:
- The "nova::cell_v2::cell" define, which does not allow cell configs to be updated, is deprecated by the "nova_cell_v2" type.

View File

@ -8,38 +8,14 @@ describe '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]',
is_expected.to contain_nova_cell_v2("#{title}").with(
:transport_url => 'default',
:database_connection => 'default'
)
}
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|