Add parameter to configure instance defaults

New parameter accepts a hash value to configure
the LAUNCH_INSTANCE_DEFAULTS options in horizon
configuration.

Closes-Bug: #1721774
Change-Id: I778b3dc076d611d40205edbe0982141a815e1830
This commit is contained in:
Matthew J. Black 2017-10-06 08:40:46 -04:00
parent d10120cac7
commit f583d96659
4 changed files with 58 additions and 0 deletions

View File

@ -141,6 +141,30 @@
# profiles to enable. Defaults to 'None', other options include
# 'cisco'.
#
# [*instance_options*]
# (optional) A hash of parameters to enable or disable instance options
# when using the launch instance options under Compute Instances tab.
# These options include:
# 'config_drive': Boolean to set default value of config drive options.
# A value of 'True' to have a check in the checkbox or 'False' to have it
# unchecked.
# Defaults to True.
# 'create_volume': Boolean to set 'Create Volume' to 'Yes' or 'No' on source
# options. Values are True (Yes) or False (No).
# Defaults to True.
# 'disable_image': Boolean to not show 'Image' as a boot source option.
# Defaults to False.
# 'disable_instance_snapshot': Boolean to not show 'Instance Snapshot' as a
# boot source option.
# Defaults to False.
# 'disable_volume': Boolean to not show 'Volume' as a boot source option.
# Defaults to False.
# 'disable_volume_snapshot': Boolean to not show 'Volume Snapshot' as a
# boot source option.
# Defaults to False.
# 'enable_scheduler_hints': Boolean to allow scheduler hints to be provided.
# Defaults to True.
#
# [*configure_apache*]
# (optional) Configure Apache for Horizon. (Defaults to true)
#
@ -440,6 +464,7 @@ class horizon(
$cinder_options = {},
$keystone_options = {},
$neutron_options = {},
$instance_options = {},
$file_upload_temp_dir = '/tmp',
$policy_files_path = undef,
$policy_files = undef,
@ -540,12 +565,26 @@ settings_local.py and parameter server_aliases for setting ServerAlias directive
'profile_support' => 'None',
}
# Default options for the LAUNCH_INSTANCE_DEFAULTS section. These will
# be merged with user-provided options when the local_settings.py.erb
# template is interpolated.
$instance_defaults = {
'config_drive' => false,
'create_volume' => true,
'disable_image' => false,
'disable_instance_snapshot' => false,
'disable_volume' => false,
'disable_volume_snapshot' => false,
'enable_scheduler_hints' => true,
}
Service <| title == 'memcached' |> -> Class['horizon']
$hypervisor_options_real = merge($hypervisor_defaults,$hypervisor_options)
$cinder_options_real = merge($cinder_defaults,$cinder_options)
$keystone_options_real = merge($keystone_defaults, $keystone_options)
$neutron_options_real = merge($neutron_defaults,$neutron_options)
$instance_options_real = merge($instance_defaults,$instance_options)
validate_hash($api_versions)
validate_re($password_autocomplete, ['^on$', '^off$'])
validate_re($images_panel, ['^legacy$', '^angular$'])

View File

@ -0,0 +1,3 @@
---
features:
- Added parameter to horizon class to allow configuring LAUNCH_INSTANCE_DEFAULTS.

View File

@ -115,6 +115,7 @@ describe 'horizon' do
:neutron_options => {'enable_lb' => true, 'enable_firewall' => true, 'enable_quotas' => false, 'enable_security_group' => false, 'enable_vpn' => true,
'enable_distributed_router' => false, 'enable_ha_router' => false, 'profile_support' => 'cisco',
'supported_provider_types' => ['flat', 'vxlan'], 'supported_vnic_types' => ['*'], 'default_ipv4_subnet_pool_label' => 'None', },
:instance_options => {'disable_image' => true, 'disable_instance_snapshot' => true, 'disable_volume' => true, 'disable_volume_snapshot' => true, 'create_volume' => false },
:file_upload_temp_dir => '/var/spool/horizon',
:secure_cookies => true,
:api_versions => {'identity' => 2.0},
@ -181,6 +182,13 @@ describe 'horizon' do
'OPENSTACK_ENABLE_PASSWORD_RETRIEVE = True',
'CREATE_IMAGE_DEFAULTS = {',
" 'image_visibility': 'private',",
" 'config_drive': False,",
" 'create_volume': False,",
" 'disable_image': True,",
" 'disable_instance_snapshot': True,",
" 'disable_volume': True,",
" 'disable_volume_snapshot': True,",
" 'enable_scheduler_hints': True,",
'OPENSTACK_ENDPOINT_TYPE = "internalURL"',
'SECONDARY_ENDPOINT_TYPE = "ANY-VALUE"',
'API_RESULT_LIMIT = 4682',

View File

@ -388,6 +388,14 @@ OPENSTACK_CINDER_FEATURES = {
}
<%-end-%>
<%- if ! (@instance_options_real.empty?) -%>
LAUNCH_INSTANCE_DEFAULTS = {
<%- @instance_options_real.sort.each do |opt_name,opt_val| -%>
'<%= opt_name -%>': <%= opt_val.to_s.capitalize -%>,
<%-end-%>
}
<%-end-%>
# The OPENSTACK_NEUTRON_NETWORK settings can be used to enable optional
# services provided by neutron. Options currently available are load
# balancer service, security groups, quotas, VPN service.