123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780 |
- class nova(
- $ensure_package = 'present',
- $database_connection = undef,
- $slave_connection = undef,
- $api_database_connection = undef,
- $api_slave_connection = undef,
- $placement_database_connection = undef,
- $placement_slave_connection = undef,
- $block_device_allocate_retries = $::os_service_default,
- $block_device_allocate_retries_interval = $::os_service_default,
- $database_idle_timeout = undef,
- $database_min_pool_size = undef,
- $database_max_pool_size = undef,
- $database_max_retries = undef,
- $database_retry_interval = undef,
- $database_max_overflow = undef,
- $default_transport_url = $::os_service_default,
- $rpc_response_timeout = $::os_service_default,
- $rpc_backend = $::os_service_default,
- $image_service = 'nova.image.glance.GlanceImageService',
-
-
- $glance_api_servers = 'http://localhost:9292',
- $rabbit_use_ssl = $::os_service_default,
- $rabbit_heartbeat_timeout_threshold = $::os_service_default,
- $rabbit_heartbeat_rate = $::os_service_default,
- $rabbit_ha_queues = $::os_service_default,
- $kombu_ssl_ca_certs = $::os_service_default,
- $kombu_ssl_certfile = $::os_service_default,
- $kombu_ssl_keyfile = $::os_service_default,
- $kombu_ssl_version = $::os_service_default,
- $kombu_reconnect_delay = $::os_service_default,
- $kombu_compression = $::os_service_default,
- $amqp_durable_queues = $::os_service_default,
- $amqp_server_request_prefix = $::os_service_default,
- $amqp_broadcast_prefix = $::os_service_default,
- $amqp_group_request_prefix = $::os_service_default,
- $amqp_container_name = $::os_service_default,
- $amqp_idle_timeout = $::os_service_default,
- $amqp_trace = $::os_service_default,
- $amqp_ssl_ca_file = $::os_service_default,
- $amqp_ssl_cert_file = $::os_service_default,
- $amqp_ssl_key_file = $::os_service_default,
- $amqp_ssl_key_password = $::os_service_default,
- $amqp_allow_insecure_clients = $::os_service_default,
- $amqp_sasl_mechanisms = $::os_service_default,
- $amqp_sasl_config_dir = $::os_service_default,
- $amqp_sasl_config_name = $::os_service_default,
- $amqp_username = $::os_service_default,
- $amqp_password = $::os_service_default,
- $host = $::os_service_default,
- $auth_strategy = 'keystone',
- $service_down_time = 60,
- $log_dir = undef,
- $state_path = '/var/lib/nova',
- $lock_path = $::nova::params::lock_path,
- $debug = undef,
- $periodic_interval = '60',
- $report_interval = '10',
- $rootwrap_config = '/etc/nova/rootwrap.conf',
- $use_ssl = false,
- $enabled_ssl_apis = ['metadata', 'osapi_compute'],
- $ca_file = false,
- $cert_file = false,
- $key_file = false,
- $nova_public_key = undef,
- $nova_private_key = undef,
- $use_syslog = undef,
- $use_stderr = undef,
- $log_facility = undef,
- $notification_transport_url = $::os_service_default,
- $notification_driver = $::os_service_default,
- $notification_topics = $::os_service_default,
- $notify_api_faults = false,
- $notify_on_state_change = undef,
- $os_region_name = $::os_service_default,
- $cinder_catalog_info = 'volumev2:cinderv2:publicURL',
- $upgrade_level_cells = $::os_service_default,
- $upgrade_level_cert = $::os_service_default,
- $upgrade_level_compute = $::os_service_default,
- $upgrade_level_conductor = $::os_service_default,
- $upgrade_level_console = $::os_service_default,
- $upgrade_level_consoleauth = $::os_service_default,
- $upgrade_level_intercell = $::os_service_default,
- $upgrade_level_network = $::os_service_default,
- $upgrade_level_scheduler = $::os_service_default,
- $use_ipv6 = $::os_service_default,
- $cpu_allocation_ratio = $::os_service_default,
- $ram_allocation_ratio = $::os_service_default,
- $disk_allocation_ratio = $::os_service_default,
- $purge_config = false,
-
- $rabbit_host = $::os_service_default,
- $rabbit_hosts = $::os_service_default,
- $rabbit_password = $::os_service_default,
- $rabbit_port = $::os_service_default,
- $rabbit_userid = $::os_service_default,
- $rabbit_virtual_host = $::os_service_default,
- ) inherits nova::params {
- include ::nova::deps
-
- include ::nova::db
- include ::nova::logging
- validate_array($enabled_ssl_apis)
- if empty($enabled_ssl_apis) and $use_ssl {
- warning('enabled_ssl_apis is empty but use_ssl is set to true')
- }
- if !is_service_default($rabbit_host) or
- !is_service_default($rabbit_hosts) or
- !is_service_default($rabbit_password) or
- !is_service_default($rabbit_port) or
- !is_service_default($rabbit_userid) or
- !is_service_default($rabbit_virtual_host) {
- warning("nova::rabbit_host, nova::rabbit_hosts, nova::rabbit_password, \
- nova::rabbit_port, nova::rabbit_userid and nova::rabbit_virtual_host are \
- deprecated. Please use nova::default_transport_url instead.")
- }
- if $use_ssl {
- if !$cert_file {
- fail('The cert_file parameter is required when use_ssl is set to true')
- }
- if !$key_file {
- fail('The key_file parameter is required when use_ssl is set to true')
- }
- }
- if $nova_public_key or $nova_private_key {
- file { '/var/lib/nova/.ssh':
- ensure => directory,
- mode => '0700',
- owner => 'nova',
- group => 'nova',
- require => Anchor['nova::config::begin'],
- before => Anchor['nova::config::end'],
- }
- if $nova_public_key {
- if ! $nova_public_key['key'] or ! $nova_public_key['type'] {
- fail('You must provide both a key type and key data.')
- }
- ssh_authorized_key { 'nova-migration-public-key':
- ensure => present,
- key => $nova_public_key['key'],
- type => $nova_public_key['type'],
- user => 'nova',
- require => File['/var/lib/nova/.ssh'],
- }
- }
- if $nova_private_key {
- if ! $nova_private_key[key] or ! $nova_private_key['type'] {
- fail('You must provide both a key type and key data.')
- }
- $nova_private_key_file = $nova_private_key['type'] ? {
- 'ssh-rsa' => '/var/lib/nova/.ssh/id_rsa',
- 'ssh-dsa' => '/var/lib/nova/.ssh/id_dsa',
- 'ssh-ecdsa' => '/var/lib/nova/.ssh/id_ecdsa',
- default => undef
- }
- if ! $nova_private_key_file {
- fail("Unable to determine name of private key file. Type specified was '${nova_private_key['type']}' \
- but should be one of: ssh-rsa, ssh-dsa, ssh-ecdsa.")
- }
- file { $nova_private_key_file:
- content => $nova_private_key[key],
- mode => '0600',
- owner => 'nova',
- group => 'nova',
- require => File['/var/lib/nova/.ssh'],
- }
- }
- }
- package { 'python-nova':
- ensure => $ensure_package,
- tag => ['openstack', 'nova-package'],
- }
- package { 'nova-common':
- ensure => $ensure_package,
- name => $::nova::params::common_package_name,
- require => Package['python-nova'],
- tag => ['openstack', 'nova-package'],
- }
-
-
- exec { 'networking-refresh':
- command => '/sbin/ifdown -a ; /sbin/ifup -a',
- refreshonly => true,
- }
- resources { 'nova_config':
- purge => $purge_config,
- }
- if $image_service == 'nova.image.glance.GlanceImageService' {
- if $glance_api_servers {
- nova_config { 'glance/api_servers': value => $glance_api_servers }
- }
- }
-
- $real_cpu_allocation_ratio = pick($::nova::scheduler::filter::cpu_allocation_ratio, $cpu_allocation_ratio)
- ensure_resource('nova_config', 'DEFAULT/cpu_allocation_ratio', { value => $real_cpu_allocation_ratio })
- $real_ram_allocation_ratio = pick($::nova::scheduler::filter::ram_allocation_ratio, $ram_allocation_ratio)
- ensure_resource('nova_config', 'DEFAULT/ram_allocation_ratio', { value => $real_ram_allocation_ratio })
- $real_disk_allocation_ratio = pick($::nova::scheduler::filter::disk_allocation_ratio, $disk_allocation_ratio)
- ensure_resource('nova_config', 'DEFAULT/disk_allocation_ratio', { value => $real_disk_allocation_ratio })
- nova_config {
- 'api/auth_strategy': value => $auth_strategy;
- 'DEFAULT/image_service': value => $image_service;
- 'DEFAULT/host': value => $host;
- }
-
-
- if $rpc_backend in [$::os_service_default, 'nova.openstack.common.rpc.impl_kombu', 'rabbit'] {
- oslo::messaging::rabbit {'nova_config':
- rabbit_password => $rabbit_password,
- rabbit_userid => $rabbit_userid,
- rabbit_virtual_host => $rabbit_virtual_host,
- rabbit_use_ssl => $rabbit_use_ssl,
- heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold,
- heartbeat_rate => $rabbit_heartbeat_rate,
- kombu_reconnect_delay => $kombu_reconnect_delay,
- amqp_durable_queues => $amqp_durable_queues,
- kombu_compression => $kombu_compression,
- kombu_ssl_ca_certs => $kombu_ssl_ca_certs,
- kombu_ssl_certfile => $kombu_ssl_certfile,
- kombu_ssl_keyfile => $kombu_ssl_keyfile,
- kombu_ssl_version => $kombu_ssl_version,
- rabbit_hosts => $rabbit_hosts,
- rabbit_host => $rabbit_host,
- rabbit_port => $rabbit_port,
- rabbit_ha_queues => $rabbit_ha_queues,
- }
- } elsif $rpc_backend == 'amqp' {
- oslo::messaging::amqp { 'nova_config':
- server_request_prefix => $amqp_server_request_prefix,
- broadcast_prefix => $amqp_broadcast_prefix,
- group_request_prefix => $amqp_group_request_prefix,
- container_name => $amqp_container_name,
- idle_timeout => $amqp_idle_timeout,
- trace => $amqp_trace,
- ssl_ca_file => $amqp_ssl_ca_file,
- ssl_cert_file => $amqp_ssl_cert_file,
- ssl_key_file => $amqp_ssl_key_file,
- ssl_key_password => $amqp_ssl_key_password,
- allow_insecure_clients => $amqp_allow_insecure_clients,
- sasl_mechanisms => $amqp_sasl_mechanisms,
- sasl_config_dir => $amqp_sasl_config_dir,
- sasl_config_name => $amqp_sasl_config_name,
- username => $amqp_username,
- password => $amqp_password,
- }
- } else {
- nova_config { 'DEFAULT/rpc_backend': value => $rpc_backend }
- }
-
- if $use_ssl {
- nova_config {
- 'DEFAULT/enabled_ssl_apis' : value => join($enabled_ssl_apis, ',');
- 'ssl/cert_file' : value => $cert_file;
- 'ssl/key_file' : value => $key_file;
- 'wsgi/ssl_cert_file' : value => $cert_file;
- 'wsgi/ssl_key_file' : value => $key_file;
- }
- if $ca_file {
- nova_config { 'ssl/ca_file' :
- value => $ca_file,
- }
- nova_config { 'wsgi/ssl_ca_file' :
- value => $ca_file,
- }
- } else {
- nova_config { 'ssl/ca_file' :
- ensure => absent,
- }
- }
- } else {
- nova_config {
- 'DEFAULT/enabled_ssl_apis' : ensure => absent;
- 'ssl/cert_file' : ensure => absent;
- 'ssl/key_file' : ensure => absent;
- 'ssl/ca_file' : ensure => absent;
- }
- }
- oslo::messaging::default { 'nova_config':
- transport_url => $default_transport_url,
- rpc_response_timeout => $rpc_response_timeout,
- }
- oslo::messaging::notifications { 'nova_config':
- transport_url => $notification_transport_url,
- driver => $notification_driver,
- topics => $notification_topics,
- }
- nova_config {
- 'cinder/catalog_info': value => $cinder_catalog_info;
- 'os_vif_linux_bridge/use_ipv6': value => $use_ipv6;
- 'DEFAULT/notify_api_faults': value => $notify_api_faults;
-
- 'DEFAULT/state_path': value => $state_path;
- 'DEFAULT/service_down_time': value => $service_down_time;
- 'DEFAULT/rootwrap_config': value => $rootwrap_config;
- 'DEFAULT/report_interval': value => $report_interval;
- 'DEFAULT/block_device_allocate_retries': value => $block_device_allocate_retries;
- 'DEFAULT/block_device_allocate_retries_interval': value => $block_device_allocate_retries_interval;
- }
- oslo::concurrency { 'nova_config': lock_path => $lock_path }
- if $notify_on_state_change and $notify_on_state_change in ['vm_state', 'vm_and_task_state'] {
- nova_config {
- 'DEFAULT/notify_on_state_change': value => $notify_on_state_change;
- }
- } else {
- nova_config { 'DEFAULT/notify_on_state_change': ensure => absent; }
- }
- nova_config {
- 'cinder/os_region_name': value => $os_region_name;
- 'upgrade_levels/cells': value => $upgrade_level_cells;
- 'upgrade_levels/cert': value => $upgrade_level_cert;
- 'upgrade_levels/compute': value => $upgrade_level_compute;
- 'upgrade_levels/conductor': value => $upgrade_level_conductor;
- 'upgrade_levels/console': value => $upgrade_level_console;
- 'upgrade_levels/consoleauth': value => $upgrade_level_consoleauth;
- 'upgrade_levels/intercell': value => $upgrade_level_intercell;
- 'upgrade_levels/network': value => $upgrade_level_network;
- 'upgrade_levels/scheduler': value => $upgrade_level_scheduler;
- }
- }
|