diff --git a/manifests/cell_v2/cell.pp b/manifests/cell_v2/cell.pp index 92c5a2609..64af4e6aa 100644 --- a/manifests/cell_v2/cell.pp +++ b/manifests/cell_v2/cell.pp @@ -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 } } diff --git a/releasenotes/notes/add_cell_v2_provider-d1e6f8226ae3401e.yaml b/releasenotes/notes/add_cell_v2_provider-d1e6f8226ae3401e.yaml new file mode 100644 index 000000000..0c5650119 --- /dev/null +++ b/releasenotes/notes/add_cell_v2_provider-d1e6f8226ae3401e.yaml @@ -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. diff --git a/spec/defines/nova_cell_v2_cell_spec.rb b/spec/defines/nova_cell_v2_cell_spec.rb index 086571345..d1e4e4a3d 100644 --- a/spec/defines/nova_cell_v2_cell_spec.rb +++ b/spec/defines/nova_cell_v2_cell_spec.rb @@ -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|