diff --git a/manifests/api.pp b/manifests/api.pp index bc1bcc7cd..3deef1524 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -48,10 +48,6 @@ # (optional) Number of workers for metadata service # Defaults to $::os_workers # -# [*instance_name_template*] -# (optional) Template string to be used to generate instance names -# Defaults to $::os_service_default -# # [*sync_db*] # (optional) Run nova-manage db sync on api nodes after installing the package. # Defaults to true @@ -176,6 +172,10 @@ # enable this if you have a sanitizing proxy. # Defaults to undef # +# [*instance_name_template*] +# (optional) Template string to be used to generate instance names +# Defaults to undef +# class nova::api( $enabled = true, $manage_service = true, @@ -191,7 +191,6 @@ class nova::api( $sync_db = true, $sync_db_api = true, $db_online_data_migrations = false, - $instance_name_template = $::os_service_default, $service_name = $::nova::params::api_service_name, $metadata_service_name = $::nova::params::api_metadata_service_name, $enable_proxy_headers_parsing = $::os_service_default, @@ -214,6 +213,7 @@ class nova::api( $validate = undef, $validation_options = undef, $use_forwarded_for = undef, + $instance_name_template = undef, ) inherits nova::params { include nova::deps @@ -238,8 +238,19 @@ class nova::api( warning('The use_forwarded_for parameter has been deprecated.') } - nova_config { - 'DEFAULT/instance_name_template': value => $instance_name_template; + if $instance_name_template != undef { + warning("The nova::api::instance_name_template parameter is deprecated. \ +Use the nova::instance_name_template parameter instead.") + nova_config { + 'DEFAULT/instance_name_template': value => $instance_name_template; + } + } else { + # Try best to clean up the parameter + if defined(Class['nova']) and $::nova::instance_name_template == undef { + nova_config { + 'DEFAULT/instance_name_template': value => $::os_service_default; + } + } } # enable metadata in eventlet if we do not run metadata via wsgi (nova::metadata) diff --git a/manifests/init.pp b/manifests/init.pp index 3a44d7d68..a87ab918b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -352,6 +352,10 @@ # (optional) domain to use for building the hostnames # Defaults to $::os_service_default # +# [*instance_name_template*] +# (optional) Template string to be used to generate instance names +# Defaults to undef +# # DEPRECATED PARAMETERS # # [*auth_strategy*] @@ -440,6 +444,7 @@ class nova( $purge_config = false, $my_ip = $::os_service_default, $dhcp_domain = $::os_service_default, + $instance_name_template = undef, # DEPRECATED PARAMETERS $auth_strategy = undef, $upgrade_level_cert = undef, @@ -572,6 +577,14 @@ but should be one of: ssh-rsa, ssh-dsa, ssh-ecdsa.") 'DEFAULT/dhcp_domain': value => $dhcp_domain; } + # TODO(tkajinam): Change the default value to $::os_service_default when we + # remove nova::api::instance_name_template after Antelope. + if $instance_name_template != undef { + nova_config { + 'DEFAULT/instance_name_template': value => $instance_name_template; + } + } + oslo::messaging::rabbit {'nova_config': rabbit_use_ssl => $rabbit_use_ssl, heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, diff --git a/releasenotes/notes/move-instance_name_template-to-base-52516c9df907a8c6.yaml b/releasenotes/notes/move-instance_name_template-to-base-52516c9df907a8c6.yaml new file mode 100644 index 000000000..681fde366 --- /dev/null +++ b/releasenotes/notes/move-instance_name_template-to-base-52516c9df907a8c6.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + The ``nova::api::instance_name_template`` parameter has been deprecated. + Use the ``nova::instance_name_template`` parameter instead so that + the option is configured for all nova services. diff --git a/spec/classes/nova_init_spec.rb b/spec/classes/nova_init_spec.rb index 66eab77c0..af910e8ab 100644 --- a/spec/classes/nova_init_spec.rb +++ b/spec/classes/nova_init_spec.rb @@ -101,6 +101,9 @@ describe 'nova' do is_expected.to contain_nova_config('console/ssl_ciphers').with_value('') is_expected.to contain_nova_config('console/ssl_minimum_version').with_value('') is_expected.to contain_nova_config('DEFAULT/dhcp_domain').with_value('') + # TODO(tkajinam): Uncomment this when we change default value of + # nova::instance_name_template + # is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_value('') end end @@ -160,7 +163,7 @@ describe 'nova' do :console_ssl_ciphers => 'kEECDH+aECDSA+AES:kEECDH+AES+aRSA:kEDH+aRSA+AES', :console_ssl_minimum_version => 'tlsv1_2', :dhcp_domain => 'foo', - + :instance_name_template => 'instance-%08x', } end @@ -253,6 +256,7 @@ describe 'nova' do is_expected.to contain_nova_config('console/ssl_ciphers').with_value('kEECDH+aECDSA+AES:kEECDH+AES+aRSA:kEDH+aRSA+AES') is_expected.to contain_nova_config('console/ssl_minimum_version').with_value('tlsv1_2') is_expected.to contain_nova_config('DEFAULT/dhcp_domain').with_value('foo') + is_expected.to contain_nova_config('DEFAULT/instance_name_template').with_value('instance-%08x'); end context 'with multiple notification_driver' do