Migrate parameters for cinder from nova to nova::cinder

... so that we have all parameters related to cinder in one class.

Change-Id: I3b50ea15a02a109a7171b161262a1eb47c76d93e
This commit is contained in:
Takashi Kajinami 2020-04-25 22:23:51 +09:00
parent ad25ec1ab9
commit 72103db985
5 changed files with 83 additions and 33 deletions

View File

@ -48,6 +48,24 @@
# admin context through the OpenStack Identity service. # admin context through the OpenStack Identity service.
# Defaults to 'Default' # Defaults to 'Default'
# #
# [*os_region_name*]
# (optional) Sets the os_region_name flag. For environments with
# more than one endpoint per service, this is required to make
# things such as cinder volume attach work. If you don't set this
# and you have multiple endpoints, you will get AmbiguousEndpoint
# exceptions in the nova API service.
# Defaults to $::os_service_default
#
# [*catalog_info*]
# (optional) Info to match when looking for cinder in the service
# catalog. Format is: separated values of the form:
# <service_type>:<service_name>:<endpoint_type>
# Defaults to $::os_service_default
#
# [*cross_az_attach*]
# (optional) Allow attach between instance and volume in different availability zones.
# Defaults to $::os_service_default
#
class nova::cinder ( class nova::cinder (
$password = $::os_service_default, $password = $::os_service_default,
$auth_type = $::os_service_default, $auth_type = $::os_service_default,
@ -58,11 +76,17 @@ class nova::cinder (
$project_domain_name = 'Default', $project_domain_name = 'Default',
$username = 'cinder', $username = 'cinder',
$user_domain_name = 'Default', $user_domain_name = 'Default',
$os_region_name = $::os_service_default,
$catalog_info = $::os_service_default,
$cross_az_attach = $::os_service_default,
) { ) {
include nova::deps include nova::deps
$os_region_name_real = pick($::nova::os_region_name, $os_region_name)
$catalog_info_real = pick($::nova::cinder_catalog_info, $catalog_info)
$cross_az_attach_real = pick($::nova::cross_az_attach, $cross_az_attach)
nova_config { nova_config {
'cinder/password': value => $password, secret => true; 'cinder/password': value => $password, secret => true;
'cinder/auth_type': value => $auth_type; 'cinder/auth_type': value => $auth_type;
@ -73,6 +97,8 @@ class nova::cinder (
'cinder/project_domain_name': value => $project_domain_name; 'cinder/project_domain_name': value => $project_domain_name;
'cinder/username': value => $username; 'cinder/username': value => $username;
'cinder/user_domain_name': value => $user_domain_name; 'cinder/user_domain_name': value => $user_domain_name;
'cinder/os_region_name': value => $os_region_name_real;
'cinder/catalog_info': value => $catalog_info_real;
'cinder/cross_az_attach': value => $cross_az_attach;
} }
} }

View File

@ -316,25 +316,11 @@
# for notifications on VM and task state changes. # for notifications on VM and task state changes.
# Defaults to undef # Defaults to undef
# #
# [*os_region_name*]
# (optional) Sets the os_region_name flag. For environments with
# more than one endpoint per service, this is required to make
# things such as cinder volume attach work. If you don't set this
# and you have multiple endpoints, you will get AmbiguousEndpoint
# exceptions in the nova API service.
# Defaults to $::os_service_default
#
# [*ovsdb_connection*] # [*ovsdb_connection*]
# (optional) Sets the ovsdb connection string. This is used by os-vif # (optional) Sets the ovsdb connection string. This is used by os-vif
# to interact with openvswitch on the host. # to interact with openvswitch on the host.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
# [*cinder_catalog_info*]
# (optional) Info to match when looking for cinder in the service
# catalog. Format is: separated values of the form:
# <service_type>:<service_name>:<endpoint_type>
# Defaults to $::os_service_default
#
# [*upgrade_level_cells*] # [*upgrade_level_cells*]
# (optional) Sets a version cap for messages sent to local cells services # (optional) Sets a version cap for messages sent to local cells services
# Defaults to $::os_service_default # Defaults to $::os_service_default
@ -405,10 +391,6 @@
# If unable to do so, will use "127.0.0.1". # If unable to do so, will use "127.0.0.1".
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*cross_az_attach*]
# (optional) Allow attach between instance and volume in different availability zones.
# Defaults to $::os_service_default
#
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
# #
# [*notify_api_faults*] # [*notify_api_faults*]
@ -436,6 +418,24 @@
# (optional) Minimum number of SQL connections to keep open in a pool. # (optional) Minimum number of SQL connections to keep open in a pool.
# Defaults to undef. # Defaults to undef.
# #
# [*os_region_name*]
# (optional) Sets the os_region_name flag. For environments with
# more than one endpoint per service, this is required to make
# things such as cinder volume attach work. If you don't set this
# and you have multiple endpoints, you will get AmbiguousEndpoint
# exceptions in the nova API service.
# Defaults to undef
#
# [*cinder_catalog_info*]
# (optional) Info to match when looking for cinder in the service
# catalog. Format is: separated values of the form:
# <service_type>:<service_name>:<endpoint_type>
# Defaults to undef
#
# [*cross_az_attach*]
# (optional) Allow attach between instance and volume in different availability zones.
# Defaults to undef
#
class nova( class nova(
$ensure_package = 'present', $ensure_package = 'present',
$database_connection = undef, $database_connection = undef,
@ -506,9 +506,7 @@ class nova(
$notification_topics = $::os_service_default, $notification_topics = $::os_service_default,
$notification_format = $::os_service_default, $notification_format = $::os_service_default,
$notify_on_state_change = undef, $notify_on_state_change = undef,
$os_region_name = $::os_service_default,
$ovsdb_connection = $::os_service_default, $ovsdb_connection = $::os_service_default,
$cinder_catalog_info = $::os_service_default,
$upgrade_level_cells = $::os_service_default, $upgrade_level_cells = $::os_service_default,
$upgrade_level_cert = $::os_service_default, $upgrade_level_cert = $::os_service_default,
$upgrade_level_compute = $::os_service_default, $upgrade_level_compute = $::os_service_default,
@ -522,7 +520,6 @@ class nova(
$disk_allocation_ratio = $::os_service_default, $disk_allocation_ratio = $::os_service_default,
$purge_config = false, $purge_config = false,
$my_ip = $::os_service_default, $my_ip = $::os_service_default,
$cross_az_attach = $::os_service_default,
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$notify_api_faults = undef, $notify_api_faults = undef,
$image_service = undef, $image_service = undef,
@ -530,6 +527,9 @@ class nova(
$auth_strategy = undef, $auth_strategy = undef,
$glance_api_servers = undef, $glance_api_servers = undef,
$database_min_pool_size = undef, $database_min_pool_size = undef,
$os_region_name = undef,
$cinder_catalog_info = undef,
$cross_az_attach = undef,
) inherits nova::params { ) inherits nova::params {
include nova::deps include nova::deps
@ -550,6 +550,21 @@ class nova(
warning('The notify_on_api_faults parameter is deprecated.') warning('The notify_on_api_faults parameter is deprecated.')
} }
if $os_region_name != undef {
warning('The os_region_name parameter is deprecated and will be removed \
in a future release. Use nova::cinder::os_region_name instead')
}
if $cinder_catalog_info != undef {
warning('The catalog_info parameter is deprecated and will be removed \
in a future release. Use nova::cinder::catalog_info instead')
}
if $cross_az_attach != undef {
warning('The cross_az_attach parameter is deprecated and will be removed \
in a future release. Use nova::cinder::cross_az_attach instead')
}
if $image_service { if $image_service {
warning('The unused image_service parameter is deprecated, as we are \ warning('The unused image_service parameter is deprecated, as we are \
already using python-glanceclient instead of old glance client.') already using python-glanceclient instead of old glance client.')
@ -742,7 +757,6 @@ but should be one of: ssh-rsa, ssh-dsa, ssh-ecdsa.")
} }
nova_config { nova_config {
'cinder/catalog_info': value => $cinder_catalog_info;
'DEFAULT/ovsdb_connection': value => $ovsdb_connection; 'DEFAULT/ovsdb_connection': value => $ovsdb_connection;
'notifications/notification_format': value => $notification_format; 'notifications/notification_format': value => $notification_format;
# Following may need to be broken out to different nova services # Following may need to be broken out to different nova services
@ -765,8 +779,6 @@ but should be one of: ssh-rsa, ssh-dsa, ssh-ecdsa.")
} }
nova_config { nova_config {
'cinder/os_region_name': value => $os_region_name;
'cinder/cross_az_attach': value => $cross_az_attach;
'upgrade_levels/cells': value => $upgrade_level_cells; 'upgrade_levels/cells': value => $upgrade_level_cells;
'upgrade_levels/cert': value => $upgrade_level_cert; 'upgrade_levels/cert': value => $upgrade_level_cert;
'upgrade_levels/compute': value => $upgrade_level_compute; 'upgrade_levels/compute': value => $upgrade_level_compute;

View File

@ -0,0 +1,10 @@
---
deprecations:
- |
The following parameters in nova class has been deprecated and will be
removed in a future release. Use the new parameters in nova::cinder class
instead.
- ``nova::os_region_name`` ( now ``nova::cinder::os_region_name``)
- ``nova::cinder_catalog_info`` ( now ``nova::cinder::catalog_info``)
- ``nova::cross_az_attach`` ( now ``nova::cinder::cross_az_attach``)

View File

@ -15,6 +15,9 @@ describe 'nova::cinder' do
should contain_nova_config('cinder/project_domain_name').with_value('Default') should contain_nova_config('cinder/project_domain_name').with_value('Default')
should contain_nova_config('cinder/username').with_value('cinder') should contain_nova_config('cinder/username').with_value('cinder')
should contain_nova_config('cinder/user_domain_name').with_value('Default') should contain_nova_config('cinder/user_domain_name').with_value('Default')
should contain_nova_config('cinder/os_region_name').with_value('<SERVICE DEFAULT>')
should contain_nova_config('cinder/catalog_info').with_value('<SERVICE DEFAULT>')
should contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
end end
end end
@ -27,6 +30,9 @@ describe 'nova::cinder' do
:auth_url => 'http://10.0.0.10:5000/v3', :auth_url => 'http://10.0.0.10:5000/v3',
:timeout => 60, :timeout => 60,
:region_name => 'RegionOne', :region_name => 'RegionOne',
:os_region_name => 'RegionOne',
:catalog_info => 'volumev3:cinderv3:publicURL',
:cross_az_attach => true,
} }
end end
@ -40,6 +46,9 @@ describe 'nova::cinder' do
should contain_nova_config('cinder/project_domain_name').with_value('Default') should contain_nova_config('cinder/project_domain_name').with_value('Default')
should contain_nova_config('cinder/username').with_value('cinder') should contain_nova_config('cinder/username').with_value('cinder')
should contain_nova_config('cinder/user_domain_name').with_value('Default') should contain_nova_config('cinder/user_domain_name').with_value('Default')
should contain_nova_config('cinder/os_region_name').with_value('RegionOne')
should contain_nova_config('cinder/catalog_info').with_value('volumev3:cinderv3:publicURL')
should contain_nova_config('cinder/cross_az_attach').with_value(true)
end end
end end

View File

@ -52,9 +52,6 @@ describe 'nova' do
is_expected.to contain_nova_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>') is_expected.to contain_nova_config('DEFAULT/transport_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>') is_expected.to contain_nova_config('DEFAULT/rpc_response_timeout').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/control_exchange').with_value('<SERVICE DEFAULT>') is_expected.to contain_nova_config('DEFAULT/control_exchange').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('cinder/os_region_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('cinder/cross_az_attach').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('cinder/catalog_info').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/cpu_allocation_ratio').with_value('<SERVICE DEFAULT>') is_expected.to contain_nova_config('DEFAULT/cpu_allocation_ratio').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/ram_allocation_ratio').with_value('<SERVICE DEFAULT>') is_expected.to contain_nova_config('DEFAULT/ram_allocation_ratio').with_value('<SERVICE DEFAULT>')
is_expected.to contain_nova_config('DEFAULT/disk_allocation_ratio').with_value('<SERVICE DEFAULT>') is_expected.to contain_nova_config('DEFAULT/disk_allocation_ratio').with_value('<SERVICE DEFAULT>')
@ -94,8 +91,6 @@ describe 'nova' do
:notification_topics => 'openstack', :notification_topics => 'openstack',
:notification_format => 'unversioned', :notification_format => 'unversioned',
:report_interval => '60', :report_interval => '60',
:os_region_name => 'MyRegion',
:cross_az_attach => 'MyAZ',
:ovsdb_connection => 'tcp:127.0.0.1:6640', :ovsdb_connection => 'tcp:127.0.0.1:6640',
:upgrade_level_cells => '1.0.0', :upgrade_level_cells => '1.0.0',
:upgrade_level_cert => '1.0.0', :upgrade_level_cert => '1.0.0',
@ -179,8 +174,6 @@ describe 'nova' do
is_expected.to contain_nova_config('notifications/notification_format').with_value('unversioned') is_expected.to contain_nova_config('notifications/notification_format').with_value('unversioned')
is_expected.to contain_nova_config('DEFAULT/report_interval').with_value('60') is_expected.to contain_nova_config('DEFAULT/report_interval').with_value('60')
is_expected.to contain_nova_config('DEFAULT/ovsdb_connection').with_value('tcp:127.0.0.1:6640') is_expected.to contain_nova_config('DEFAULT/ovsdb_connection').with_value('tcp:127.0.0.1:6640')
is_expected.to contain_nova_config('cinder/os_region_name').with_value('MyRegion')
is_expected.to contain_nova_config('cinder/cross_az_attach').with_value('MyAZ')
is_expected.to contain_nova_config('DEFAULT/ssl_only').with_value(true) is_expected.to contain_nova_config('DEFAULT/ssl_only').with_value(true)
is_expected.to contain_nova_config('DEFAULT/cert').with_value('/etc/ssl/private/snakeoil.pem') is_expected.to contain_nova_config('DEFAULT/cert').with_value('/etc/ssl/private/snakeoil.pem')
is_expected.to contain_nova_config('DEFAULT/key').with_value('/etc/ssl/certs/snakeoil.pem') is_expected.to contain_nova_config('DEFAULT/key').with_value('/etc/ssl/certs/snakeoil.pem')