2013-12-12 00:16:24 +11:00
|
|
|
# == Class: nova::api
|
2012-10-14 13:00:26 -07:00
|
|
|
#
|
2013-12-12 00:16:24 +11:00
|
|
|
# Setup and configure the Nova API endpoint
|
|
|
|
#
|
|
|
|
# === Parameters
|
|
|
|
#
|
|
|
|
# [*enabled*]
|
|
|
|
# (optional) Whether the nova api service will be run
|
2015-05-20 11:02:10 -07:00
|
|
|
# Defaults to true
|
2013-12-12 00:16:24 +11:00
|
|
|
#
|
2015-11-04 12:07:10 +02:00
|
|
|
# [*api_paste_config*]
|
|
|
|
# (optional) File name for the paste.deploy config for nova-api
|
|
|
|
# Defaults to 'api-paste.ini'
|
|
|
|
#
|
2014-01-13 22:58:10 -06:00
|
|
|
# [*manage_service*]
|
|
|
|
# (optional) Whether to start/stop the service
|
|
|
|
# Defaults to true
|
|
|
|
#
|
2013-12-12 00:16:24 +11:00
|
|
|
# [*ensure_package*]
|
|
|
|
# (optional) Whether the nova api package will be installed
|
|
|
|
# Defaults to 'present'
|
|
|
|
#
|
|
|
|
# [*api_bind_address*]
|
|
|
|
# (optional) IP address for nova-api server to listen
|
|
|
|
# Defaults to '0.0.0.0'
|
|
|
|
#
|
|
|
|
# [*metadata_listen*]
|
|
|
|
# (optional) IP address for metadata server to listen
|
|
|
|
# Defaults to '0.0.0.0'
|
|
|
|
#
|
2015-09-30 11:06:40 -04:00
|
|
|
# [*metadata_listen_port*]
|
|
|
|
# (optional) The port on which the metadata API will listen.
|
|
|
|
# Defaults to 8775
|
|
|
|
#
|
2013-12-12 00:16:24 +11:00
|
|
|
# [*enabled_apis*]
|
2015-08-14 15:42:16 -04:00
|
|
|
# (optional) A list of apis to enable
|
|
|
|
# Defaults to ['osapi_compute', 'metadata']
|
2013-12-12 00:16:24 +11:00
|
|
|
#
|
|
|
|
# [*use_forwarded_for*]
|
|
|
|
# (optional) Treat X-Forwarded-For as the canonical remote address. Only
|
|
|
|
# enable this if you have a sanitizing proxy.
|
|
|
|
# Defaults to false
|
|
|
|
#
|
2014-04-02 16:08:24 +02:00
|
|
|
# [*osapi_compute_workers*]
|
2013-12-12 00:16:24 +11:00
|
|
|
# (optional) Number of workers for OpenStack API service
|
2016-10-07 14:55:23 +03:00
|
|
|
# Defaults to $::os_workers
|
2013-12-12 00:16:24 +11:00
|
|
|
#
|
2015-09-30 11:06:40 -04:00
|
|
|
# [*osapi_compute_listen_port*]
|
|
|
|
# (optional) The port on which the OpenStack API will listen.
|
|
|
|
# Defaults to port 8774
|
|
|
|
#
|
2014-04-02 16:08:24 +02:00
|
|
|
# [*metadata_workers*]
|
|
|
|
# (optional) Number of workers for metadata service
|
2016-10-07 14:55:23 +03:00
|
|
|
# Defaults to $::os_workers
|
2014-04-02 16:08:24 +02:00
|
|
|
#
|
2015-10-14 16:36:35 -04:00
|
|
|
# [*instance_name_template*]
|
|
|
|
# (optional) Template string to be used to generate instance names
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
2013-12-12 00:16:24 +11:00
|
|
|
# [*sync_db*]
|
|
|
|
# (optional) Run nova-manage db sync on api nodes after installing the package.
|
|
|
|
# Defaults to true
|
|
|
|
#
|
2016-01-29 17:39:33 -05:00
|
|
|
# [*sync_db_api*]
|
|
|
|
# (optional) Run nova-manage api_db sync on api nodes after installing the package.
|
2016-04-09 10:35:11 -07:00
|
|
|
# Defaults to true
|
2016-01-29 17:39:33 -05:00
|
|
|
#
|
2017-01-17 14:38:36 +02:00
|
|
|
# [*db_online_data_migrations*]
|
|
|
|
# (optional) Run nova-manage db online_data_migrations on api nodes after
|
|
|
|
# installing the package - required on upgrade.
|
|
|
|
# Defaults to false.
|
|
|
|
#
|
2013-12-12 00:16:24 +11:00
|
|
|
# [*ratelimits*]
|
|
|
|
# (optional) A string that is a semicolon-separated list of 5-tuples.
|
|
|
|
# See http://docs.openstack.org/trunk/config-reference/content/configuring-compute-API.html
|
|
|
|
# Example: '(POST, "*", .*, 10, MINUTE);(POST, "*/servers", ^/servers, 50, DAY);(PUT, "*", .*, 10, MINUTE)'
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*ratelimits_factory*]
|
|
|
|
# (optional) The rate limiting factory to use
|
|
|
|
# Defaults to 'nova.api.openstack.compute.limits:RateLimitingMiddleware.factory'
|
2012-10-14 13:00:26 -07:00
|
|
|
#
|
2016-05-18 17:40:30 +03:00
|
|
|
# [*enable_proxy_headers_parsing*]
|
|
|
|
# (optional) This determines if the HTTPProxyToWSGI
|
|
|
|
# middleware should parse the proxy headers or not.(boolean value)
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2014-10-06 23:22:59 -04:00
|
|
|
# [*validate*]
|
|
|
|
# (optional) Whether to validate the service is working after any service refreshes
|
|
|
|
# Defaults to false
|
|
|
|
#
|
2015-11-04 12:07:10 +02:00
|
|
|
# [*fping_path*]
|
|
|
|
# (optional) Full path to fping.
|
|
|
|
# Defaults to '/usr/sbin/fping'
|
|
|
|
#
|
2014-10-06 23:22:59 -04:00
|
|
|
# [*validation_options*]
|
|
|
|
# (optional) Service validation options
|
|
|
|
# Should be a hash of options defined in openstacklib::service_validation
|
|
|
|
# If empty, defaults values are taken from openstacklib function.
|
|
|
|
# Default command list nova flavors.
|
|
|
|
# Require validate set at True.
|
|
|
|
# Example:
|
|
|
|
# nova::api::validation_options:
|
|
|
|
# nova-api:
|
|
|
|
# command: check_nova.py
|
|
|
|
# path: /usr/bin:/bin:/usr/sbin:/sbin
|
|
|
|
# provider: shell
|
|
|
|
# tries: 5
|
|
|
|
# try_sleep: 10
|
|
|
|
# Defaults to {}
|
|
|
|
#
|
2015-08-14 15:42:16 -04:00
|
|
|
# [*service_name*]
|
|
|
|
# (optional) Name of the service that will be providing the
|
|
|
|
# server functionality of nova-api.
|
|
|
|
# If the value is 'httpd', this means nova-api will be a web
|
|
|
|
# service, and you must use another class to configure that
|
|
|
|
# web service. For example, use class { 'nova::wsgi::apache'...}
|
|
|
|
# to make nova be a web app using apache mod_wsgi.
|
|
|
|
# Defaults to '$::nova::params::api_service_name'
|
|
|
|
#
|
2017-01-20 21:51:01 +08:00
|
|
|
# [*max_limit*]
|
2016-07-01 12:29:23 +08:00
|
|
|
# (optional) This option is limit the maximum number of items in a single response.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2017-01-20 21:51:01 +08:00
|
|
|
# [*compute_link_prefix*]
|
2016-07-01 12:29:23 +08:00
|
|
|
# (optional) This string is prepended to the normal URL that is returned in links
|
|
|
|
# to the OpenStack Compute API.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2017-01-20 21:51:01 +08:00
|
|
|
# [*glance_link_prefix*]
|
2016-07-01 12:29:23 +08:00
|
|
|
# (optional) This string is prepended to the normal URL that is returned in links
|
|
|
|
# to Glance resources.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2017-01-20 21:51:01 +08:00
|
|
|
# [*hide_server_address_states*]
|
2016-07-20 15:44:47 +08:00
|
|
|
# (optional) This option is a list of all instance states for which network address
|
|
|
|
# information should not be returned from the API.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*allow_instance_snapshots*]
|
|
|
|
# (optional) Operators can turn off the ability for a user to take snapshots of their
|
|
|
|
# instances by setting this option to False
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*enable_network_quota*]
|
|
|
|
# (optional) This option is used to enable or disable quota checking for tenant networks
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*enable_instance_password*]
|
|
|
|
# (optional) Enables returning of the instance password by the relevant server API calls
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*password_length*]
|
|
|
|
# (optional) Length of generated instance admin passwords (integer value)
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2016-08-02 19:21:47 +03:00
|
|
|
# [*install_cinder_client*]
|
|
|
|
# (optional) Whether the cinder::client class should be used to install the cinder client.
|
|
|
|
# Defaults to true
|
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# [*allow_resize_to_same_host*]
|
2016-09-20 22:43:09 -06:00
|
|
|
# (optional) Allow destination machine to match source for resize. Note that this
|
2018-04-18 15:20:30 +05:30
|
|
|
# is also settable in the compute class. In some situations you need it set here
|
2016-09-20 22:43:09 -06:00
|
|
|
# and in others you need it set there.
|
|
|
|
# Defaults to false
|
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# DEPRECATED
|
|
|
|
#
|
|
|
|
# [*nova_metadata_wsgi_enabled*]
|
|
|
|
# Wether nova metadata api is run via wsgi. Since running metadata via eventlet is
|
|
|
|
# going to be removed in the Sein release we can deprecate this and plan to remove
|
|
|
|
# metadata handling from api class.
|
|
|
|
# Defaults to false
|
|
|
|
#
|
|
|
|
# [*neutron_metadata_proxy_shared_secret*]
|
|
|
|
# (optional) Shared secret to validate proxies Neutron metadata requests
|
|
|
|
# Defaults to undef
|
|
|
|
#
|
|
|
|
# [*metadata_cache_expiration*]
|
|
|
|
# (optional) This option is the time (in seconds) to cache metadata.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*vendordata_jsonfile_path*]
|
|
|
|
# (optional) Represent the path to the data file.
|
|
|
|
# Cloud providers may store custom data in vendor data file that will then be
|
|
|
|
# available to the instances via the metadata service, and to the rendering of
|
|
|
|
# config-drive. The default class for this, JsonFileVendorData, loads this
|
|
|
|
# information from a JSON file, whose path is configured by this option
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*vendordata_providers*]
|
|
|
|
# (optional) vendordata providers are how deployers can provide metadata via
|
|
|
|
# configdrive and metadata that is specific to their deployment. There are
|
|
|
|
# currently two supported providers: StaticJSON and DynamicJSON.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*vendordata_dynamic_targets*]
|
|
|
|
# (optional) A list of targets for the dynamic vendordata provider. These
|
|
|
|
# targets are of the form <name>@<url>.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*vendordata_dynamic_connect_timeout*]
|
|
|
|
# (optional) Maximum wait time for an external REST service to connect.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*vendordata_dynamic_read_timeout*]
|
|
|
|
# (optional) Maximum wait time for an external REST service to return data
|
|
|
|
# once connected.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*vendordata_dynamic_failure_fatal*]
|
|
|
|
# (optional) Should failures to fetch dynamic vendordata be fatal to
|
|
|
|
# instance boot?
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
|
|
|
# [*vendordata_dynamic_auth_auth_type*]
|
2017-03-27 18:27:48 +03:00
|
|
|
# (optional) Authentication type to load for vendordata dynamic plugins.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# [*vendordata_dynamic_auth_auth_url*]
|
2017-03-27 18:27:48 +03:00
|
|
|
# (optional) URL to use for authenticating.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# [*vendordata_dynamic_auth_os_region_name*]
|
2017-03-27 18:27:48 +03:00
|
|
|
# (optional) Region name for the vendordata dynamic plugin credentials.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# [*vendordata_dynamic_auth_password*]
|
2017-03-27 18:27:48 +03:00
|
|
|
# (optional) Password for the vendordata dynamic plugin credentials.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# [*vendordata_dynamic_auth_project_domain_name*]
|
2017-03-27 18:27:48 +03:00
|
|
|
# (optional) Project domain name for the vendordata dynamic plugin
|
|
|
|
# credentials.
|
2017-10-05 10:38:59 -07:00
|
|
|
# Defaults to 'Default'
|
2017-03-27 18:27:48 +03:00
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# [*vendordata_dynamic_auth_project_name*]
|
2017-03-27 18:27:48 +03:00
|
|
|
# (optional) Project name for the vendordata dynamic plugin credentials.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# [*vendordata_dynamic_auth_user_domain_name*]
|
2017-03-27 18:27:48 +03:00
|
|
|
# (optional) User domain name for the vendordata dynamic plugin credentials.
|
2017-10-05 10:38:59 -07:00
|
|
|
# Defaults to 'Default'
|
2017-03-27 18:27:48 +03:00
|
|
|
#
|
2018-07-13 17:11:38 +02:00
|
|
|
# [*vendordata_dynamic_auth_username*]
|
2017-03-27 18:27:48 +03:00
|
|
|
# (optional) User name for the vendordata dynamic plugin credentials.
|
|
|
|
# Defaults to $::os_service_default
|
|
|
|
#
|
2012-04-01 14:23:36 -07:00
|
|
|
class nova::api(
|
2017-03-27 18:27:48 +03:00
|
|
|
$enabled = true,
|
|
|
|
$manage_service = true,
|
|
|
|
$api_paste_config = 'api-paste.ini',
|
|
|
|
$ensure_package = 'present',
|
|
|
|
$api_bind_address = '0.0.0.0',
|
|
|
|
$osapi_compute_listen_port = 8774,
|
|
|
|
$metadata_listen = '0.0.0.0',
|
|
|
|
$metadata_listen_port = 8775,
|
|
|
|
$enabled_apis = ['osapi_compute', 'metadata'],
|
|
|
|
$use_forwarded_for = false,
|
|
|
|
$osapi_compute_workers = $::os_workers,
|
|
|
|
$metadata_workers = $::os_workers,
|
|
|
|
$sync_db = true,
|
|
|
|
$sync_db_api = true,
|
|
|
|
$db_online_data_migrations = false,
|
|
|
|
$neutron_metadata_proxy_shared_secret = undef,
|
|
|
|
$ratelimits = undef,
|
|
|
|
$ratelimits_factory =
|
2014-04-02 16:08:24 +02:00
|
|
|
'nova.api.openstack.compute.limits:RateLimitingMiddleware.factory',
|
2017-03-27 18:27:48 +03:00
|
|
|
$validate = false,
|
|
|
|
$validation_options = {},
|
|
|
|
$instance_name_template = undef,
|
|
|
|
$fping_path = '/usr/sbin/fping',
|
|
|
|
$service_name = $::nova::params::api_service_name,
|
|
|
|
$enable_proxy_headers_parsing = $::os_service_default,
|
|
|
|
$metadata_cache_expiration = $::os_service_default,
|
|
|
|
$vendordata_jsonfile_path = $::os_service_default,
|
|
|
|
$vendordata_providers = $::os_service_default,
|
|
|
|
$vendordata_dynamic_targets = $::os_service_default,
|
|
|
|
$vendordata_dynamic_connect_timeout = $::os_service_default,
|
|
|
|
$vendordata_dynamic_read_timeout = $::os_service_default,
|
|
|
|
$vendordata_dynamic_failure_fatal = $::os_service_default,
|
|
|
|
$max_limit = $::os_service_default,
|
|
|
|
$compute_link_prefix = $::os_service_default,
|
|
|
|
$glance_link_prefix = $::os_service_default,
|
|
|
|
$hide_server_address_states = $::os_service_default,
|
|
|
|
$allow_instance_snapshots = $::os_service_default,
|
|
|
|
$enable_network_quota = $::os_service_default,
|
|
|
|
$enable_instance_password = $::os_service_default,
|
|
|
|
$password_length = $::os_service_default,
|
|
|
|
$install_cinder_client = true,
|
|
|
|
$allow_resize_to_same_host = false,
|
|
|
|
$vendordata_dynamic_auth_auth_type = $::os_service_default,
|
|
|
|
$vendordata_dynamic_auth_auth_url = $::os_service_default,
|
|
|
|
$vendordata_dynamic_auth_os_region_name = $::os_service_default,
|
|
|
|
$vendordata_dynamic_auth_password = $::os_service_default,
|
2017-10-05 10:38:59 -07:00
|
|
|
$vendordata_dynamic_auth_project_domain_name = 'Default',
|
2017-03-27 18:27:48 +03:00
|
|
|
$vendordata_dynamic_auth_project_name = $::os_service_default,
|
2017-10-05 10:38:59 -07:00
|
|
|
$vendordata_dynamic_auth_user_domain_name = 'Default',
|
2017-03-27 18:27:48 +03:00
|
|
|
$vendordata_dynamic_auth_username = $::os_service_default,
|
2018-07-13 17:11:38 +02:00
|
|
|
# DEPRECATED PARAMETER
|
|
|
|
$nova_metadata_wsgi_enabled = false,
|
2015-08-14 15:42:16 -04:00
|
|
|
) inherits nova::params {
|
2012-04-23 16:57:54 -07:00
|
|
|
|
2015-11-16 02:55:39 +00:00
|
|
|
include ::nova::deps
|
2015-02-16 10:01:53 -05:00
|
|
|
include ::nova::db
|
|
|
|
include ::nova::policy
|
2016-07-04 21:47:31 -03:00
|
|
|
include ::nova::keystone::authtoken
|
2011-05-27 11:25:26 -07:00
|
|
|
|
2018-07-13 17:11:38 +02:00
|
|
|
if !$nova_metadata_wsgi_enabled {
|
|
|
|
warning('Running nova metadata api via evenlet is deprecated and will be removed in Stein release.')
|
|
|
|
}
|
|
|
|
|
2016-08-02 19:21:47 +03:00
|
|
|
if $install_cinder_client {
|
|
|
|
include ::cinder::client
|
|
|
|
Class['cinder::client'] ~> Nova::Generic_service['api']
|
|
|
|
}
|
|
|
|
|
2015-10-14 16:36:35 -04:00
|
|
|
if $instance_name_template {
|
|
|
|
nova_config {
|
|
|
|
'DEFAULT/instance_name_template': value => $instance_name_template;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nova_config{
|
|
|
|
'DEFAULT/instance_name_template': ensure => absent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-24 09:02:07 +03:00
|
|
|
if !is_service_default($vendordata_providers) and !empty($vendordata_providers){
|
|
|
|
validate_array($vendordata_providers)
|
|
|
|
$vendordata_providers_real = join($vendordata_providers, ',')
|
|
|
|
} else {
|
|
|
|
$vendordata_providers_real = $::os_service_default
|
|
|
|
}
|
|
|
|
|
|
|
|
if !is_service_default($vendordata_dynamic_targets) and !empty($vendordata_dynamic_targets){
|
|
|
|
validate_array($vendordata_dynamic_targets)
|
|
|
|
$vendordata_dynamic_targets_real = join($vendordata_dynamic_targets, ',')
|
|
|
|
} else {
|
|
|
|
$vendordata_dynamic_targets_real = $::os_service_default
|
|
|
|
}
|
|
|
|
|
2018-07-13 17:11:38 +02:00
|
|
|
# enable metadata in eventlet if we do not run metadata via wsgi (nova::metadata)
|
|
|
|
if ('metadata' in $enabled_apis and $service_name == 'httpd' and !$nova_metadata_wsgi_enabled) {
|
2015-08-14 15:42:16 -04:00
|
|
|
$enable_metadata = true
|
|
|
|
} else {
|
|
|
|
$enable_metadata = false
|
|
|
|
}
|
|
|
|
|
|
|
|
# sanitize service_name and prepare DEFAULT/enabled_apis parameter
|
|
|
|
if $service_name == $::nova::params::api_service_name {
|
|
|
|
# if running evenlet, we use the original puppet parameter
|
|
|
|
# so people can enable custom service names and we keep backward compatibility.
|
2016-05-21 08:56:01 -03:00
|
|
|
$enabled_apis_real = $enabled_apis
|
2015-08-14 15:42:16 -04:00
|
|
|
$service_enabled = $enabled
|
|
|
|
} elsif $service_name == 'httpd' {
|
|
|
|
# when running wsgi, we want to enable metadata in eventlet if part of enabled_apis
|
2018-07-13 17:11:38 +02:00
|
|
|
# but only if we do not run metadata via wsgi (nova::metadata)
|
2015-08-14 15:42:16 -04:00
|
|
|
if $enable_metadata {
|
2016-05-21 08:56:01 -03:00
|
|
|
$enabled_apis_real = ['metadata']
|
2015-08-14 15:42:16 -04:00
|
|
|
$service_enabled = $enabled
|
|
|
|
} else {
|
2016-05-21 08:56:01 -03:00
|
|
|
# otherwise, set it to empty list
|
|
|
|
$enabled_apis_real = []
|
2015-08-14 15:42:16 -04:00
|
|
|
# if running wsgi for compute, and metadata disabled
|
|
|
|
# we don't need to enable nova-api service.
|
|
|
|
$service_enabled = false
|
|
|
|
}
|
2016-06-17 18:36:07 +03:00
|
|
|
policy_rcd { 'nova-api':
|
|
|
|
ensure => present,
|
|
|
|
set_code => '101',
|
|
|
|
before => Package['nova-api'],
|
|
|
|
}
|
2018-08-14 17:12:48 +02:00
|
|
|
Service <| title == 'httpd' |> { tag +> 'nova-service' }
|
2015-08-14 15:42:16 -04:00
|
|
|
# make sure we start apache before nova-api to avoid binding issues
|
|
|
|
Service[$service_name] -> Service['nova-api']
|
|
|
|
} else {
|
2016-09-26 10:12:12 +02:00
|
|
|
fail("Invalid service_name. Either nova-api/openstack-nova-api for running \
|
|
|
|
as a standalone service, or httpd for being run by a httpd server")
|
2015-08-14 15:42:16 -04:00
|
|
|
}
|
|
|
|
|
2012-04-01 14:23:36 -07:00
|
|
|
nova::generic_service { 'api':
|
2015-08-14 15:42:16 -04:00
|
|
|
enabled => $service_enabled,
|
2014-01-13 22:58:10 -06:00
|
|
|
manage_service => $manage_service,
|
2012-05-08 13:32:36 -05:00
|
|
|
ensure_package => $ensure_package,
|
|
|
|
package_name => $::nova::params::api_package_name,
|
|
|
|
service_name => $::nova::params::api_service_name,
|
2012-03-30 13:09:30 +02:00
|
|
|
}
|
|
|
|
|
2012-10-11 02:01:06 -07:00
|
|
|
nova_config {
|
2017-03-27 18:27:48 +03:00
|
|
|
'wsgi/api_paste_config': value => $api_paste_config;
|
|
|
|
'DEFAULT/enabled_apis': value => join($enabled_apis_real, ',');
|
|
|
|
'DEFAULT/osapi_compute_listen': value => $api_bind_address;
|
|
|
|
'DEFAULT/metadata_listen': value => $metadata_listen;
|
|
|
|
'DEFAULT/metadata_listen_port': value => $metadata_listen_port;
|
|
|
|
'DEFAULT/osapi_compute_listen_port': value => $osapi_compute_listen_port;
|
|
|
|
'DEFAULT/osapi_compute_workers': value => $osapi_compute_workers;
|
|
|
|
'DEFAULT/metadata_workers': value => $metadata_workers;
|
|
|
|
'DEFAULT/enable_network_quota': value => $enable_network_quota;
|
|
|
|
'DEFAULT/password_length': value => $password_length;
|
|
|
|
'api/metadata_cache_expiration': value => $metadata_cache_expiration;
|
|
|
|
'api/use_forwarded_for': value => $use_forwarded_for;
|
|
|
|
'api/fping_path': value => $fping_path;
|
|
|
|
'api/vendordata_jsonfile_path': value => $vendordata_jsonfile_path;
|
|
|
|
'api/vendordata_providers': value => $vendordata_providers_real;
|
|
|
|
'api/vendordata_dynamic_targets': value => $vendordata_dynamic_targets_real;
|
|
|
|
'api/vendordata_dynamic_connect_timeout': value => $vendordata_dynamic_connect_timeout;
|
|
|
|
'api/vendordata_dynamic_read_timeout': value => $vendordata_dynamic_read_timeout;
|
|
|
|
'api/vendordata_dynamic_failure_fatal': value => $vendordata_dynamic_failure_fatal;
|
2018-05-19 01:42:50 +02:00
|
|
|
'api/max_limit': value => $max_limit;
|
|
|
|
'api/compute_link_prefix': value => $compute_link_prefix;
|
|
|
|
'api/glance_link_prefix': value => $glance_link_prefix;
|
|
|
|
'api/hide_server_address_states': value => $hide_server_address_states;
|
2017-03-27 18:27:48 +03:00
|
|
|
'api/allow_instance_snapshots': value => $allow_instance_snapshots;
|
|
|
|
'api/enable_instance_password': value => $enable_instance_password;
|
|
|
|
'vendordata_dynamic_auth/auth_type': value => $vendordata_dynamic_auth_auth_type;
|
|
|
|
'vendordata_dynamic_auth/auth_url': value => $vendordata_dynamic_auth_auth_url;
|
|
|
|
'vendordata_dynamic_auth/os_region_name': value => $vendordata_dynamic_auth_os_region_name;
|
|
|
|
'vendordata_dynamic_auth/password': value => $vendordata_dynamic_auth_password, secret => true;
|
|
|
|
'vendordata_dynamic_auth/project_domain_name': value => $vendordata_dynamic_auth_project_domain_name;
|
|
|
|
'vendordata_dynamic_auth/project_name': value => $vendordata_dynamic_auth_project_name;
|
|
|
|
'vendordata_dynamic_auth/user_domain_name': value => $vendordata_dynamic_auth_user_domain_name;
|
|
|
|
'vendordata_dynamic_auth/username': value => $vendordata_dynamic_auth_username;
|
2012-10-11 02:01:06 -07:00
|
|
|
}
|
2012-04-08 22:40:50 +00:00
|
|
|
|
2016-05-18 17:40:30 +03:00
|
|
|
oslo::middleware {'nova_config':
|
|
|
|
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
|
|
|
|
}
|
|
|
|
|
2013-08-06 10:58:50 -05:00
|
|
|
if ($neutron_metadata_proxy_shared_secret){
|
2013-05-03 12:46:59 +02:00
|
|
|
nova_config {
|
2014-10-28 17:04:21 -04:00
|
|
|
'neutron/service_metadata_proxy': value => true;
|
|
|
|
'neutron/metadata_proxy_shared_secret':
|
2017-03-28 11:27:59 +03:00
|
|
|
value => $neutron_metadata_proxy_shared_secret, secret => true;
|
2013-05-03 12:46:59 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
nova_config {
|
2014-10-28 17:04:21 -04:00
|
|
|
'neutron/service_metadata_proxy': value => false;
|
|
|
|
'neutron/metadata_proxy_shared_secret': ensure => absent;
|
2013-05-03 12:46:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-08 17:46:42 +00:00
|
|
|
if ($ratelimits != undef) {
|
|
|
|
nova_paste_api_ini {
|
|
|
|
'filter:ratelimit/paste.filter_factory': value => $ratelimits_factory;
|
|
|
|
'filter:ratelimit/limits': value => $ratelimits;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:09:29 -04:00
|
|
|
# Added arg and if statement prevents this from being run
|
|
|
|
# where db is not active i.e. the compute
|
2012-11-28 22:17:22 -08:00
|
|
|
if $sync_db {
|
2015-06-29 16:10:44 +02:00
|
|
|
include ::nova::db::sync
|
2012-10-09 22:25:00 -07:00
|
|
|
}
|
2016-01-29 17:39:33 -05:00
|
|
|
if $sync_db_api {
|
|
|
|
include ::nova::db::sync_api
|
|
|
|
}
|
2017-01-17 14:38:36 +02:00
|
|
|
if $db_online_data_migrations {
|
|
|
|
include ::nova::db::online_data_migrations
|
|
|
|
}
|
2012-10-09 22:25:00 -07:00
|
|
|
|
2013-10-10 10:26:37 +02:00
|
|
|
# Remove auth configuration from api-paste.ini
|
|
|
|
nova_paste_api_ini {
|
|
|
|
'filter:authtoken/auth_uri': ensure => absent;
|
|
|
|
'filter:authtoken/auth_host': ensure => absent;
|
|
|
|
'filter:authtoken/auth_port': ensure => absent;
|
|
|
|
'filter:authtoken/auth_protocol': ensure => absent;
|
|
|
|
'filter:authtoken/admin_tenant_name': ensure => absent;
|
|
|
|
'filter:authtoken/admin_user': ensure => absent;
|
|
|
|
'filter:authtoken/admin_password': ensure => absent;
|
|
|
|
'filter:authtoken/auth_admin_prefix': ensure => absent;
|
|
|
|
}
|
2015-02-06 23:22:09 +11:00
|
|
|
|
2014-10-06 23:22:59 -04:00
|
|
|
if $validate {
|
2016-08-15 12:46:49 +02:00
|
|
|
#Shrinking the variables names in favor of not
|
|
|
|
#having more than 140 chars per line
|
|
|
|
#Admin user real
|
2016-11-08 01:16:34 -03:00
|
|
|
$aur = $::nova::keystone::authtoken::username
|
2016-08-15 12:46:49 +02:00
|
|
|
#Admin password real
|
2016-11-08 01:16:34 -03:00
|
|
|
$apr = $::nova::keystone::authtoken::password
|
2017-05-15 12:50:34 +05:30
|
|
|
#Admin tenant name real
|
2016-11-08 01:16:34 -03:00
|
|
|
$atnr = $::nova::keystone::authtoken::project_name
|
2016-08-15 12:46:49 +02:00
|
|
|
#Keystone Auth URI
|
2018-04-03 16:55:03 +08:00
|
|
|
# TODO(tobasco): Remove pick when auth_uri is removed.
|
|
|
|
$kau = pick($::nova::keystone::authtoken::auth_uri, $::nova::keystone::authtoken::www_authenticate_uri)
|
2014-10-06 23:22:59 -04:00
|
|
|
$defaults = {
|
|
|
|
'nova-api' => {
|
2016-08-15 12:46:49 +02:00
|
|
|
'command' => "nova --os-auth-url ${kau} --os-project-name ${atnr} --os-username ${aur} --os-password ${apr} flavor-list",
|
2014-10-06 23:22:59 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$validation_options_hash = merge ($defaults, $validation_options)
|
|
|
|
create_resources('openstacklib::service_validation', $validation_options_hash, {'subscribe' => 'Service[nova-api]'})
|
|
|
|
}
|
2016-09-20 22:43:09 -06:00
|
|
|
|
|
|
|
ensure_resource('nova_config', 'DEFAULT/allow_resize_to_same_host', { value => $allow_resize_to_same_host })
|
2011-05-26 12:19:52 -07:00
|
|
|
}
|