diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f744094 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.tox +.build +*.pyc +docs/build +fuel-plugin-dbaas-trove-*.rpm +repositories/ubuntu/*.deb diff --git a/components.yaml b/components.yaml new file mode 100644 index 0000000..f7ed663 --- /dev/null +++ b/components.yaml @@ -0,0 +1,8 @@ +- name: additional_service:fuel-plugin-dbaas-trove + compatible: [] + requires: [] + incompatible: [] + label: "Install Trove" + description: | + Trove provides scalable and reliable cloud Database as a Service provisioning + functionality for both relational and non-relational database engines. diff --git a/deployment_scripts/puppet/manifests/cluster.pp b/deployment_scripts/puppet/manifests/cluster.pp deleted file mode 100644 index a8491a0..0000000 --- a/deployment_scripts/puppet/manifests/cluster.pp +++ /dev/null @@ -1,50 +0,0 @@ -notice('MODULAR: trove/cluster.pp') - -if !(hiera('role') in ['trove']) { - fail('The node role is not in trove roles') -} - -$network_scheme = hiera_hash('network_scheme', {}) -$network_metadata = hiera_hash('network_metadata', {}) - -prepare_network_config($network_scheme) - -$trove_node = get_nodes_hash_by_roles($network_metadata, ['trove']) - -$corosync_nodes = corosync_nodes($trove_node, 'trove/api') - -$network_ip = get_network_role_property('trove/api', 'ipaddr') - -class { 'cluster': - internal_address => $network_ip, - corosync_nodes => $corosync_nodes, -} - -pcmk_nodes { 'pacemaker' : - nodes => $corosync_nodes, - add_pacemaker_nodes => false, -} - -Service <| title == 'corosync' |> { - subscribe => File['/etc/corosync/service.d'], - require => File['/etc/corosync/corosync.conf'], -} - -Service['corosync'] -> Pcmk_nodes<||> -Pcmk_nodes<||> -> Service<| provider == 'pacemaker' |> - -# Sometimes during first start pacemaker can not connect to corosync -# via IPC due to pacemaker and corosync processes are run under different users -if($::operatingsystem == 'Ubuntu') { - $pacemaker_run_uid = 'hacluster' - $pacemaker_run_gid = 'haclient' - - file {'/etc/corosync/uidgid.d/pacemaker': - content =>"uidgid { - uid: ${pacemaker_run_uid} - gid: ${pacemaker_run_gid} -}" - } - - File['/etc/corosync/corosync.conf'] -> File['/etc/corosync/uidgid.d/pacemaker'] -> Service <| title == 'corosync' |> -} \ No newline at end of file diff --git a/deployment_scripts/puppet/manifests/db.pp b/deployment_scripts/puppet/manifests/db.pp deleted file mode 100644 index 8bb2be9..0000000 --- a/deployment_scripts/puppet/manifests/db.pp +++ /dev/null @@ -1,53 +0,0 @@ -notice('MODULAR: trove/db.pp') - -$node_name = hiera('node_name') -$trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {}) -$trove_enabled = pick($trove_hash['metadata']['enabled'], false) -$mysql_hash = hiera_hash('mysql_hash', {}) -$management_vip = hiera('management_vip', undef) -$database_vip = hiera('database_vip') - -$mysql_root_user = pick($mysql_hash['root_user'], 'root') -$mysql_db_create = pick($mysql_hash['db_create'], true) -$mysql_root_password = $mysql_hash['root_password'] - -$db_user = pick($trove_hash['metadata']['db_user'], 'trove') -$db_name = pick($trove_hash['metadata']['db_name'], 'trove') -$db_password = pick($trove_hash['metadata']['db_password'], $mysql_root_password) - -$db_host = pick($trove_hash['metadata']['db_host'], $database_vip, 'localhost') -$db_create = pick($trove_hash['metadata']['db_create'], $mysql_db_create) -$db_root_user = pick($trove_hash['metadata']['root_user'], $mysql_root_user) -$db_root_password = pick($trove_hash['metadata']['root_password'], $mysql_root_password) - -$allowed_hosts = [ $node_name, 'localhost', '127.0.0.1', '%' ] - -if $trove_enabled and $db_create { - - class { 'galera::client': - custom_setup_class => hiera('mysql_custom_setup_class', 'galera'), - } - - class { 'trove::db::mysql': - user => $db_user, - password => $db_password, - dbname => $db_name, - allowed_hosts => $allowed_hosts, - } - - class { 'osnailyfacter::mysql_access': - db_host => $db_host, - db_user => $db_root_user, - db_password => $db_root_password, - } - - Class['galera::client'] -> - Class['osnailyfacter::mysql_access'] -> - Class['trove::db::mysql'] - -} - -class mysql::config {} -include mysql::config -class mysql::server {} -include mysql::server \ No newline at end of file diff --git a/deployment_scripts/puppet/manifests/haproxy.pp b/deployment_scripts/puppet/manifests/haproxy.pp deleted file mode 100644 index 13e4d21..0000000 --- a/deployment_scripts/puppet/manifests/haproxy.pp +++ /dev/null @@ -1,48 +0,0 @@ -notice('MODULAR: trove/haproxy.pp') - -$network_metadata = hiera_hash('network_metadata') -$trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {}) -# enabled by default -$use_trove = pick($trove_hash['metadata']['enabled'], true) -$public_ssl_hash = hiera('public_ssl') - -$troves_address_map = get_node_to_ipaddr_map_by_network_role(get_nodes_hash_by_roles($network_metadata, ['trove']), 'trove/api') - -if ($use_trove) { - $server_names = hiera_array('trove_names', keys($troves_address_map)) - $ipaddresses = hiera_array('trove_ipaddresses', values($troves_address_map)) - $public_virtual_ip = hiera('public_vip') - $internal_virtual_ip = hiera('management_vip') - - # configure trove ha proxy - Openstack::Ha::Haproxy_service { - internal_virtual_ip => $internal_virtual_ip, - ipaddresses => $ipaddresses, - public_virtual_ip => $public_virtual_ip, - server_names => $server_names, - public_ssl => $public_ssl_hash['services'], - } - - openstack::ha::haproxy_service { 'trove-api': - order => '210', - listen_port => 8779, - internal => true, - public => true, - } - - openstack::ha::haproxy_service { 'trove-rabbitmq': - order => '211', - listen_port => 55671, - define_backups => true, - internal => true, - public => true, - haproxy_config_options => { - 'option' => ['tcpka'], - 'timeout client' => '48h', - 'timeout server' => '48h', - 'balance' => 'roundrobin', - 'mode' => 'tcp' - }, - balancermember_options => 'check inter 5000 rise 2 fall 3', - } -} diff --git a/deployment_scripts/puppet/manifests/keystone.pp b/deployment_scripts/puppet/manifests/keystone.pp deleted file mode 100644 index d8cbc3b..0000000 --- a/deployment_scripts/puppet/manifests/keystone.pp +++ /dev/null @@ -1,44 +0,0 @@ -notice('MODULAR: trove/keystone.pp') - -$trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {}) -$public_ssl_hash = hiera('public_ssl') -$public_vip = hiera('public_vip') -$public_address = $public_ssl_hash['services'] ? { - true => $public_ssl_hash['hostname'], - default => $public_vip, -} -$public_protocol = $public_ssl_hash['services'] ? { - true => 'https', - default => 'http', -} -$admin_protocol = 'http' -$admin_address = hiera('management_vip') -$region = pick($trove_hash['metadata']['region'], hiera('region', 'RegionOne')) - -$password = pick($trove_hash['metadata']['user_password'], 'password') -$auth_name = pick($trove_hash['metadata']['auth_name'], 'trove') -$configure_endpoint = pick($trove_hash['metadata']['configure_endpoint'], true) -$configure_user = pick($trove_hash['metadata']['configure_user'], true) -$configure_user_role = pick($trove_hash['metadata']['configure_user_role'], true) -$service_name = pick($trove_hash['metadata']['service_name'], 'trove') -$tenant = pick($trove_hash['metadata']['tenant'], 'services') - -$port = '8779' - -$public_url = "${public_protocol}://${public_address}:${port}/v1.0/%(tenant_id)s" -$admin_url = "${admin_protocol}://${admin_address}:${port}/v1.0/%(tenant_id)s" - -validate_string($public_address) -validate_string($password) - -class { 'trove::keystone::auth': - password => $password, - auth_name => $auth_name, - configure_endpoint => $configure_endpoint, - service_name => $service_name, - public_url => $public_url, - internal_url => $admin_url, - admin_url => $admin_url, - region => $region, - tenant => $tenant, -} diff --git a/deployment_scripts/puppet/manifests/rabbitmq.pp b/deployment_scripts/puppet/manifests/rabbitmq.pp deleted file mode 100644 index ae49aaa..0000000 --- a/deployment_scripts/puppet/manifests/rabbitmq.pp +++ /dev/null @@ -1,147 +0,0 @@ -notice('MODULAR: trove/rabbitmq.pp') - -$network_scheme = hiera_hash('network_scheme', {}) -prepare_network_config($network_scheme) - -$queue_provider = hiera('queue_provider', 'rabbitmq') - -if $queue_provider == 'rabbitmq' { - $trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {}) - $erlang_cookie = hiera('erlang_cookie', 'EOKOWXQREETZSHFNTPEY') - $version = hiera('rabbit_version', '3.3.5') - $debug = hiera('debug', false) - $deployment_mode = hiera('deployment_mode', 'ha_compact') - $amqp_port = pick($trove_hash['rabbit_port'], '55671') - $rabbit_hash = hiera_hash('rabbit_hash', {}) - $enabled = pick($rabbit_hash['enabled'], true) - $use_pacemaker = pick($rabbit_hash['pacemaker'], true) - - case $::osfamily { - 'RedHat': { - $command_timeout = "'-s KILL'" - $package_provider = 'yum' - } - 'Debian': { - $command_timeout = "'--signal=KILL'" - $package_provider = 'apt' - } - default: { - fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem},\ - module ${module_name} only support osfamily RedHat and Debian") - } - } - - if ($debug) { - # FIXME(aschultz): debug wasn't introduced until v3.5.0, when we upgrade - # we should change info to debug. Also don't forget to fix tests! - $rabbit_levels = '[{connection,info}]' - } else { - $rabbit_levels = '[{connection,info}]' - } - - $cluster_partition_handling = hiera('rabbit_cluster_partition_handling', 'autoheal') - $mnesia_table_loading_timeout = hiera('mnesia_table_loading_timeout', '10000') - $rabbitmq_bind_ip_address = pick(get_network_role_property('trove/api', 'ipaddr'), 'UNSET') - - # NOTE(bogdando) not a hash. Keep an indentation as is - $rabbit_tcp_listen_options = hiera('rabbit_tcp_listen_options', - '[ - binary, - {packet, raw}, - {reuseaddr, true}, - {backlog, 128}, - {nodelay, true}, - {exit_on_close, false}, - {keepalive, true} - ]' - ) - $config_kernel_variables = hiera('rabbit_config_kernel_variables', - { - 'inet_dist_listen_min' => '41055', - 'inet_dist_listen_max' => '41055', - 'inet_default_connect_options' => '[{nodelay,true}]', - 'net_ticktime' => '10', - } - ) - $config_variables = hiera('rabbit_config_variables', - { - 'log_levels' => $rabbit_levels, - 'default_vhost' => "<<\"/\">>", - 'default_permissions' => '[<<".*">>, <<".*">>, <<".*">>]', - 'tcp_listen_options' => $rabbit_tcp_listen_options, - 'cluster_partition_handling' => $cluster_partition_handling, - 'mnesia_table_loading_timeout' => $mnesia_table_loading_timeout, - } - ) - - $thread_pool_calc = min(100,max(12*$physicalprocessorcount,30)) - - if $deployment_mode == 'ha_compact' { - $rabbit_pid_file = '/var/run/rabbitmq/p_pid' - } else { - $rabbit_pid_file = '/var/run/rabbitmq/pid' - } - $environment_variables = hiera('rabbit_environment_variables', - { - 'SERVER_ERL_ARGS' => "\"+K true +A${thread_pool_calc} +P 1048576\"", - 'PID_FILE' => $rabbit_pid_file, - } - ) - - if ($enabled) { - class { '::rabbitmq': - admin_enable => true, - repos_ensure => false, - package_provider => $package_provider, - package_source => undef, - service_ensure => 'running', - service_manage => true, - port => $amqp_port, - delete_guest_user => true, - default_user => 'trove', - default_pass => $trove_hash['metadata']['rabbit_password'], - # NOTE(bogdando) set to true and uncomment the lines below, if puppet should create a cluster - # We don't want it as far as OCF script creates the cluster - config_cluster => false, - #erlang_cookie => $erlang_cookie, - #wipe_db_on_cookie_change => true, - #cluster_nodes => $rabbitmq_cluster_nodes, - #cluster_node_type => 'disc', - #cluster_partition_handling => $cluster_partition_handling, - version => $version, - node_ip_address => $rabbitmq_bind_ip_address, - config_kernel_variables => $config_kernel_variables, - config_variables => $config_variables, - environment_variables => $environment_variables, - } - - if ($use_pacemaker) { - # Install rabbit-fence daemon - class { 'cluster::rabbitmq_fence': - enabled => $enabled, - require => Class['::rabbitmq'] - } - } - - class { 'trove::rabbitmq': - enabled => $enabled, - # Do not install rabbitmq from trove classes - rabbitmq_class => false, - userid => $trove_hash['metadata']['rabbit_user'], - password => $trove_hash['metadata']['rabbit_password'], - require => Class['::rabbitmq'], - } - - if ($use_pacemaker) { - class { 'pacemaker_wrappers::rabbitmq': - command_timeout => $command_timeout, - debug => $debug, - erlang_cookie => $erlang_cookie, - admin_user => $trove_hash['metadata']['rabbit_user'], - admin_pass => $trove_hash['metadata']['rabbit_password'], - before => Class['trove::rabbitmq'], - } - } - } - -} \ No newline at end of file diff --git a/deployment_scripts/puppet/manifests/trove.pp b/deployment_scripts/puppet/manifests/trove.pp deleted file mode 100644 index 352b67d..0000000 --- a/deployment_scripts/puppet/manifests/trove.pp +++ /dev/null @@ -1,92 +0,0 @@ -notice('MODULAR: trove/trove.pp') - -prepare_network_config(hiera('network_scheme', {})) - -$trove_hash = hiera_hash('fuel-plugin-dbaas-trove', {}) -$nova_hash = hiera_hash('nova_hash', {}) -$neutron_config = hiera_hash('neutron_config', {}) -$node_role = hiera('node_role') -$public_ip = hiera('public_vip') -$database_ip = hiera('database_vip') -$management_ip = hiera('management_vip') -$region = hiera('region', 'RegionOne') -$service_endpoint = hiera('service_endpoint') -$debug = hiera('debug', false) -$verbose = hiera('verbose', true) -$use_syslog = hiera('use_syslog', true) -$use_stderr = hiera('use_stderr', false) -$rabbit_ha_queues = hiera('rabbit_ha_queues') -$amqp_port = hiera('amqp_port') -$amqp_hosts = hiera('amqp_hosts') -$public_ssl = hiera_hash('public_ssl', {}) - -################################################################# - -if $trove_hash['metadata']['enabled'] { - $public_protocol = pick($public_ssl['services'], false) ? { - true => 'https', - default => 'http', - } - - $public_address = pick($public_ssl['services'], false) ? { - true => pick($public_ssl['hostname']), - default => $public_ip, - } - - $firewall_rule = '210 trove-api' - - $api_bind_port = '8779' - $api_bind_host = get_network_role_property('trove/api', 'ipaddr') - - $trove_user = pick($trove_hash['metadata']['user'], 'trove') - $tenant = pick($trove_hash['metadata']['tenant'], 'services') - $internal_url = "http://${api_bind_host}:${api_bind_port}" - $db_user = pick($trove_hash['metadata']['db_user'], 'trove') - $db_name = pick($trove_hash['metadata']['db_name'], 'trove') - $db_password = pick($trove_hash['metadata']['db_password'], 's3cr3t') - $db_host = pick($trove_hash['metadata']['db_host'], $database_ip) - $read_timeout = '60' - $sql_connection = "mysql://${db_user}:${db_password}@${db_host}/${db_name}?read_timeout=${read_timeout}" - - - class { '::trove::client': } - - class { '::trove': - database_connection => $sql_connection, - rabbit_host => $management_ip, - rabbit_password => $trove_hash['metadata']['rabbit_password'], - rabbit_port => '55671', - rabbit_userid => $trove_hash['metadata']['rabbit_user'], - rabbit_use_ssl => false, - nova_proxy_admin_pass => $nova_hash['user_password'], - nova_proxy_admin_user => 'nova', - nova_proxy_admin_tenant_name => pick($nova_hash['tenant_name'], 'services'), - } - - class { '::trove::api': - debug => true, - verbose => true, - bind_host => $api_bind_host, - auth_url => "http://${service_endpoint}:5000/v2.0/", - keystone_password => $trove_hash['metadata']['user_password'], - } - - class { '::trove::conductor': - debug => true, - verbose => true, - auth_url => "http://${service_endpoint}:5000/v2.0/", - } - - class { '::trove::taskmanager': - debug => true, - verbose => true, - auth_url => "http://${service_endpoint}:5000/v2.0/", - } - - firewall { $firewall_rule : - dport => $api_bind_port, - proto => 'tcp', - action => 'accept', - } - -} diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/db.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/db.pp new file mode 100644 index 0000000..274eb6c --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/db.pp @@ -0,0 +1,71 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::db + +class dbaas_trove::db { + + notice('MODULAR: dbaas_trove/db') + + $trove = hiera_hash('fuel-plugin-dbaas-trove', undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + + if ($trove_enabled) { + + $mysql_hash = hiera_hash('mysql', {}) + $management_vip = hiera('management_vip', undef) + $database_vip = hiera('database_vip', undef) + + $mysql_root_user = pick($mysql_hash['root_user'], 'root') + $mysql_db_create = pick($mysql_hash['db_create'], true) + $mysql_root_password = $mysql_hash['root_password'] + + $db_user = pick($trove['db_user'], 'trove') + $db_name = pick($trove['db_name'], 'trove') + $db_password = $trove['db_password'] + + $db_host = pick($trove['metadata']['db_host'], $database_vip) + $db_create = pick($trove['metadata']['db_create'], $mysql_db_create) + $db_root_user = pick($trove['metadata']['root_user'], $mysql_root_user) + $db_root_password = pick($trove['metadata']['root_password'], $mysql_root_password) + + $allowed_hosts = [ 'localhost', '127.0.0.1', '%' ] + + if $db_create { + + class { '::galera::client': + custom_setup_class => hiera('mysql_custom_setup_class', 'galera'), + } + + class { '::trove::db::mysql': + user => $db_user, + password => $db_password, + dbname => $db_name, + allowed_hosts => $allowed_hosts, + } + + class { '::osnailyfacter::mysql_access': + db_host => $db_host, + db_user => $db_root_user, + db_password => $db_root_password, + } + + Class['::galera::client'] -> + Class['::osnailyfacter::mysql_access'] -> + Class['::trove::db::mysql'] + } + } +} + diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/firewall.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/firewall.pp new file mode 100644 index 0000000..dd37371 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/firewall.pp @@ -0,0 +1,107 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::firewall + +class dbaas_trove::firewall { + + notice('MODULAR: dbaas_trove/firewall.pp') + + $trove = hiera_hash('fuel-plugin-dbaas-trove', undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + + if ($trove_enabled) { + + $network_scheme = hiera_hash('network_scheme') + $trove_amqp_port = hiera('amqp_port') + $trove_api_port = hiera('trove_api_port') + + $corosync_input_port = 5404 + $corosync_output_port = 5405 + $erlang_epmd_port = 4369 + $erlang_inet_dist_port = 41055 + $erlang_rabbitmq_backend_port = $trove_amqp_port + $erlang_rabbitmq_port = $trove_amqp_port + $pcsd_port = 2224 + + $trove_networks = get_routable_networks_for_network_role($network_scheme, 'trove/api') + $corosync_networks = $trove_networks + + openstack::firewall::multi_net {'210 trove-api': + port => $trove_api_port, + proto => 'tcp', + action => 'accept', + source_nets => $trove_networks, + } + + + openstack::firewall::multi_net {'106 rabbitmq': + port => [$erlang_epmd_port, $erlang_rabbitmq_port, $erlang_rabbitmq_backend_port, $erlang_inet_dist_port], + proto => 'tcp', + action => 'accept', + source_nets => $trove_networks, + } + + # Workaround for fuel bug with firewall + firewall {'003 remote rabbitmq ': + sport => [$erlang_epmd_port, $erlang_rabbitmq_port, $erlang_rabbitmq_backend_port, $erlang_inet_dist_port, 55672, 61613], + source => hiera('master_ip'), + proto => 'tcp', + action => 'accept', + } + + # allow local rabbitmq admin traffic for LP#1383258 + firewall {'005 local rabbitmq admin': + sport => [ 15672 ], + iniface => 'lo', + proto => 'tcp', + action => 'accept', + } + + # reject all non-local rabbitmq admin traffic for LP#1450443 + firewall {'006 reject non-local rabbitmq admin': + sport => [ 15672 ], + proto => 'tcp', + action => 'drop', + } + + # allow connections from haproxy namespace + firewall {'030 allow connections from haproxy namespace': + source => '240.0.0.2', + action => 'accept', + } + + openstack::firewall::multi_net {'113 corosync-input': + port => $corosync_input_port, + proto => 'udp', + action => 'accept', + source_nets => $corosync_networks, + } + + openstack::firewall::multi_net {'114 corosync-output': + port => $corosync_output_port, + proto => 'udp', + action => 'accept', + source_nets => $corosync_networks, + } + + openstack::firewall::multi_net {'115 pcsd-server': + port => $pcsd_port, + proto => 'tcp', + action => 'accept', + source_nets => $corosync_networks, + } + } +} diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/hiera_override.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/hiera_override.pp new file mode 100644 index 0000000..d4f1ade --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/hiera_override.pp @@ -0,0 +1,103 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::hiera_override + +class dbaas_trove::hiera_override { + + notice('MODULAR: dbaas_trove/hiera_override.pp') + + $plugin_name = 'fuel-plugin-dbaas-trove' + $trove = hiera_hash($plugin_name, undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + $hiera_dir = '/etc/hiera/override' + if ($trove_enabled) { + + $plugin_yaml = "${plugin_name}.yaml" + $network_metadata = hiera_hash('network_metadata') + + if empty($network_metadata) { + fail('Network_metadata not given in the astute.yaml') + } + + $trove_roles = [ 'primary-trove', 'trove' ] + $trove_nodes = get_nodes_hash_by_roles($network_metadata, $trove_roles) + + $trove_address_map = get_node_to_ipaddr_map_by_network_role( + $trove_nodes, + 'trove/api' + ) + + $trove_nodes_ips = values($trove_address_map) + $trove_nodes_names = keys($trove_address_map) + + $corosync_roles = $trove_roles + $corosync_nodes = $trove_nodes + + $amqp_port = hiera('amqp_port', '5673') + $trove_amqp_port = hiera($trove['rabbit_port'], '55671') + $rabbit_username = $trove['rabbit_user'] + $rabbit_password = $trove['rabbit_password'] + $trove_api_port = hiera($trove['trove_api_port'], 8779) + $trove_amqp_hosts = inline_template("<%= @trove_nodes_ips.map {|x| x + ':' + @trove_amqp_port}.join ',' %>") + } + $calculated_content = inline_template('<% +require "yaml" +data = { + "trove_amqp_hosts" => @trove_amqp_hosts, + "amqp_port" => @trove_amqp_port , + "infra_amqp_port" => @amqp_port, + "trove_api_port" => @trove_api_port, + "rabbit_hash" => { + "user" => @rabbit_username , + "password" => @rabbit_password , + } , +} +#data["trove_nodes"] = @trove_nodes if @trove_nodes +data["corosync_nodes"] = @corosync_nodes if @corosync_nodes +data["corosync_roles"] = @corosync_roles if @corosync_roles +-%> + +<%= YAML.dump(data) %>') + + file { $hiera_dir : + ensure => 'directory', + path => $hiera_dir, + } -> + file { "${hiera_dir}/${plugin_yaml}" : + ensure => 'present', + content => $calculated_content, + } + package {'ruby-deep-merge': + ensure => 'installed', + } + + # hiera file changes between 7.0 and 8.0 so we need to handle the override the + # different yaml formats via these exec hacks. It should be noted that the + # fuel hiera task will wipe out these this update to the hiera.yaml + exec { "${plugin_name}_hiera_override_7.0": + command => "sed -i '/ - override\\/plugins/a\\ - override\\/${plugin_name}' /etc/hiera.yaml", + path => '/bin:/usr/bin', + unless => "grep -q '^ - override/${plugin_name}' /etc/hiera.yaml", + onlyif => 'grep -q "^ - override/plugins" /etc/hiera.yaml' + } + + exec { "${plugin_name}_hiera_override_8.0": + command => "sed -i '/ - override\\/plugins/a\\ - override\\/${plugin_name}' /etc/hiera.yaml", + path => '/bin:/usr/bin', + unless => "grep -q '^ - override/${plugin_name}' /etc/hiera.yaml", + onlyif => 'grep -q "^ - override/plugins" /etc/hiera.yaml' + } +} diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/keystone.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/keystone.pp new file mode 100644 index 0000000..827a0cf --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/keystone.pp @@ -0,0 +1,74 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::keystone +class dbaas_trove::keystone { + + notice('MODULAR: dbaas_trove/keystone') + + $trove = hiera_hash('fuel-plugin-dbaas-trove', undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + + if ($trove_enabled) { + + $management_vip = hiera('management_vip') + $public_ssl_hash = hiera_hash('public_ssl', {}) + $ssl_hash = hiera_hash('use_ssl', {}) + $public_vip = hiera('public_vip') + + $public_protocol = get_ssl_property($ssl_hash, $public_ssl_hash, 'trove', 'public', 'protocol', 'http') + $public_address = get_ssl_property($ssl_hash, $public_ssl_hash, 'trove', 'public', 'hostname', [$public_vip]) + + $internal_protocol = get_ssl_property($ssl_hash, {}, 'trove', 'internal', 'protocol', 'http') + $internal_address = get_ssl_property($ssl_hash, {}, 'trove', 'internal', 'hostname', [$management_vip]) + + $admin_protocol = get_ssl_property($ssl_hash, {}, 'trove', 'admin', 'protocol', 'http') + $admin_address = get_ssl_property($ssl_hash, {}, 'trove', 'admin', 'hostname', [$management_vip]) + + $region = pick($trove['region'], hiera('region', 'RegionOne')) + $password = $trove['auth_password'] + $auth_name = pick($trove['auth_name'], 'trove') + $configure_endpoint = pick($trove['configure_endpoint'], true) + $service_name = pick($trove['service_name'], 'trove') + $tenant = pick($trove['tenant'], 'services') + + validate_string($public_address) + validate_string($password) + + $bind_port = '8779' + + $public_url = "${public_protocol}://${public_address}:${bind_port}/v1.0/%(tenant_id)s" + $internal_url = "${internal_protocol}://${internal_address}:${bind_port}/v1.0/%(tenant_id)s" + $admin_url = "${admin_protocol}://${admin_address}:${bind_port}/v1.0/%(tenant_id)s" + + Class['::osnailyfacter::wait_for_keystone_backends'] -> Class['::trove::keystone::auth'] + + class {'::osnailyfacter::wait_for_keystone_backends': } + + class { '::trove::keystone::auth': + configure_endpoint => $configure_endpoint, + service_name => $service_name, + region => $region, + auth_name => $auth_name, + password => $password, + email => "${auth_name}@localhost", + tenant => $tenant, + public_url => $public_url, + internal_url => $internal_url, + admin_url => $admin_url, + } + } +} + diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/openstack_haproxy_trove.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/openstack_haproxy_trove.pp new file mode 100644 index 0000000..3027af7 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/openstack_haproxy_trove.pp @@ -0,0 +1,103 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::openstack_haproxy_trove + +class dbaas_trove::openstack_haproxy_trove { + + notice('MODULAR: dbaas_trove/openstack_haproxy_trove.pp') + + $trove = hiera_hash('fuel-plugin-dbaas-trove', undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + + if ($trove_enabled) { + + $network_metadata = hiera_hash('network_metadata', {}) + + $public_ssl_hash = hiera_hash('public_ssl', {}) + $ssl_hash = hiera_hash('use_ssl', {}) + + $public_ssl = get_ssl_property($ssl_hash, $public_ssl_hash, 'trove', 'public', 'usage', false) + $public_ssl_path = get_ssl_property($ssl_hash, $public_ssl_hash, 'trove', 'public', 'path', ['']) + + $internal_ssl = get_ssl_property($ssl_hash, {}, 'trove', 'internal', 'usage', false) + $internal_ssl_path = get_ssl_property($ssl_hash, {}, 'trove', 'internal', 'path', ['']) + + $external_lb = hiera('external_lb', false) + $trove_nodes = get_nodes_hash_by_roles($network_metadata, ['primary-trove', 'trove']) + + $trove_amqp_use_ssl = pick($trove['metadata']['rabbit_use_ssl'], true) + $trove_amqp_port = hiera($trove['rabbit_port'], '55671') + $trove_api_port = hiera($trove['metadata']['trove_api_port'], 8779) + + if (!$external_lb) { + + $trove_address_map = get_node_to_ipaddr_map_by_network_role($trove_nodes, 'trove/api') + $server_names = hiera_array('trove_names', keys($trove_address_map)) + $ipaddresses = hiera_array('trove_ipaddresses', values($trove_address_map)) + $public_virtual_ip = hiera('public_vip') + $internal_virtual_ip = hiera('management_vip') + + # configure trove ha proxy + Openstack::Ha::Haproxy_service { + internal_virtual_ip => $internal_virtual_ip, + ipaddresses => $ipaddresses, + public_virtual_ip => $public_virtual_ip, + server_names => $server_names, + public => true, + internal_ssl => $internal_ssl, + internal_ssl_path => $internal_ssl_path, + } + + openstack::ha::haproxy_service { 'trove-api': + order => '206', + listen_port => $trove_api_port, + public_ssl => $public_ssl, + public_ssl_path => $public_ssl_path, + #require_service => 'trove-api', + haproxy_config_options => { + option => ['httpchk', 'httplog', 'httpclose'], + 'timeout server' => '660s', + 'http-request' => 'set-header X-Forwarded-Proto https if { ssl_fc }', + }, + balancermember_options => 'check inter 10s fastinter 2s downinter 3s rise 3 fall 3', + } + + if($public_ssl and $trove_amqp_use_ssl) { + $rabbit_public_ssl = true + } else { + $rabbit_public_ssl = false + } + + openstack::ha::haproxy_service { 'trove-rabbitmq': + order => '205', + listen_port => $trove_amqp_port, + public_ssl => $rabbit_public_ssl, + public_ssl_path => $public_ssl_path, + internal => false, + define_backups => true, + haproxy_config_options => { + 'option' => ['tcpka'], + 'timeout client' => '48h', + 'timeout server' => '48h', + 'balance' => 'roundrobin', + 'mode' => 'tcp', + }, + balancermember_options => 'check inter 5000 rise 2 fall 3', + } + } + } +} + diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_add_trust_chain.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_add_trust_chain.pp new file mode 100644 index 0000000..4688478 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_add_trust_chain.pp @@ -0,0 +1,103 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::ssl_add_trust_chain + +class dbaas_trove::ssl_add_trust_chain { + + notice('MODULAR: dbaas_trove/ssl_add_trust_chain.pp') + + $trove = hiera_hash('fuel-plugin-dbaas-trove', undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + + Exec { + path => '/bin:/usr/bin:/sbin:/usr/sbin', + } + + File { + ensure => file, + } + + define file_link { + $service = $name + if !empty(file("/etc/pki/tls/certs/public_${service}.pem",'/dev/null')) { + file { "/usr/local/share/ca-certificates/${service}_public_haproxy.crt": + source => "/etc/pki/tls/certs/public_${service}.pem", + } + } + + if !empty(file("/etc/pki/tls/certs/internal_${service}.pem",'/dev/null')) { + file { "/usr/local/share/ca-certificates/${service}_internal_haproxy.crt": + source => "/etc/pki/tls/certs/internal_${service}.pem", + } + } + + if !empty(file("/etc/pki/tls/certs/admin_${service}.pem",'/dev/null')) { + file { "/usr/local/share/ca-certificates/${service}_admin_haproxy.crt": + source => "/etc/pki/tls/certs/admin_${service}.pem", + } + } + } + + if !empty($ssl_hash and $trove_enabled) { + $custome_services = [ 'trove' ] + + file_link { $custome_services: } + + } elsif !empty($custome_services and $trove_enabled) { + case $::osfamily { + 'RedHat': { + file { '/etc/pki/ca-trust/source/anchors/public_haproxy.pem': + source => '/etc/pki/tls/certs/public_haproxy.pem', + } + } + + 'Debian': { + file { '/usr/local/share/ca-certificates/public_haproxy.crt': + source => '/etc/pki/tls/certs/public_haproxy.pem', + } + } + + default: { + fail("Unsupported OS: ${::osfamily}/${::operatingsystem}") + } + } + } + + case $::osfamily { + 'RedHat': { + exec { 'enable_trust': + command => 'update-ca-trust force-enable', + refreshonly => true, + notify => Exec['add_trust'] + } + + File <||> ~> Exec['enable_trust'] + } + + 'Debian': { + File <||> ~> Exec['add_trust'] + } + + default: { + fail("Unsupported OS: ${::osfamily}/${::operatingsystem}") + } + } + + exec { 'add_trust': + command => 'update-ca-certificates', + refreshonly => true, + } +} diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_dns_setup.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_dns_setup.pp new file mode 100644 index 0000000..d01da91 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_dns_setup.pp @@ -0,0 +1,126 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::ssl_dns_setup + +class dbaas_trove::ssl_dns_setup { + + notice('MODULAR: dbaas_trove/ssl_dns_setup.pp') + + $trove = hiera_hash('fuel-plugin-dbaas-trove', undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + + $public_ssl_hash = hiera_hash('public_ssl') + $ssl_hash = hiera_hash('use_ssl', {}) + $public_vip = hiera('public_vip') + $management_vip = hiera('management_vip') + $openstack_service_endpoints = hiera_hash('openstack_service_endpoints', {}) + + $custom_services = [ 'trove'] + + define hosts ( + $ssl_hash, + ){ + $service = $name + $public_vip = hiera('public_vip') + $management_vip = hiera('management_vip') + + $public_hostname = try_get_value($ssl_hash, "${service}_public_hostname", '') + $internal_hostname = try_get_value($ssl_hash, "${service}_internal_hostname", '') + $admin_hostname = try_get_value($ssl_hash, "${service}_admin_hostname", $internal_hostname) + + $service_public_ip = try_get_value($ssl_hash, "${service}_public_ip", '') + if !empty($service_public_ip) { + $public_ip = $service_public_ip + } else { + $public_ip = $public_vip + } + + $service_internal_ip = try_get_value($ssl_hash, "${service}_internal_ip", '') + if !empty($service_internal_ip) { + $internal_ip = $service_internal_ip + } else { + $internal_ip = $management_vip + } + + $service_admin_ip = try_get_value($ssl_hash, "${service}_admin_ip", '') + if !empty($service_admin_ip) { + $admin_ip = $service_admin_ip + } else { + $admin_ip = $management_vip + } + + # We always need to set public hostname resolution + if !empty($public_hostname) and !defined(Host[$public_hostname]) { + host { $public_hostname: + name => $public_hostname, + ensure => present, + ip => $public_ip, + } + } + + if ($public_hostname == $internal_hostname) and ($public_hostname == $admin_hostname) { + notify{"All ${service} hostnames is equal, just public one inserted to DNS":} + } + elsif $public_hostanme == $internal_hostname { + if !empty($admin_hostname) and !defined(Host[$admin_hostname]) { + host { $admin_hostname: + name => $admin_hostname, + ensure => present, + ip => $admin_ip, + } + } + } + elsif ($public_hostname == $admin_hostname) or ($internal_hostname == $admin_hostname) { + if !empty($internal_hostname) and !defined(Host[$internal_hostname]) { + host { $internal_hostname: + name => $internal_hostname, + ensure => present, + ip => $internal_ip, + } + } + } + else { + if !empty($admin_hostname) and !defined(Host[$admin_hostname]) { + host { $admin_hostname: + name => $admin_hostname, + ensure => present, + ip => $admin_ip, + } + } + if !empty($internal_hostname) and !defined(Host[$internal_hostname]) { + host { $internal_hostname: + name => $internal_hostname, + ensure => present, + ip => $internal_ip, + } + } + } + } + + if($trove_enabled) { + if !empty($ssl_hash) { + hosts { $custom_services: + ssl_hash => $ssl_hash, + } + } elsif !empty($public_ssl_hash) { + host { $public_ssl_hash['hostname']: + ensure => present, + ip => $public_vip, + } + } + } + +} diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_keys_saving.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_keys_saving.pp new file mode 100644 index 0000000..744d976 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/ssl_keys_saving.pp @@ -0,0 +1,98 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::ssl_keys_saving + +class dbaas_trove::ssl_keys_saving { + + notice('MODULAR: dbaas_trove/ssl_keys_saving.pp') + + $trove = hiera_hash('fuel-plugin-dbaas-trove', undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + + $public_ssl_hash = hiera_hash('public_ssl') + $ssl_hash = hiera_hash('use_ssl', {}) + $pub_certificate_content = try_get_value($public_ssl_hash, 'cert_data/content', '') + $base_path = '/etc/pki/tls/certs' + $pki_path = [ '/etc/pki', '/etc/pki/tls' ] + $astute_base_path = '/var/lib/astute/haproxy' + + File { + owner => 'root', + group => 'root', + mode => '0644', + } + + file { [ $pki_path, $base_path, $astute_base_path ]: + ensure => directory, + } + + #TODO(sbog): convert it to '.each' syntax when moving to Puppet 4 + #TODO(anoskov): move it outside class 'osnailyfacter::ssl::ssl_keys_saving' + define cert_file ( + $ssl_hash, + $base_path, + $astute_base_path, + ){ + $service = $name + + $public_service = try_get_value($ssl_hash, "${service}_public", false) + $public_usercert = try_get_value($ssl_hash, "${service}_public_usercert", false) + $public_certdata = try_get_value($ssl_hash, "${service}_public_certdata/content", '') + $internal_service = try_get_value($ssl_hash, "${service}_internal", false) + $internal_usercert = try_get_value($ssl_hash, "${service}_internal_usercert", false) + $internal_certdata = try_get_value($ssl_hash, "${service}_internal_certdata/content", '') + $admin_service = try_get_value($ssl_hash, "${service}_admin", false) + $admin_usercert = try_get_value($ssl_hash, "${service}_admin_usercert", false) + $admin_certdata = try_get_value($ssl_hash, "${service}_admin_certdata/content", '') + + if $ssl_hash["${service}"] { + if $public_service and $public_usercert and !empty($public_certdata) { + file { ["${base_path}/public_${service}.pem", "${astute_base_path}/public_${service}.pem"]: + ensure => present, + content => $public_certdata, + } + } + if $internal_service and $internal_usercert and !empty($internal_certdata) { + file { ["${base_path}/internal_${service}.pem", "${astute_base_path}/internal_${service}.pem"]: + ensure => present, + content => $internal_certdata, + } + } + if $admin_service and $admin_usercert and !empty($admin_certdata) { + file { ["${base_path}/admin_${service}.pem", "${astute_base_path}/admin_${service}.pem"]: + ensure => present, + content => $admin_certdata, + } + } + } + } + + if !empty($ssl_hash and $trove_enabled) { + $custom_services = [ 'trove'] + + cert_file { $custom_services: + ssl_hash => $ssl_hash, + base_path => $base_path, + astute_base_path => $astute_base_path, + } + } elsif !empty($public_ssl_hash and $trove_enabled) { + file { ["${base_path}/public_haproxy.pem", "${astute_base_path}/public_haproxy.pem"]: + ensure => present, + content => $pub_certificate_content, + } + } + +} diff --git a/deployment_scripts/puppet/modules/dbaas_trove/manifests/trove.pp b/deployment_scripts/puppet/modules/dbaas_trove/manifests/trove.pp new file mode 100644 index 0000000..e203558 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/manifests/trove.pp @@ -0,0 +1,177 @@ +# +# Copyright (C) 2016 AT&T Services, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# dbaas_trove::trove + +class dbaas_trove::trove { + + notice('MODULAR: dbaas_trove/trove') + + $trove = hiera_hash('fuel-plugin-dbaas-trove', undef) + $trove_enabled = pick($trove['metadata']['enabled'], false) + + prepare_network_config(hiera('network_scheme', {})) + + if ($trove_enabled) { + + $nova_hash = hiera_hash('nova', {}) + $neutron_config = hiera_hash('neutron_config', {}) + $public_vip = hiera('public_vip') + $database_vip = hiera('database_vip') + $management_vip = hiera('management_vip') + $region = hiera('region', 'RegionOne') + $service_endpoint = hiera('service_endpoint') + $debug = hiera('debug', false) + $verbose = hiera('verbose', true) + $use_syslog = hiera('use_syslog', true) + $use_stderr = hiera('use_stderr', false) + $trove_amqp_port = hiera('amqp_port') + $trove_amqp_hosts = hiera('trove_amqp_hosts') + $public_ssl_hash = hiera_hash('public_ssl', {}) + $ssl_hash = hiera_hash('use_ssl', {}) + $external_dns = hiera_hash('external_dns', {}) + $external_lb = hiera('external_lb', false) + $api_bind_port = hiera('trove_api_port') + + $internal_auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'internal', 'protocol', 'http') + $internal_auth_address = get_ssl_property($ssl_hash, {}, 'keystone', 'internal', 'hostname', [hiera('keystone_endpoint', ''), $service_endpoint, $management_vip]) + $auth_url = "${internal_auth_protocol}://${internal_auth_address}:5000/v2.0/" + + $admin_auth_protocol = get_ssl_property($ssl_hash, {}, 'keystone', 'admin', 'protocol', 'http') + $admin_auth_address = get_ssl_property($ssl_hash, {}, 'keystone', 'admin', 'hostname', [hiera('keystone_endpoint', ''), $service_endpoint, $management_vip]) + $identity_uri = "${admin_auth_protocol}://${admin_auth_address}:35357/" + + $neutron_protocol = get_ssl_property($ssl_hash, {}, 'neutron', 'internal', 'protocol', 'http') + $neutron_address = get_ssl_property($ssl_hash, {}, 'neutron', 'internal', 'hostname', [$service_endpoint, $management_vip]) + $neutron_url = "${neutron_protocol}://${neutron_address}:9696/" + + $cinder_protocol = get_ssl_property($ssl_hash, {}, 'cinder', 'internal', 'protocol', 'http') + $cinder_address = get_ssl_property($ssl_hash, {}, 'cinder', 'internal', 'hostname', [$service_endpoint, $management_vip]) + $cinder_url = "${cinder_protocol}://${cinder_address}:8776/v1" + + $swift_protocol = get_ssl_property($ssl_hash, {}, 'swift', 'internal', 'protocol', 'http') + $swift_address = get_ssl_property($ssl_hash, {}, 'swift', 'internal', 'hostname', [$service_endpoint, $management_vip]) + $swift_url = "${swift_protocol}://${swift_address}:8080/v1/AUTH_" + + $nova_protocol = get_ssl_property($ssl_hash, {}, 'nova', 'internal', 'protocol', 'http') + $nova_address = get_ssl_property($ssl_hash, {}, 'nova', 'internal', 'hostname', [$service_endpoint, $management_vip]) + $nova_url = "${nova_protocol}://${nova_address}:8774/v2" + + $trove_public_ssl = get_ssl_property($ssl_hash, $public_ssl_hash, 'trove', 'public', 'usage', false) + $trove_public_protocol = get_ssl_property($ssl_hash, $public_ssl_hash, 'trove', 'public', 'protocol', 'http') + $trove_public_address = get_ssl_property($ssl_hash, $public_ssl_hash, 'trove', 'public', 'hostname', [$public_vip]) + + $api_bind_host = get_network_role_property('trove/api', 'ipaddr') + $tenant = pick($trove['tenant'], 'services') + $db_user = pick($trove['db_user'], 'trove') + $db_name = pick($trove['db_name'], 'trove') + $db_password = $trove['db_password'] + $read_timeout = '60' + $sql_connection = "mysql://${db_user}:${db_password}@${database_vip}/${db_name}?read_timeout=${read_timeout}" + $sql_idle_timeout = pick($idle_timeout, '3600') + + $rabbit_password = $trove['rabbit_password'] + $rabbit_userid = $trove['rabbit_user'] + $rabbit_use_ssl = pick($trove['metadata']['rabbit_use_ssl'], true) + $amqp_durable_queues = pick($trove['amqp_durable_queues'], true) + $rabbit_ha_queues = pick($trove['rabbit_ha_queues'], true) + $public_rabbit_hosts = "$public_vip:$trove_amqp_port" + + if($trove_public_ssl and $rabbit_use_ssl) { + $guest_rabbit_use_ssl = true + } else { + $guest_rabbit_use_ssl = false + } + + $nova_proxy_admin_pass = $nova_hash['user_password'] + $nova_proxy_admin_user = $nova_hash['auth_name'] + $nova_proxy_admin_tenant_name = pick($nova_hash['tenant_name'], 'services') + + class { '::trove::client': } + + class { '::trove': + database_connection => $sql_connection, + database_idle_timeout => $sql_idle_timeout, + rabbit_hosts => $trove_amqp_hosts, + rabbit_password => $trove['rabbit_password'], + rabbit_userid => $trove['rabbit_user'], + rabbit_ha_queues => $rabbit_ha_queues, + amqp_durable_queues => $amqp_durable_queues, + os_region_name => $region, + nova_compute_url => $nova_url, + cinder_url => $cinder_url, + swift_url => $swift_url, + neutron_url => $neutron_url, + nova_proxy_admin_pass => $nova_hash['user_password'], + nova_proxy_admin_user => $nova_hash['auth_name'], + nova_proxy_admin_tenant_name => pick($nova_hash['tenant_name'], 'services'), + } + + class { '::trove::api': + debug => $debug, + verbose => $verbose, + bind_host => $api_bind_host, + auth_url => $auth_url, + auth_host => $service_endpoint, + keystone_password => $trove['auth_password'], + keystone_user => $trove['auth_name'], + } + + class { '::trove::conductor': + debug => $debug, + verbose => $verbose, + auth_url => $auth_url, + } + + class { '::trove::taskmanager': + debug => $debug, + verbose => $verbose, + auth_url => $auth_url, + use_guestagent_template => false, + } + + class { '::trove::guestagent': + enabled => false, + manage_service => true, + debug => $debug, + verbose => $verbose, + rabbit_hosts => $public_rabbit_hosts, + rabbit_host => $public_vip, + rabbit_port => $trove_amqp_port, + rabbit_use_ssl => $guest_rabbit_use_ssl, + auth_url => false, + swift_url => false, + } + + class { '::trove::quota': } + + class { '::trove::config': + trove_config => { + 'DEFAULT/taskmanager_manager' => { value => 'trove.taskmanager.manager.Manager' }, + 'DEFAULT/update_status_on_fail' => { value => 'True' }, + 'DEFAULT/guest_config' => { value => '/etc/trove/trove-guestagent.conf' }, + 'DEFAULT/injected_config_location' => { value => '/etc/trove' }, + 'DEFAULT/guest_info' => { value => '/etc/guest_info' }, + 'DEFAULT/volume_time_out' => { value => '240' }, + 'DEFAULT/agent_call_high_timeout' => { value => '240' }, + 'DEFAULT/agent_call_low_timeout' => { value => '20' }, + }, + trove_guestagent_config => { + 'mysql/replication_strategy' => { value => 'MysqlGTIDReplication' }, + 'mysql/replication_namespace' => { value => 'trove.guestagent.strategies.replication.mysql_gtid' }, + }, + } + } +} diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/db.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/db.pp new file mode 100644 index 0000000..8eeeb1e --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/db.pp @@ -0,0 +1,9 @@ +include ::dbaas_trove::db + +# mysql::config +class mysql::config {} +include ::mysql::config + +# mysql::server +class mysql::server {} +include ::mysql::server diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/firewall.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/firewall.pp new file mode 100644 index 0000000..a70aa69 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/firewall.pp @@ -0,0 +1 @@ +include ::dbaas_trove::firewall diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/hiera_override.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/hiera_override.pp new file mode 100644 index 0000000..99d7e36 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/hiera_override.pp @@ -0,0 +1 @@ +include ::dbaas_trove::hiera_override diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/keystone.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/keystone.pp new file mode 100644 index 0000000..c906c9f --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/keystone.pp @@ -0,0 +1 @@ +include ::dbaas_trove::keystone diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/openstack-haproxy-trove.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/openstack-haproxy-trove.pp new file mode 100644 index 0000000..c3d3578 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/openstack-haproxy-trove.pp @@ -0,0 +1 @@ +include ::dbaas_trove::openstack_haproxy_trove diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_add_trust_chain.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_add_trust_chain.pp new file mode 100644 index 0000000..1f08afb --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_add_trust_chain.pp @@ -0,0 +1 @@ +include ::dbaas_trove::ssl_add_trust_chain diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_dns_setup.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_dns_setup.pp new file mode 100644 index 0000000..5a518e3 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_dns_setup.pp @@ -0,0 +1 @@ +include ::dbaas_trove::ssl_dns_setup diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_keys_saving.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_keys_saving.pp new file mode 100644 index 0000000..6e7e9a9 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/ssl_keys_saving.pp @@ -0,0 +1 @@ +include ::dbaas_trove::ssl_keys_saving diff --git a/deployment_scripts/puppet/modules/dbaas_trove/modular/trove.pp b/deployment_scripts/puppet/modules/dbaas_trove/modular/trove.pp new file mode 100644 index 0000000..7f32ed5 --- /dev/null +++ b/deployment_scripts/puppet/modules/dbaas_trove/modular/trove.pp @@ -0,0 +1 @@ +include ::dbaas_trove::trove diff --git a/deployment_scripts/puppet/modules/trove/.gitignore b/deployment_scripts/puppet/modules/trove/.gitignore index 28742ea..15c55ef 100644 --- a/deployment_scripts/puppet/modules/trove/.gitignore +++ b/deployment_scripts/puppet/modules/trove/.gitignore @@ -1,8 +1,11 @@ -*.swp -spec/fixtures/modules/* -spec/fixtures/manifests/site.pp +pkg/ Gemfile.lock -.vendor -.bundle/ vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +.idea/ +*.swp +*.iml openstack/ diff --git a/deployment_scripts/puppet/modules/trove/CHANGELOG.md b/deployment_scripts/puppet/modules/trove/CHANGELOG.md index 4767b54..fdbab9b 100644 --- a/deployment_scripts/puppet/modules/trove/CHANGELOG.md +++ b/deployment_scripts/puppet/modules/trove/CHANGELOG.md @@ -1,3 +1,53 @@ +##2016-05-20 - 7.1.0 + +###Summary + +This is a feature and bugfix release in the Liberty series. + +####Features + +- Support of PyMySQL driver for MySQL backend + +####Bugfixes + +- Remove nova_* options from trove-guestagent.conf.erb +- Use swift_url variable in the template instead of the hardcoded url + +####Maintenance + +- Add deprecation warning for Qpid rpc driver + + +##2015-11-25 - 7.0.0 +###Summary + +This is a backwards-compatible major release for OpenStack Liberty. + +####Features +- add tag to package and service resources +- add trove::config class +- reflect provider change in puppet-openstacklib +- introduce trove::quota class +- introduce use_guestagent_template option +- make taskmanager_queue option configurable +- add api ratelimit options +- add region and resource url related options +- add default_neutron_networks in trove::taskmanager +- complete qpid support +- keystone/auth: make service description configurable + +####Bugfixes +- fix rabbit_userid parameter +- fix default value of guestagent_config_file option + +####Maintenance +- initial msync run for all Puppet OpenStack modules +- try to use zuul-cloner to prepare fixtures +- remove class_parameter_defaults puppet-lint check +- acceptance: use common bits from puppet-openstack-integration +- acceptance: enable debug & verbosity for OpenStack logs +- fix rspec 3.x syntax + ##2015-10-10 - 6.1.0 ###Summary diff --git a/deployment_scripts/puppet/modules/trove/Gemfile b/deployment_scripts/puppet/modules/trove/Gemfile index 4c6106e..5981638 100644 --- a/deployment_scripts/puppet/modules/trove/Gemfile +++ b/deployment_scripts/puppet/modules/trove/Gemfile @@ -1,29 +1,16 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" -group :development, :test do - gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-puppet', '~> 2.1.0', :require => false - - gem 'metadata-json-lint' - gem 'puppet-lint-param-docs' - gem 'puppet-lint-absolute_classname-check' - gem 'puppet-lint-absolute_template_path' - gem 'puppet-lint-trailing_newline-check' - - # Puppet 4.x related lint checks - gem 'puppet-lint-unquoted_string-check' - gem 'puppet-lint-leading_zero-check' - gem 'puppet-lint-variable_contains_upcase' - gem 'puppet-lint-numericvariable' - - gem 'beaker-rspec', :require => false - gem 'beaker-puppet_install_helper', :require => false - gem 'json' - gem 'webmock' +group :development, :test, :system_tests do + gem 'puppet-openstack_spec_helper', + :git => 'https://git.openstack.org/openstack/puppet-openstack_spec_helper', + :branch => 'stable/liberty', + :require => false end -group :system_tests do - gem 'r10k', :require => 'false' +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false end if puppetversion = ENV['PUPPET_GEM_VERSION'] diff --git a/deployment_scripts/puppet/modules/trove/README.md b/deployment_scripts/puppet/modules/trove/README.md index 7739a4f..199ce3a 100644 --- a/deployment_scripts/puppet/modules/trove/README.md +++ b/deployment_scripts/puppet/modules/trove/README.md @@ -1,7 +1,7 @@ puppet-trove ============= -6.1.0 - 2015.1 - Kilo +7.1.0 - 2015.2 - Liberty #### Table of Contents @@ -35,6 +35,120 @@ Implementation trove is a combination of Puppet manifest and ruby code to delivery configuration and extra functionality through types and providers. +### Types + +#### trove_config + +The `trove_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/trove/trove.conf` file. + +```puppet +trove_config { 'DEFAULT/verbose' : + value => true, +} +``` + +This will write `verbose=true` in the `[DEFAULT]` section. + +##### name + +Section/setting name to manage from `trove.conf` + +##### value + +The value of the setting to be defined. + +##### secret + +Whether to hide the value from Puppet logs. Defaults to `false`. + +##### ensure_absent_val + +If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `` + +#### trove_conductor_config + +The `trove_conductor_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/trove/trove-conductor.conf` file. + +```puppet +trove_conductor_config { 'DEFAULT/verbose' : + value => true, +} +``` + +This will write `verbose=true` in the `[DEFAULT]` section. + +##### name + +Section/setting name to manage from `trove.conf` + +##### value + +The value of the setting to be defined. + +##### secret + +Whether to hide the value from Puppet logs. Defaults to `false`. + +##### ensure_absent_val + +If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `` + +#### trove_guestagent_config + +The `trove_guestagent_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/trove/trove-guestagent.conf` file. + +```puppet +trove_guestagent_config { 'DEFAULT/verbose' : + value => true, +} +``` + +This will write `verbose=true` in the `[DEFAULT]` section. + +##### name + +Section/setting name to manage from `trove.conf` + +##### value + +The value of the setting to be defined. + +##### secret + +Whether to hide the value from Puppet logs. Defaults to `false`. + +##### ensure_absent_val + +If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `` + +#### trove_taskmanager_config + +The `trove_taskmanager_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/trove/trove-taskmanager.conf` file. + +```puppet +trove_taskmanager_config { 'DEFAULT/verbose' : + value => true, +} +``` + +This will write `verbose=true` in the `[DEFAULT]` section. + +##### name + +Section/setting name to manage from `trove.conf` + +##### value + +The value of the setting to be defined. + +##### secret + +Whether to hide the value from Puppet logs. Defaults to `false`. + +##### ensure_absent_val + +If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `` + Limitations ----------- diff --git a/deployment_scripts/puppet/modules/trove/Rakefile b/deployment_scripts/puppet/modules/trove/Rakefile index c1eecbd..9692ffd 100644 --- a/deployment_scripts/puppet/modules/trove/Rakefile +++ b/deployment_scripts/puppet/modules/trove/Rakefile @@ -1,15 +1,27 @@ require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' +require 'puppet-syntax/tasks/puppet-syntax' require 'json' modname = JSON.parse(open('metadata.json').read)['name'].split('-')[1] -PuppetLint.configuration.fail_on_warnings = true -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_class_parameter_defaults') +PuppetSyntax.exclude_paths ||= [] +PuppetSyntax.exclude_paths << "spec/fixtures/**/*" +PuppetSyntax.exclude_paths << "pkg/**/*" +PuppetSyntax.exclude_paths << "vendor/**/*" -task(:default).clear -task :default => [:spec, :lint] +Rake::Task[:lint].clear +PuppetLint::RakeTask.new :lint do |config| + config.ignore_paths = ["spec/**/*.pp", "vendor/**/*.pp"] + config.fail_on_warnings = true + config.log_format = '%{path}:%{linenumber}:%{KIND}: %{message}' + config.disable_checks = ["80chars", "class_inherits_from_params_class", "only_variable_string"] +end + +desc "Run acceptance tests" +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end Rake::Task[:spec_prep].clear desc 'Create the fixtures directory' @@ -46,7 +58,7 @@ task :spec_prep do zuul_clone_cmd += ['git://git.openstack.org', "#{repo}"] sh(*zuul_clone_cmd) else - sh("git clone https://git.openstack.org/#{repo} -b stable/kilo #{repo}") + sh("git clone https://git.openstack.org/#{repo} -b stable/liberty #{repo}") end script = ['env'] script += ["PUPPETFILE_DIR=#{Dir.pwd}/spec/fixtures/modules"] diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_api_paste_ini/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_api_paste_ini/ini_setting.rb index e63fd1e..236f34f 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_api_paste_ini/ini_setting.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_api_paste_ini/ini_setting.rb @@ -1,27 +1,10 @@ Puppet::Type.type(:trove_api_paste_ini).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) ) do - def section - resource[:name].split('/', 2).first - end - - def setting - resource[:name].split('/', 2).last - end - - def separator - '=' - end - def self.file_path '/etc/trove/api-paste.ini' end - # added for backwards compatibility with older versions of inifile - def file_path - self.class.file_path - end - end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_conductor_config/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_conductor_config/ini_setting.rb index a4a0f88..bcf6aae 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_conductor_config/ini_setting.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_conductor_config/ini_setting.rb @@ -1,27 +1,10 @@ Puppet::Type.type(:trove_conductor_config).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) ) do - def section - resource[:name].split('/', 2).first - end - - def setting - resource[:name].split('/', 2).last - end - - def separator - '=' - end - def self.file_path '/etc/trove/trove-conductor.conf' end - # added for backwards compatibility with older versions of inifile - def file_path - self.class.file_path - end - end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_config/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_config/ini_setting.rb index d71365c..5698071 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_config/ini_setting.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_config/ini_setting.rb @@ -1,27 +1,10 @@ Puppet::Type.type(:trove_config).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) ) do - def section - resource[:name].split('/', 2).first - end - - def setting - resource[:name].split('/', 2).last - end - - def separator - '=' - end - def self.file_path '/etc/trove/trove.conf' end - # added for backwards compatibility with older versions of inifile - def file_path - self.class.file_path - end - end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_guestagent_config/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_guestagent_config/ini_setting.rb index d527f3e..4d81498 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_guestagent_config/ini_setting.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_guestagent_config/ini_setting.rb @@ -1,27 +1,10 @@ Puppet::Type.type(:trove_guestagent_config).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) ) do - def section - resource[:name].split('/', 2).first - end - - def setting - resource[:name].split('/', 2).last - end - - def separator - '=' - end - def self.file_path '/etc/trove/trove-guestagent.conf' end - # added for backwards compatibility with older versions of inifile - def file_path - self.class.file_path - end - end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_taskmanager_config/ini_setting.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_taskmanager_config/ini_setting.rb index 5aa9539..9e6c1d3 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_taskmanager_config/ini_setting.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/provider/trove_taskmanager_config/ini_setting.rb @@ -1,27 +1,10 @@ Puppet::Type.type(:trove_taskmanager_config).provide( :ini_setting, - :parent => Puppet::Type.type(:ini_setting).provider(:ruby) + :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) ) do - def section - resource[:name].split('/', 2).first - end - - def setting - resource[:name].split('/', 2).last - end - - def separator - '=' - end - def self.file_path '/etc/trove/trove-taskmanager.conf' end - # added for backwards compatibility with older versions of inifile - def file_path - self.class.file_path - end - end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_api_paste_ini.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_api_paste_ini.rb index 1ff1a5b..8c40209 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_api_paste_ini.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_api_paste_ini.rb @@ -39,4 +39,13 @@ Puppet::Type.newtype(:trove_api_paste_ini) do defaultto false end + + newparam(:ensure_absent_val) do + desc 'A value that is specified as the value property will behave as if ensure => absent was specified' + defaultto('') + end + + autorequire(:package) do + 'trove-api' + end end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_conductor_config.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_conductor_config.rb index 6450a47..d5ab342 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_conductor_config.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_conductor_config.rb @@ -14,6 +14,7 @@ Puppet::Type.newtype(:trove_conductor_config) do value.capitalize! if value =~ /^(true|false)$/i value end + newvalues(/^[\S ]*$/) def is_to_s( currentvalue ) if resource.secret? @@ -39,4 +40,13 @@ Puppet::Type.newtype(:trove_conductor_config) do defaultto false end + + newparam(:ensure_absent_val) do + desc 'A value that is specified as the value property will behave as if ensure => absent was specified' + defaultto('') + end + + autorequire(:package) do + 'trove-conductor' + end end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_config.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_config.rb index f1d14d2..81491eb 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_config.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_config.rb @@ -14,6 +14,7 @@ Puppet::Type.newtype(:trove_config) do value.capitalize! if value =~ /^(true|false)$/i value end + newvalues(/^[\S ]*$/) def is_to_s( currentvalue ) if resource.secret? @@ -39,4 +40,13 @@ Puppet::Type.newtype(:trove_config) do defaultto false end + + newparam(:ensure_absent_val) do + desc 'A value that is specified as the value property will behave as if ensure => absent was specified' + defaultto('') + end + + autorequire(:package) do + 'trove-api' + end end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_guestagent_config.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_guestagent_config.rb index 06072f8..a15e17d 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_guestagent_config.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_guestagent_config.rb @@ -14,6 +14,7 @@ Puppet::Type.newtype(:trove_guestagent_config) do value.capitalize! if value =~ /^(true|false)$/i value end + newvalues(/^[\S ]*$/) def is_to_s( currentvalue ) if resource.secret? @@ -39,4 +40,13 @@ Puppet::Type.newtype(:trove_guestagent_config) do defaultto false end + + newparam(:ensure_absent_val) do + desc 'A value that is specified as the value property will behave as if ensure => absent was specified' + defaultto('') + end + + autorequire(:package) do + 'trove-guestagent' + end end diff --git a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_taskmanager_config.rb b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_taskmanager_config.rb index 25af376..88480c5 100644 --- a/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_taskmanager_config.rb +++ b/deployment_scripts/puppet/modules/trove/lib/puppet/type/trove_taskmanager_config.rb @@ -14,6 +14,7 @@ Puppet::Type.newtype(:trove_taskmanager_config) do value.capitalize! if value =~ /^(true|false)$/i value end + newvalues(/^[\S ]*$/) def is_to_s( currentvalue ) if resource.secret? @@ -39,4 +40,10 @@ Puppet::Type.newtype(:trove_taskmanager_config) do defaultto false end + + newparam(:ensure_absent_val) do + desc 'A value that is specified as the value property will behave as if ensure => absent was specified' + defaultto('') + end + end diff --git a/deployment_scripts/puppet/modules/trove/manifests/api.pp b/deployment_scripts/puppet/modules/trove/manifests/api.pp index a2f2d95..88de534 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/api.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/api.pp @@ -119,6 +119,26 @@ # (optional) CA certificate file to use to verify connecting clients # Defaults to false, not set # +# [*http_get_rate*] +# (optional) Default rate limit of GET request. +# Defaults to 200. +# +# [*http_post_rate*] +# (optional) Default rate limit of POST request. +# Defaults to 200. +# +# [*http_put_rate*] +# (optional) Default rate limit of PUT request. +# Defaults to 200. +# +# [*http_delete_rate*] +# (optional) Default rate limit of DELETE request. +# Defaults to 200. +# +# [*http_mgmt_post_rate*] +# (optional) Default rate limit of mgmt post request. +# Defaults to 200. +# class trove::api( $keystone_password, $verbose = false, @@ -142,42 +162,22 @@ class trove::api( $cert_file = false, $key_file = false, $ca_file = false, + $http_get_rate = 200, + $http_post_rate = 200, + $http_put_rate = 200, + $http_delete_rate = 200, + $http_mgmt_post_rate = 200, $manage_service = true, $ensure_package = 'present', ) inherits trove { require ::keystone::python + include ::trove::db include ::trove::params Trove_config<||> ~> Exec['post-trove_config'] Trove_config<||> ~> Service['trove-api'] - Package['trove-api'] -> Trove_api_paste_ini<||> Trove_api_paste_ini<||> ~> Service['trove-api'] - # Trove db sync is broken in Ubuntu packaging - # This is a temporary fix until it's fixed in packaging. - # https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134 - file { '/etc/trove/trove.conf': - require => File['/etc/trove'], - } - File['/etc/trove/trove.conf'] -> Trove_config<||> - Trove_config<||> -> Package[$::trove::params::api_package_name] - - if $::trove::database_connection { - if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { - require 'mysql::bindings' - require 'mysql::bindings::python' - } elsif($::trove::database_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) { - - } elsif($::trove::database_connection =~ /sqlite:\/\//) { - - } else { - fail("Invalid db connection ${::trove::database_connection}") - } - trove_config { - 'database/connection': value => $::trove::database_connection; - 'database/idle_timeout': value => $::trove::database_idle_timeoutl; - } - } # basic service config trove_config { @@ -191,6 +191,7 @@ class trove::api( 'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass; 'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name; 'DEFAULT/control_exchange': value => $::trove::control_exchange; + 'DEFAULT/rpc_backend': value => $::trove::rpc_backend; } if $auth_url { @@ -271,30 +272,66 @@ class trove::api( } } + # rate limits + trove_config { + 'DEFAULT/http_get_rate': value => $http_get_rate; + 'DEFAULT/http_post_rate': value => $http_post_rate; + 'DEFAULT/http_put_rate': value => $http_put_rate; + 'DEFAULT/http_delete_rate': value => $http_delete_rate; + 'DEFAULT/http_mgmt_post_rate': value => $http_mgmt_post_rate; + } + resources { 'trove_config': purge => $purge_config, } - if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' { + # region name + if $::trove::os_region_name { + trove_config { 'DEFAULT/os_region_name': value => $::trove::os_region_name } + } + else { + trove_config {'DEFAULT/os_region_name': ensure => absent } + } + + # services type + trove_config { + 'DEFAULT/nova_compute_service_type': value => $::trove::nova_compute_service_type; + 'DEFAULT/cinder_service_type': value => $::trove::cinder_service_type; + 'DEFAULT/neutron_service_type': value => $::trove::neutron_service_type; + 'DEFAULT/swift_service_type': value => $::trove::swift_service_type; + 'DEFAULT/heat_service_type': value => $::trove::heat_service_type; + } + + if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' or $::trove::rpc_backend == 'rabbit' { if ! $::trove::rabbit_password { fail('When rpc_backend is rabbitmq, you must set rabbit password') } if $::trove::rabbit_hosts { - trove_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') } - trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + trove_config { 'oslo_messaging_rabbit/rabbit_hosts': value => $::trove::rabbit_hosts } } else { trove_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host } trove_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port } trove_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" } - trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + + if $::trove::rabbit_ha_queues == undef { + if size($::trove::rabbit_hosts) > 1 { + trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + } else { + trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + } else { + trove_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $::trove::rabbit_ha_queues } } trove_config { - 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_user; + 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_userid; 'oslo_messaging_rabbit/rabbit_password': value => $::trove::rabbit_password, secret => true; 'oslo_messaging_rabbit/rabbit_virtual_host': value => $::trove::rabbit_virtual_host; 'oslo_messaging_rabbit/rabbit_use_ssl': value => $::trove::rabbit_use_ssl; 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $::trove::kombu_reconnect_delay; + # TODO(shaikapsar): remove this line once bug/1486319 merged to stable/liberty. + 'oslo_messaging_rabbit/amqp_durable_queues': value => $::trove::amqp_durable_queues; } if $::trove::rabbit_use_ssl { @@ -333,29 +370,32 @@ class trove::api( } } - if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' { + if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' or $::trove::rpc_backend == 'qpid'{ + + warning('Qpid driver is removed from Oslo.messaging in the Mitaka release') + trove_config { - 'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname; - 'DEFAULT/qpid_port': value => $::trove::qpid_port; - 'DEFAULT/qpid_username': value => $::trove::qpid_username; - 'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true; - 'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat; - 'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol; - 'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay; + 'oslo_messaging_qpid/qpid_hostname': value => $::trove::qpid_hostname; + 'oslo_messaging_qpid/qpid_port': value => $::trove::qpid_port; + 'oslo_messaging_qpid/qpid_username': value => $::trove::qpid_username; + 'oslo_messaging_qpid/qpid_password': value => $::trove::qpid_password, secret => true; + 'oslo_messaging_qpid/qpid_heartbeat': value => $::trove::qpid_heartbeat; + 'oslo_messaging_qpid/qpid_protocol': value => $::trove::qpid_protocol; + 'oslo_messaging_qpid/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay; } if is_array($::trove::qpid_sasl_mechanisms) { trove_config { - 'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' '); + 'oslo_messaging_qpid/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' '); } } elsif $::trove::qpid_sasl_mechanisms { trove_config { - 'DEFAULT/qpid_sasl_mechanisms': value => $::trove::qpid_sasl_mechanisms; + 'oslo_messaging_qpid/qpid_sasl_mechanisms': value => $::trove::qpid_sasl_mechanisms; } } else { trove_config { - 'DEFAULT/qpid_sasl_mechanisms': ensure => absent; + 'oslo_messaging_qpid/qpid_sasl_mechanisms': ensure => absent; } } } diff --git a/deployment_scripts/puppet/modules/trove/manifests/conductor.pp b/deployment_scripts/puppet/modules/trove/manifests/conductor.pp index 570e452..f46ad76 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/conductor.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/conductor.pp @@ -68,14 +68,6 @@ class trove::conductor( Trove_conductor_config<||> ~> Exec['post-trove_config'] Trove_conductor_config<||> ~> Service['trove-conductor'] - # Trove db sync is broken in Ubuntu packaging - # This is a temporary fix until it's fixed in packaging. - # https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134 - file { '/etc/trove/trove-conductor.conf': - require => File['/etc/trove'], - } - File['/etc/trove/trove-conductor.conf'] -> Trove_conductor_config<||> - Trove_conductor_config<||> -> Package[$::trove::params::conductor_package_name] if $::trove::database_connection { if($::trove::database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) { @@ -103,28 +95,39 @@ class trove::conductor( 'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name; 'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass; 'DEFAULT/control_exchange': value => $::trove::control_exchange; + 'DEFAULT/rpc_backend': value => $::trove::rpc_backend; } - if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' { + if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' or $::trove::rpc_backend == 'rabbit' { if ! $::trove::rabbit_password { fail('When rpc_backend is rabbitmq, you must set rabbit password') } if $::trove::rabbit_hosts { - trove_conductor_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') } - trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + trove_conductor_config { 'oslo_messaging_rabbit/rabbit_hosts': value => ::trove::rabbit_hosts } } else { trove_conductor_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host } trove_conductor_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port } trove_conductor_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" } - trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + + if $::trove::rabbit_ha_queues == undef { + if size($::trove::rabbit_hosts) > 1 { + trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + } else { + trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + } else { + trove_conductor_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $::trove::rabbit_ha_queues } } trove_conductor_config { - 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_user; + 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_userid; 'oslo_messaging_rabbit/rabbit_password': value => $::trove::rabbit_password, secret => true; 'oslo_messaging_rabbit/rabbit_virtual_host': value => $::trove::rabbit_virtual_host; 'oslo_messaging_rabbit/rabbit_use_ssl': value => $::trove::rabbit_use_ssl; 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $::trove::kombu_reconnect_delay; + # TODO(shaikapsar): remove this line once bug/1486319 merged to stable/liberty. + 'oslo_messaging_rabbit/amqp_durable_queues': value => $::trove::amqp_durable_queues; } if $::trove::rabbit_use_ssl { @@ -163,19 +166,22 @@ class trove::conductor( } } - if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' { + if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' or $::trove::rpc_backend == 'qpid'{ + + warning('Qpid driver is removed from Oslo.messaging in the Mitaka release') + trove_conductor_config { - 'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname; - 'DEFAULT/qpid_port': value => $::trove::qpid_port; - 'DEFAULT/qpid_username': value => $::trove::qpid_username; - 'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true; - 'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat; - 'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol; - 'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay; + 'oslo_messaging_qpid/qpid_hostname': value => $::trove::qpid_hostname; + 'oslo_messaging_qpid/qpid_port': value => $::trove::qpid_port; + 'oslo_messaging_qpid/qpid_username': value => $::trove::qpid_username; + 'oslo_messaging_qpid/qpid_password': value => $::trove::qpid_password, secret => true; + 'oslo_messaging_qpid/qpid_heartbeat': value => $::trove::qpid_heartbeat; + 'oslo_messaging_qpid/qpid_protocol': value => $::trove::qpid_protocol; + 'oslo_messaging_qpid/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay; } if is_array($::trove::qpid_sasl_mechanisms) { trove_conductor_config { - 'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' '); + 'oslo_messaging_qpid/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' '); } } } diff --git a/deployment_scripts/puppet/modules/trove/manifests/db.pp b/deployment_scripts/puppet/modules/trove/manifests/db.pp new file mode 100644 index 0000000..9368ba7 --- /dev/null +++ b/deployment_scripts/puppet/modules/trove/manifests/db.pp @@ -0,0 +1,103 @@ +# == Class: trove::db +# +# Configure the Trove database +# +# === Parameters +# +# [*database_connection*] +# Url used to connect to database. +# (Optional) Defaults to 'sqlite:////var/lib/trove/trove.sqlite'. +# +# [*database_idle_timeout*] +# Timeout when db connections should be reaped. +# (Optional) Defaults to 3600. +# +# [*database_max_retries*] +# Maximum number of database connection retries during startup. +# Setting -1 implies an infinite retry count. +# (Optional) Defaults to 10. +# +# [*database_retry_interval*] +# Interval between retries of opening a database connection. +# (Optional) Defaults to 10. +# +# [*database_min_pool_size*] +# Minimum number of SQL connections to keep open in a pool. +# (Optional) Defaults to 1. +# +# [*database_max_pool_size*] +# Maximum number of SQL connections to keep open in a pool. +# (Optional) Defaults to 10. +# +# [*database_max_overflow*] +# If set, use this value for max_overflow with sqlalchemy. +# (Optional) Defaults to 20. +# +class trove::db ( + $database_connection = 'sqlite:////var/lib/trove/trove.sqlite', + $database_idle_timeout = 3600, + $database_min_pool_size = 1, + $database_max_pool_size = 10, + $database_max_retries = 10, + $database_retry_interval = 10, + $database_max_overflow = 20, +) { + + include ::trove::params + + # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function + # to use trove:: if trove::db:: isn't specified. + $database_connection_real = pick($::trove::database_connection, $database_connection) + $database_idle_timeout_real = pick($::trove::database_idle_timeout, $database_idle_timeout) + $database_min_pool_size_real = pick($::trove::database_min_pool_size, $database_min_pool_size) + $database_max_pool_size_real = pick($::trove::database_max_pool_size, $database_max_pool_size) + $database_max_retries_real = pick($::trove::database_max_retries, $database_max_retries) + $database_retry_interval_real = pick($::trove::database_retry_interval, $database_retry_interval) + $database_max_overflow_real = pick($::trove::database_max_overflow, $database_max_overflow) + + validate_re($database_connection_real, + '^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') + + if $database_connection_real { + case $database_connection_real { + /^mysql(\+pymysql)?:\/\//: { + require 'mysql::bindings' + require 'mysql::bindings::python' + if $database_connection_real =~ /^mysql\+pymysql/ { + $backend_package = $::trove::params::pymysql_package_name + } else { + $backend_package = false + } + } + /^postgresql:\/\//: { + $backend_package = false + require 'postgresql::lib::python' + } + /^sqlite:\/\//: { + $backend_package = $::trove::params::sqlite_package_name + } + default: { + fail('Unsupported backend configured') + } + } + + if $backend_package and !defined(Package[$backend_package]) { + package {'trove-backend-package': + ensure => present, + name => $backend_package, + tag => 'openstack', + } + } + + trove_config { + 'database/connection': value => $database_connection_real, secret => true; + 'database/idle_timeout': value => $database_idle_timeout_real; + 'database/min_pool_size': value => $database_min_pool_size_real; + 'database/max_retries': value => $database_max_retries_real; + 'database/retry_interval': value => $database_retry_interval_real; + 'database/max_pool_size': value => $database_max_pool_size_real; + 'database/max_overflow': value => $database_max_overflow_real; + } + } + +} diff --git a/deployment_scripts/puppet/modules/trove/manifests/db/mysql.pp b/deployment_scripts/puppet/modules/trove/manifests/db/mysql.pp index 6748de8..792eae7 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/db/mysql.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/db/mysql.pp @@ -79,5 +79,5 @@ class trove::db::mysql( allowed_hosts => $allowed_hosts, } - ::Openstacklib::Db::Mysql['trove'] ~> Exec<| title == 'trove-db-sync' |> + ::Openstacklib::Db::Mysql['trove'] ~> Exec<| title == 'trove-manage db_sync' |> } diff --git a/deployment_scripts/puppet/modules/trove/manifests/db/sync.pp b/deployment_scripts/puppet/modules/trove/manifests/db/sync.pp index 97d69db..9d3f947 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/db/sync.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/db/sync.pp @@ -23,6 +23,5 @@ class trove::db::sync { user => 'trove', refreshonly => true, subscribe => Trove_config['database/connection'], - require => Package['trove-api'], } } diff --git a/deployment_scripts/puppet/modules/trove/manifests/generic_service.pp b/deployment_scripts/puppet/modules/trove/manifests/generic_service.pp index 9466642..2201eb8 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/generic_service.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/generic_service.pp @@ -60,7 +60,7 @@ define trove::generic_service( $trove_title = "trove-${name}" Exec['post-trove_config'] ~> Service<| title == $trove_title |> - Exec<| title == 'trove-db-sync' |> ~> Service<| title == $trove_title |> + Exec<| title == 'trove-manage db_sync' |> ~> Service<| title == $trove_title |> if ($package_name) { if !defined(Package[$package_name]) { @@ -68,6 +68,7 @@ define trove::generic_service( ensure => $ensure_package, name => $package_name, notify => Service[$trove_title], + tag => ['openstack', 'trove-package'], } } } @@ -86,6 +87,7 @@ define trove::generic_service( name => $service_name, enable => $enabled, hasstatus => true, + tag => 'trove-service', } } } diff --git a/deployment_scripts/puppet/modules/trove/manifests/guestagent.pp b/deployment_scripts/puppet/modules/trove/manifests/guestagent.pp index f8dcbcc..32c25da 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/guestagent.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/guestagent.pp @@ -54,6 +54,38 @@ # (optional) Control exchange. # Defaults to 'trove'. # +# TODO(shaikapsar): remove this once bug/1585783 merged to stable/liberty. +# [*rabbit_hosts*] +# (optional) List of clustered rabbit servers. +# Defaults to the value set in the trove class. +# The default can generally be left unless the +# guests need to talk to the rabbit cluster via +# different IPs. +# +# TODO(shaikapsar): remove this once bug/1585783 merged to stable/liberty. +# [*rabbit_host*] +# (optional) Location of rabbitmq installation. +# Defaults to the value set in the trove class. +# The default can generally be left unless the +# guests need to talk to the rabbit cluster via +# a different IP. +# +# TODO(shaikapsar): remove this once bug/1585783 merged to stable/liberty. +# [*rabbit_port*] +# (optional) Port for rabbitmq instance. +# Defaults to the value set in the trove class. +# The default can generally be left unless the +# guests need to talk to the rabbit cluster via +# a different port. +# +# TODO(shaikapsar): remove this once bug/1585783 merged to stable/liberty. +# [*rabbit_use_ssl*] +# (optional) Connect over SSL for RabbitMQ +# Defaults to the value set in the trove class. +# The default can generally be left unless the +# guests need to talk to the rabbit cluster via +# a different ssl connection option. +# class trove::guestagent( $enabled = true, $manage_service = true, @@ -66,57 +98,91 @@ class trove::guestagent( $log_facility = 'LOG_USER', $auth_url = 'http://localhost:5000/v2.0', $swift_url = 'http://localhost:8080/v1/AUTH_', - $control_exchange = 'trove' + $control_exchange = 'trove', + # TODO(shaikapsar): remove the below 4lines once bug/1585783 merged to stable/liberty. + $rabbit_hosts = $::trove::rabbit_hosts, + $rabbit_host = $::trove::rabbit_host, + $rabbit_port = $::trove::rabbit_port, + $rabbit_use_ssl = $::trove::rabbit_use_ssl, ) inherits trove { include ::trove::params Trove_guestagent_config<||> ~> Exec['post-trove_config'] Trove_guestagent_config<||> ~> Service['trove-guestagent'] - # Trove db sync is broken in Ubuntu packaging - # This is a temporary fix until it's fixed in packaging. - # https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1451134 - file { '/etc/trove/trove-guestagent.conf': - require => File['/etc/trove'], - } - File['/etc/trove/trove-guestagent.conf'] -> Trove_guestagent_config<||> - Trove_guestagent_config<||> -> Package[$::trove::params::guestagent_package_name] # basic service config trove_guestagent_config { 'DEFAULT/verbose': value => $verbose; 'DEFAULT/debug': value => $debug; - 'DEFAULT/trove_auth_url': value => $auth_url; - 'DEFAULT/swift_url': value => $swift_url; - 'DEFAULT/nova_proxy_admin_user': value => $::trove::nova_proxy_admin_user; - 'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name; - 'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass; 'DEFAULT/control_exchange': value => $control_exchange; + 'DEFAULT/rpc_backend': value => $::trove::rpc_backend; } - if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' { - if ! $::trove::rabbit_password { + # (shaikapsar): Option to fetch auth_url and swift_url from the keystone catalog. + + # auth_url + if $auth_url { + trove_guestagent_config { 'DEFAULT/trove_auth_url': value => $auth_url } + } + else { + trove_guestagent_config { 'DEFAULT/trove_auth_url': ensure => absent } + } + + # swift_url + if $swift_url { + trove_guestagent_config { 'DEFAULT/swift_url': value => $swift_url } + } + else { + trove_guestagent_config { 'DEFAULT/swift_url': ensure => absent } + } + + # region name + if $::trove::os_region_name { + trove_guestagent_config { 'DEFAULT/os_region_name': value => $::trove::os_region_name } + } + else { + trove_guestagent_config {'DEFAULT/os_region_name': ensure => absent } + } + + if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' or $::trove::rpc_backend == 'rabbit' { + if ! $::trove::rabbit_password { fail('When rpc_backend is rabbitmq, you must set rabbit password') } - if $::trove::rabbit_hosts { - trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') } - trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + + # TODO(shaikapsar): remove the below lines once bug/1585783 merged to stable/liberty. + if $rabbit_hosts { + trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_hosts': value => $rabbit_hosts } } else { - trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host } - trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port } - trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" } - trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host } + trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port } + trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" } + } + + if $::trove::rabbit_ha_queues == undef { + # TODO(shaikapsar): remove the below lines once bug/1585783 merged to stable/liberty. + if size($rabbit_hosts) > 1 { + trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + } else { + trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + } else { + trove_guestagent_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $::trove::rabbit_ha_queues } } trove_guestagent_config { - 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_user; + 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_userid; 'oslo_messaging_rabbit/rabbit_password': value => $::trove::rabbit_password, secret => true; 'oslo_messaging_rabbit/rabbit_virtual_host': value => $::trove::rabbit_virtual_host; - 'oslo_messaging_rabbit/rabbit_use_ssl': value => $::trove::rabbit_use_ssl; + # TODO(shaikapsar): remove the below lines once bug/1585783 merged to stable/liberty. + 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $::trove::kombu_reconnect_delay; + # TODO(shaikapsar): remove the below lines once bug/1486319 merged to stable/liberty. + 'oslo_messaging_rabbit/amqp_durable_queues': value => $::trove::amqp_durable_queues; } - if $::trove::rabbit_use_ssl { + # TODO(shaikapsar): remove the below lines once bug/1585783 merged to stable/liberty. + if $rabbit_use_ssl { if $::trove::kombu_ssl_ca_certs { trove_guestagent_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $::trove::kombu_ssl_ca_certs; } @@ -152,19 +218,22 @@ class trove::guestagent( } } - if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' { + if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' or $::trove::rpc_backend == 'qpid'{ + + warning('Qpid driver is removed from Oslo.messaging in the Mitaka release') + trove_guestagent_config { - 'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname; - 'DEFAULT/qpid_port': value => $::trove::qpid_port; - 'DEFAULT/qpid_username': value => $::trove::qpid_username; - 'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true; - 'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat; - 'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol; - 'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay; + 'oslo_messaging_qpid/qpid_hostname': value => $::trove::qpid_hostname; + 'oslo_messaging_qpid/qpid_port': value => $::trove::qpid_port; + 'oslo_messaging_qpid/qpid_username': value => $::trove::qpid_username; + 'oslo_messaging_qpid/qpid_password': value => $::trove::qpid_password, secret => true; + 'oslo_messaging_qpid/qpid_heartbeat': value => $::trove::qpid_heartbeat; + 'oslo_messaging_qpid/qpid_protocol': value => $::trove::qpid_protocol; + 'oslo_messaging_qpid/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay; } if is_array($::trove::qpid_sasl_mechanisms) { trove_guestagent_config { - 'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' '); + 'oslo_messaging_qpid/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' '); } } } diff --git a/deployment_scripts/puppet/modules/trove/manifests/init.pp b/deployment_scripts/puppet/modules/trove/manifests/init.pp index bc1b45b..ebed9f8 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/init.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/init.pp @@ -77,6 +77,10 @@ # available on some distributions. # Defaults to 'TLSv1' # +# [*rabbit_ha_queues*] +# (optional) Use HA queues in RabbitMQ (x-ha-policy: all). +# Defaults to undef +# # [*amqp_durable_queues*] # (optional) Define queues as "durable" to rabbitmq. # Defaults to false @@ -115,9 +119,9 @@ # # [*rpc_backend*] # (optional) The rpc backend implementation to use, can be: -# trove.openstack.common.rpc.impl_kombu (for rabbitmq) -# trove.openstack.common.rpc.impl_qpid (for qpid) -# Defaults to 'trove.openstack.common.rpc.impl_kombu' +# rabbit (for rabbitmq) +# qpid (for qpid) +# Defaults to 'rabbit' # # [*mysql_module*] # (optional) Deprecated. Does nothing. @@ -125,11 +129,32 @@ # # [*database_connection*] # (optional) Connection url to connect to trove database. -# Defaults to 'sqlite:////var/lib/trove/trove.sqlite' +# Defaults to undef. # # [*database_idle_timeout*] # (optional) Timeout before idle db connections are reaped. -# Defaults to 3600 +# Defaults to undef. +# +# [*database_max_retries*] +# (optional) Maximum number of database connection retries during startup. +# Setting -1 implies an infinite retry count. +# Defaults to undef. +# +# [*database_retry_interval*] +# (optional) Interval between retries of opening a database connection. +# Defaults to undef. +# +# [*database_min_pool_size*] +# (optional) Minimum number of SQL connections to keep open in a pool. +# Defaults to: undef. +# +# [*database_max_pool_size*] +# (optional) Maximum number of SQL connections to keep open in a pool. +# Defaults to: undef. +# +# [*database_max_overflow*] +# (optional) If set, use this value for max_overflow with sqlalchemy. +# Defaults to: undef. # # [*nova_compute_url*] # (optional) URL without the tenant segment. @@ -158,6 +183,37 @@ # (optional) Swift URL ending in AUTH_. # Defaults to false. # +# [*neutron_url*] +# (optional) Cinder URL without the tenant segment. +# Defaults to false. +# +# [*os_region_name*] +# (optional) Sets the os_region_name flag. For environments with +# more than one endpoint per service. If you don't set this and +# you have multiple endpoints, you will get Ambiguous Endpoint +# exceptions in the trove API service. +# Defaults to undef. +# +# [*nova_compute_service_type*] +# (optional) Nova service type to use when searching catalog. +# Defaults to 'compute'. +# +# [*cinder_service_type*] +# (optional) Cinder service type to use when searching catalog. +# Defaults to 'volumev2'. +# +# [*swift_service_type*] +# (optional) Swift service type to use when searching catalog. +# Defaults to 'object-store'. +# +# [*heat_service_type*] +# (optional) Heat service type to use when searching catalog. +# Defaults to 'orchestration'. +# +# [*neutron_service_type*] +# (optional) Neutron service type to use when searching catalog. +# Defaults to 'network'. +# # [*use_neutron*] # (optional) Use Neutron # Defaults to true @@ -169,27 +225,48 @@ class trove( $nova_proxy_admin_pass, $rabbit_host = 'localhost', - $rabbit_hosts = false, + $rabbit_hosts = undef, $rabbit_password = 'guest', $rabbit_port = '5672', $rabbit_userid = 'guest', $rabbit_virtual_host = '/', $rabbit_use_ssl = false, + $rabbit_ha_queues = undef, $rabbit_notification_topic = 'notifications', $kombu_ssl_ca_certs = undef, $kombu_ssl_certfile = undef, $kombu_ssl_keyfile = undef, $kombu_ssl_version = 'TLSv1', $amqp_durable_queues = false, - $database_connection = 'sqlite:////var/lib/trove/trove.sqlite', - $database_idle_timeout = 3600, - $rpc_backend = 'trove.openstack.common.rpc.impl_kombu', + $qpid_hostname = 'localhost', + $qpid_port = '5672', + $qpid_username = 'guest', + $qpid_password = 'guest', + $qpid_sasl_mechanisms = false, + $qpid_heartbeat = 60, + $qpid_protocol = 'tcp', + $qpid_tcp_nodelay = true, + $database_connection = undef, + $database_idle_timeout = undef, + $database_max_retries = undef, + $database_retry_interval = undef, + $database_min_pool_size = undef, + $database_max_pool_size = undef, + $database_max_overflow = undef, + $rpc_backend = 'rabbit', $nova_compute_url = false, $nova_proxy_admin_user = 'admin', $nova_proxy_admin_tenant_name = 'admin', $control_exchange = 'trove', $cinder_url = false, $swift_url = false, + $neutron_url = false, + $os_region_name = undef, + $nova_compute_service_type = 'compute', + $cinder_service_type = 'volumev2', + $swift_service_type = 'object-store', + $heat_service_type = 'orchestration', + $neutron_service_type = 'network', $use_neutron = true, $package_ensure = 'present', # DEPRECATED PARAMETERS @@ -229,31 +306,16 @@ class trove( trove_config { 'DEFAULT/swift_url': ensure => absent } } - if $::osfamily == 'RedHat' { - # TO-DO(mmagr): Conditional should be removed as soon as following bug - # is really fixed. On Ubuntu trove-common is not installable without already - # running database and correctly filled trove.conf: - # https://bugs.launchpad.net/ubuntu/+source/openstack-trove/+bug/1365561 - package { 'trove': - ensure => $package_ensure, - name => $::trove::params::common_package_name - } - $group_require = Package['trove'] - } else { - $group_require = undef + if $neutron_url { + trove_config { 'DEFAULT/neutron_url': value => $neutron_url } + } + else { + trove_config { 'DEFAULT/neutron_url': ensure => absent } } - group { 'trove': - ensure => 'present', - name => 'trove', - system => true, - require => $group_require + package { 'trove': + ensure => $package_ensure, + name => $::trove::params::common_package_name, + tag => ['openstack', 'trove-package'], } - - file { '/etc/trove/': - ensure => directory, - group => 'trove', - require => Group['trove'] - } - } diff --git a/deployment_scripts/puppet/modules/trove/manifests/keystone/auth.pp b/deployment_scripts/puppet/modules/trove/manifests/keystone/auth.pp index b76309a..c18d842 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/keystone/auth.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/keystone/auth.pp @@ -43,6 +43,10 @@ # (optional) Name of the service. # Defaults to the value of auth_name. # +# [*service_description*] +# (optional) Description for keystone service. +# Defaults to 'Trove Database Service'. +# # [*region*] # Region for endpoint. Defaults to 'RegionOne'. # @@ -113,25 +117,26 @@ # class trove::keystone::auth ( $password, - $auth_name = 'trove', - $email = 'trove@localhost', - $tenant = 'services', - $configure_endpoint = true, - $service_name = undef, - $service_type = 'database', - $region = 'RegionOne', - $public_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s', - $admin_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s', - $internal_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s', + $auth_name = 'trove', + $email = 'trove@localhost', + $tenant = 'services', + $configure_endpoint = true, + $service_name = undef, + $service_type = 'database', + $service_description = 'Trove Database Service', + $region = 'RegionOne', + $public_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s', + $admin_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s', + $internal_url = 'http://127.0.0.1:8779/v1.0/%(tenant_id)s', # DEPRECATED PARAMETERS - $port = undef, - $public_port = undef, - $public_protocol = undef, - $public_address = undef, - $internal_protocol = undef, - $internal_address = undef, - $admin_protocol = undef, - $admin_address = undef, + $port = undef, + $public_port = undef, + $public_protocol = undef, + $public_address = undef, + $internal_protocol = undef, + $internal_address = undef, + $admin_protocol = undef, + $admin_address = undef, ) { if $port { @@ -197,7 +202,7 @@ class trove::keystone::auth ( Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'trove-server' |> - Keystone_endpoint<| title == "${region}/${real_service_name}" |> + Keystone_endpoint<| title == "${region}/${real_service_name}::${service_type}" |> ~> Service <| name == 'trove-server' |> keystone::resource::service_identity { 'trove': @@ -206,7 +211,7 @@ class trove::keystone::auth ( configure_endpoint => $configure_endpoint, service_name => $real_service_name, service_type => $service_type, - service_description => 'Trove Database Service', + service_description => $service_description, region => $region, auth_name => $auth_name, password => $password, diff --git a/deployment_scripts/puppet/modules/trove/manifests/params.pp b/deployment_scripts/puppet/modules/trove/manifests/params.pp index 71fad88..809f5d2 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/params.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/params.pp @@ -14,6 +14,8 @@ class trove::params { $guestagent_service_name = 'openstack-trove-guestagent' $taskmanager_package_name = 'openstack-trove-taskmanager' $taskmanager_service_name = 'openstack-trove-taskmanager' + $sqlite_package_name = undef + $pymysql_package_name = undef } 'Debian': { $client_package_name = 'python-troveclient' @@ -26,6 +28,8 @@ class trove::params { $guestagent_service_name = 'trove-guestagent' $taskmanager_package_name = 'trove-taskmanager' $taskmanager_service_name = 'trove-taskmanager' + $sqlite_package_name = 'python-pysqlite2' + $pymysql_package_name = 'python-pymysql' } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem") diff --git a/deployment_scripts/puppet/modules/trove/manifests/quota.pp b/deployment_scripts/puppet/modules/trove/manifests/quota.pp new file mode 100644 index 0000000..874ea58 --- /dev/null +++ b/deployment_scripts/puppet/modules/trove/manifests/quota.pp @@ -0,0 +1,43 @@ +# == Class: trove::quota +# +# Setup and configure trove quotas. +# +# === Parameters +# +# [*max_instances_per_user*] +# (optional) Default maximum number of instances per tenant. +# Defaults to 5. +# +# [*max_accepted_volume_size*] +# (optional) Default maximum volume size (in GB) for an instance. +# Defaults to 5. +# +# [*max_volumes_per_user*] +# (optional) Default maximum volume capacity (in GB) spanning across +# all Trove volumes per tenant. +# Defaults to 20. +# +# [*max_backups_per_user*] +# (optional) Default maximum number of backups created by a tenant. +# Defaults to 50. +# +# [*quota_driver*] +# (optional) Default driver to use for quota checks. +# Defaults to 'trove.quota.quota.DbQuotaDriver'. +# +class trove::quota ( + $max_instances_per_user = 5, + $max_accepted_volume_size = 5, + $max_volumes_per_user = 20, + $max_backups_per_user = 50, + $quota_driver = 'trove.quota.quota.DbQuotaDriver', +) { + + trove_config { + 'DEFAULT/max_instances_per_user': value => $max_instances_per_user; + 'DEFAULT/max_accepted_volume_size': value => $max_accepted_volume_size; + 'DEFAULT/max_volumes_per_user': value => $max_volumes_per_user; + 'DEFAULT/max_backups_per_user': value => $max_backups_per_user; + 'DEFAULT/quota_driver': value => $quota_driver; + } +} diff --git a/deployment_scripts/puppet/modules/trove/manifests/rabbitmq.pp b/deployment_scripts/puppet/modules/trove/manifests/rabbitmq.pp deleted file mode 100644 index a9af480..0000000 --- a/deployment_scripts/puppet/modules/trove/manifests/rabbitmq.pp +++ /dev/null @@ -1,106 +0,0 @@ -# == Class: trove::rabbitmq -# -# Installs and manages rabbitmq server for trove -# -# == Parameters: -# -# [*userid*] -# (optional) The username to use when connecting to Rabbit -# Defaults to 'guest' -# -# [*password*] -# (optional) The password to use when connecting to Rabbit -# Defaults to 'guest' -# -# [*port*] -# (optional) The port to use when connecting to Rabbit -# Defaults to '5672' -# -# [*virtual_host*] -# (optional) The virtual host to use when connecting to Rabbit -# Defaults to '/' -# -# [*cluster_disk_nodes*] -# (optional) Enables/disables RabbitMQ clustering. Specify an array of Rabbit Broker -# IP addresses to configure clustering. -# Defaults to false -# -# [*enabled*] -# (optional) Whether to enable the Rabbit service -# Defaults to false -# -# [*rabbitmq_class*] -# (optional) Deprecated. The rabbitmq puppet class to depend on, -# which is dependent on the puppet-rabbitmq version. -# Use the default for 1.x, use 'rabbitmq' for 3.x. -# Use false if rabbitmq class should not be configured -# here -# Defaults to 'rabbitmq::server' -# -class trove::rabbitmq( - $userid ='guest', - $password ='guest', - $port ='55671', - $virtual_host ='/', - $cluster_disk_nodes = false, - $enabled = true, - # DEPRECATED PARAMETER - $rabbitmq_class = 'rabbitmq::server' -) { - - if ($enabled) { - if $userid == 'guest' { - $delete_guest_user = false - } else { - $delete_guest_user = true - rabbitmq_user { $userid: - admin => true, - password => $password, - provider => 'rabbitmqctl', - } - # I need to figure out the appropriate permissions - rabbitmq_user_permissions { "${userid}@${virtual_host}": - configure_permission => '.*', - write_permission => '.*', - read_permission => '.*', - provider => 'rabbitmqctl', - }->Anchor<| title == 'trove-start' |> - } - $service_ensure = 'running' - } else { - $service_ensure = 'stopped' - } - - # NOTE(bogdando) do not trove manage rabbitmq service - # if rabbitmq_class is set to False - if $rabbitmq_class { - warning('The rabbitmq_class parameter is deprecated.') - - if $cluster_disk_nodes { - class { $rabbitmq_class: - service_ensure => $service_ensure, - port => $port, - delete_guest_user => $delete_guest_user, - config_cluster => true, - cluster_disk_nodes => $cluster_disk_nodes, - wipe_db_on_cookie_change => true, - } - } else { - class { $rabbitmq_class: - service_ensure => $service_ensure, - port => $port, - delete_guest_user => $delete_guest_user, - } - } - Class[$rabbitmq_class] -> Rabbitmq_user<| title == $userid |> - Class[$rabbitmq_class] -> Rabbitmq_vhost<| title == $virtual_host |> - # only configure trove after the queue is up - Class[$rabbitmq_class] -> Anchor<| title == 'trove-start' |> - } - - if ($enabled) { - rabbitmq_vhost { $virtual_host: - provider => 'rabbitmqctl', - } - } -} \ No newline at end of file diff --git a/deployment_scripts/puppet/modules/trove/manifests/taskmanager.pp b/deployment_scripts/puppet/modules/trove/manifests/taskmanager.pp index 0b29a4c..1dd84c6 100644 --- a/deployment_scripts/puppet/modules/trove/manifests/taskmanager.pp +++ b/deployment_scripts/puppet/modules/trove/manifests/taskmanager.pp @@ -69,21 +69,36 @@ # # [*guestagent_config_file*] # (optional) Trove guest agent configuration file. -# Defaults to '/etc/trove/trove-guestmanager.conf'. +# Defaults to '/etc/trove/trove-guestagent.conf'. +# +# [*use_guestagent_template*] +# (optional) Use template to provision trove guest agent configuration file. +# Defaults to true. +# +# [*default_neutron_networks*] +# (optional) The network that trove will attach by default. +# Defaults to undef. +# +# [*taskmanager_queue*] +# (optional) Message queue name the Taskmanager will listen to. +# Defaults to 'taskmanager'. # class trove::taskmanager( - $enabled = true, - $manage_service = true, - $debug = false, - $verbose = false, - $log_file = '/var/log/trove/trove-taskmanager.log', - $log_dir = '/var/log/trove', - $use_syslog = false, - $log_facility = 'LOG_USER', - $auth_url = 'http://localhost:5000/v2.0', - $heat_url = false, - $ensure_package = 'present', - $guestagent_config_file = '/etc/trove/trove-guestmanager.conf' + $enabled = true, + $manage_service = true, + $debug = false, + $verbose = false, + $log_file = '/var/log/trove/trove-taskmanager.log', + $log_dir = '/var/log/trove', + $use_syslog = false, + $log_facility = 'LOG_USER', + $auth_url = 'http://localhost:5000/v2.0', + $heat_url = false, + $ensure_package = 'present', + $guestagent_config_file = '/etc/trove/trove-guestagent.conf', + $use_guestagent_template = true, + $default_neutron_networks = undef, + $taskmanager_queue = 'taskmanager', ) inherits trove { include ::trove::params @@ -117,28 +132,60 @@ class trove::taskmanager( 'DEFAULT/nova_proxy_admin_user': value => $::trove::nova_proxy_admin_user; 'DEFAULT/nova_proxy_admin_pass': value => $::trove::nova_proxy_admin_pass; 'DEFAULT/nova_proxy_admin_tenant_name': value => $::trove::nova_proxy_admin_tenant_name; + 'DEFAULT/rpc_backend': value => $::trove::rpc_backend; } - if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' { + trove_config { + 'DEFAULT/taskmanager_queue': value => $taskmanager_queue; + } + + # region name + if $::trove::os_region_name { + trove_taskmanager_config { 'DEFAULT/os_region_name': value => $::trove::os_region_name } + } + else { + trove_taskmanager_config {'DEFAULT/os_region_name': ensure => absent } + } + + # services type + trove_taskmanager_config { + 'DEFAULT/nova_compute_service_type': value => $::trove::nova_compute_service_type; + 'DEFAULT/cinder_service_type': value => $::trove::cinder_service_type; + 'DEFAULT/neutron_service_type': value => $::trove::neutron_service_type; + 'DEFAULT/swift_service_type': value => $::trove::swift_service_type; + 'DEFAULT/heat_service_type': value => $::trove::heat_service_type; + } + + if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_kombu' or $::trove::rpc_backend == 'rabbit'{ if ! $::trove::rabbit_password { fail('When rpc_backend is rabbitmq, you must set rabbit password') } if $::trove::rabbit_hosts { - trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($::trove::rabbit_hosts, ',') } - trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_hosts': value => $::trove::rabbit_hosts } } else { trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_host': value => $::trove::rabbit_host } trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_port': value => $::trove::rabbit_port } trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${::trove::rabbit_host}:${::trove::rabbit_port}" } - trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + + if $::trove::rabbit_ha_queues == undef { + if size($::trove::rabbit_hosts) > 1 { + trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true } + } else { + trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false } + } + } else { + trove_taskmanager_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => $::trove::rabbit_ha_queues } } trove_taskmanager_config { - 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_user; + 'oslo_messaging_rabbit/rabbit_userid': value => $::trove::rabbit_userid; 'oslo_messaging_rabbit/rabbit_password': value => $::trove::rabbit_password, secret => true; 'oslo_messaging_rabbit/rabbit_virtual_host': value => $::trove::rabbit_virtual_host; 'oslo_messaging_rabbit/rabbit_use_ssl': value => $::trove::rabbit_use_ssl; 'oslo_messaging_rabbit/kombu_reconnect_delay': value => $::trove::kombu_reconnect_delay; + # TODO(shaikapsar): remove the below lines once bug/1486319 merged to stable/liberty. + 'oslo_messaging_rabbit/amqp_durable_queues': value => $::trove::amqp_durable_queues; } if $::trove::rabbit_use_ssl { @@ -177,19 +224,22 @@ class trove::taskmanager( } } - if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' { + if $::trove::rpc_backend == 'trove.openstack.common.rpc.impl_qpid' or $::trove::rpc_backend == 'qpid'{ + + warning('Qpid driver is removed from Oslo.messaging in the Mitaka release') + trove_taskmanager_config { - 'DEFAULT/qpid_hostname': value => $::trove::qpid_hostname; - 'DEFAULT/qpid_port': value => $::trove::qpid_port; - 'DEFAULT/qpid_username': value => $::trove::qpid_username; - 'DEFAULT/qpid_password': value => $::trove::qpid_password, secret => true; - 'DEFAULT/qpid_heartbeat': value => $::trove::qpid_heartbeat; - 'DEFAULT/qpid_protocol': value => $::trove::qpid_protocol; - 'DEFAULT/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay; + 'oslo_messaging_qpid/qpid_hostname': value => $::trove::qpid_hostname; + 'oslo_messaging_qpid/qpid_port': value => $::trove::qpid_port; + 'oslo_messaging_qpid/qpid_username': value => $::trove::qpid_username; + 'oslo_messaging_qpid/qpid_password': value => $::trove::qpid_password, secret => true; + 'oslo_messaging_qpid/qpid_heartbeat': value => $::trove::qpid_heartbeat; + 'oslo_messaging_qpid/qpid_protocol': value => $::trove::qpid_protocol; + 'oslo_messaging_qpid/qpid_tcp_nodelay': value => $::trove::qpid_tcp_nodelay; } if is_array($::trove::qpid_sasl_mechanisms) { trove_taskmanager_config { - 'DEFAULT/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' '); + 'oslo_messaging_qpid/qpid_sasl_mechanisms': value => join($::trove::qpid_sasl_mechanisms, ' '); } } } @@ -198,28 +248,28 @@ class trove::taskmanager( trove_config { 'DEFAULT/network_label_regex': value => '.*'; 'DEFAULT/network_driver': value => 'trove.network.neutron.NeutronDriver'; + 'DEFAULT/default_neutron_networks': value => $default_neutron_networks; } trove_taskmanager_config { 'DEFAULT/network_label_regex': value => '.*'; 'DEFAULT/network_driver': value => 'trove.network.neutron.NeutronDriver'; + 'DEFAULT/default_neutron_networks': value => $default_neutron_networks; } } else { trove_config { 'DEFAULT/network_label_regex': value => '^private$'; 'DEFAULT/network_driver': value => 'trove.network.nova.NovaNetwork'; + 'DEFAULT/default_neutron_networks': ensure => absent; } trove_taskmanager_config { 'DEFAULT/network_label_regex': value => '^private$'; 'DEFAULT/network_driver': value => 'trove.network.nova.NovaNetwork'; + 'DEFAULT/default_neutron_networks': ensure => absent; } } - trove_config { - 'DEFAULT/taskmanager_queue': value => 'taskmanager'; - } - # Logging if $log_file { trove_taskmanager_config { @@ -261,9 +311,13 @@ class trove::taskmanager( ensure_package => $ensure_package, } + # (shaikapsar): Remove ::trove::guestagent declaraion from here. if $guestagent_config_file { - file { $guestagent_config_file: - content => template('trove/trove-guestagent.conf.erb') + if $use_guestagent_template { + file { $guestagent_config_file: + content => template('trove/trove-guestagent.conf.erb'), + require => Package[$::trove::params::taskmanager_package_name] + } } trove_taskmanager_config { @@ -278,4 +332,9 @@ class trove::taskmanager( 'DEFAULT/exists_notification_transformer': ensure => absent, } } + + trove_taskmanager_config { + 'DEFAULT/use_nova_server_config_drive': value => true, + } + } diff --git a/deployment_scripts/puppet/modules/trove/metadata.json b/deployment_scripts/puppet/modules/trove/metadata.json index e8cd79b..06c5b0f 100644 --- a/deployment_scripts/puppet/modules/trove/metadata.json +++ b/deployment_scripts/puppet/modules/trove/metadata.json @@ -1,6 +1,6 @@ { "name": "openstack-trove", - "version": "6.1.0", + "version": "7.1.0", "author": "eNovance and OpenStack Contributors", "summary": "Puppet module for OpenStack Trove", "license": "Apache-2.0", @@ -32,8 +32,8 @@ "description": "Installs and configures OpenStack Trove (Database service).", "dependencies": [ { "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" }, - { "name": "openstack/keystone", "version_requirement": ">=6.0.0 <7.0.0" }, + { "name": "openstack/keystone", "version_requirement": ">=7.1.0 <8.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" }, - { "name": "openstack/openstacklib", "version_requirement": ">=6.0.0 <7.0.0" } + { "name": "openstack/openstacklib", "version_requirement": ">=7.1.0 <8.0.0" } ] } diff --git a/deployment_scripts/puppet/modules/trove/other-requirements.txt b/deployment_scripts/puppet/modules/trove/other-requirements.txt new file mode 100644 index 0000000..e69de29 diff --git a/deployment_scripts/puppet/modules/trove/spec/acceptance/basic_trove_spec.rb b/deployment_scripts/puppet/modules/trove/spec/acceptance/basic_trove_spec.rb index ac31614..c51fcec 100644 --- a/deployment_scripts/puppet/modules/trove/spec/acceptance/basic_trove_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/acceptance/basic_trove_spec.rb @@ -6,41 +6,11 @@ describe 'basic trove' do it 'should work with no errors' do pp= <<-EOS - Exec { logoutput => 'on_failure' } - - # Common resources - case $::osfamily { - 'Debian': { - include ::apt - class { '::openstack_extras::repo::debian::ubuntu': - release => 'kilo', - package_require => true, - } - $package_provider = 'apt' - } - 'RedHat': { - class { '::openstack_extras::repo::redhat::redhat': - release => 'kilo', - } - package { 'openstack-selinux': ensure => 'latest' } - $package_provider = 'yum' - } - default: { - fail("Unsupported osfamily (${::osfamily})") - } - } - - class { '::mysql::server': } - - class { '::rabbitmq': - delete_guest_user => true, - package_provider => $package_provider, - } - - rabbitmq_vhost { '/': - provider => 'rabbitmqctl', - require => Class['rabbitmq'], - } + include ::openstack_integration + include ::openstack_integration::repos + include ::openstack_integration::rabbitmq + include ::openstack_integration::mysql + include ::openstack_integration::keystone rabbitmq_user { 'trove': admin => true, @@ -57,29 +27,9 @@ describe 'basic trove' do require => Class['rabbitmq'], } - # Keystone resources, needed by Trove to run - class { '::keystone::db::mysql': - password => 'keystone', - } - class { '::keystone': - verbose => true, - debug => true, - database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone', - admin_token => 'admin_token', - enabled => true, - } - class { '::keystone::roles::admin': - email => 'test@example.tld', - password => 'a_big_secret', - } - class { '::keystone::endpoint': - public_url => "https://${::fqdn}:5000/", - admin_url => "https://${::fqdn}:35357/", - } - # Trove resources class { '::trove': - database_connection => 'mysql://trove:a_big_secret@127.0.0.1/trove?charset=utf8', + database_connection => 'mysql+pymysql://trove:a_big_secret@127.0.0.1/trove?charset=utf8', rabbit_userid => 'trove', rabbit_password => 'an_even_bigger_secret', rabbit_host => '127.0.0.1', @@ -94,10 +44,19 @@ describe 'basic trove' do class { '::trove::api': keystone_password => 'a_big_secret', auth_url => 'http://127.0.0.1:35357/', + debug => true, + verbose => true, } class { '::trove::client': } - class { '::trove::conductor': } - class { '::trove::taskmanager': } + class { '::trove::conductor': + debug => true, + verbose => true, + } + class { '::trove::taskmanager': + debug => true, + verbose => true, + } + class { '::trove::quota': } EOS diff --git a/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/centos-70-x64.yml b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/centos-70-x64.yml new file mode 100644 index 0000000..5f097e9 --- /dev/null +++ b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/centos-70-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-server-70-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.0-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/centos-7.0-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/default.yml b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/default.yml index a2c1ecc..486b6a3 100644 --- a/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/default.yml +++ b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/default.yml @@ -1,9 +1,10 @@ HOSTS: - ubuntu-14.04-amd64: + ubuntu-server-14.04-amd64: roles: - master platform: ubuntu-14.04-amd64 - hypervisor : none - ip: 127.0.0.1 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant CONFIG: type: foss diff --git a/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-centos7.yml b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-centos7.yml index 575ae67..c552874 100644 --- a/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-centos7.yml +++ b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-centos7.yml @@ -3,7 +3,7 @@ HOSTS: roles: - master platform: el-7-x86_64 - hypervisor : none + hypervisor: none ip: 127.0.0.1 CONFIG: type: foss diff --git a/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-trusty.yml b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-trusty.yml index a95d9f3..9fc624e 100644 --- a/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-trusty.yml +++ b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/nodepool-trusty.yml @@ -3,7 +3,7 @@ HOSTS: roles: - master platform: ubuntu-14.04-amd64 - hypervisor : none + hypervisor: none ip: 127.0.0.1 CONFIG: type: foss diff --git a/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml new file mode 100644 index 0000000..8001929 --- /dev/null +++ b/deployment_scripts/puppet/modules/trove/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: foss diff --git a/deployment_scripts/puppet/modules/trove/spec/classes/trove_api_spec.rb b/deployment_scripts/puppet/modules/trove/spec/classes/trove_api_spec.rb index 148c925..c92a0b6 100644 --- a/deployment_scripts/puppet/modules/trove/spec/classes/trove_api_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/classes/trove_api_spec.rb @@ -38,7 +38,13 @@ describe 'trove::api' do let :pre_condition do "class { 'trove': - nova_proxy_admin_pass => 'verysecrete'}" + nova_proxy_admin_pass => 'verysecrete', + os_region_name => 'RegionOne', + nova_compute_service_type => 'compute', + cinder_service_type => 'volume', + swift_service_type => 'object-store', + heat_service_type => 'orchestration', + neutron_service_type => 'network'}" end it 'installs trove-api package and service' do @@ -72,6 +78,38 @@ describe 'trove::api' do is_expected.to contain_trove_config('keystone_authtoken/admin_tenant_name').with_value('_services_') is_expected.to contain_trove_config('keystone_authtoken/admin_user').with_value('trove') is_expected.to contain_trove_config('keystone_authtoken/admin_password').with_value('passw0rd') + is_expected.to contain_trove_config('DEFAULT/os_region_name').with_value('RegionOne') + is_expected.to contain_trove_config('DEFAULT/nova_compute_service_type').with_value('compute') + is_expected.to contain_trove_config('DEFAULT/cinder_service_type').with_value('volume') + is_expected.to contain_trove_config('DEFAULT/swift_service_type').with_value('object-store') + is_expected.to contain_trove_config('DEFAULT/heat_service_type').with_value('orchestration') + is_expected.to contain_trove_config('DEFAULT/neutron_service_type').with_value('network') + is_expected.to contain_trove_config('DEFAULT/http_get_rate').with_value('200') + is_expected.to contain_trove_config('DEFAULT/http_post_rate').with_value('200') + is_expected.to contain_trove_config('DEFAULT/http_put_rate').with_value('200') + is_expected.to contain_trove_config('DEFAULT/http_delete_rate').with_value('200') + is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('200') + end + + + context 'with overridden rate limit parameters' do + before :each do + params.merge!( + :http_get_rate => '1000', + :http_post_rate => '1000', + :http_put_rate => '1000', + :http_delete_rate => '1000', + :http_mgmt_post_rate => '2000', + ) + end + + it 'contains overrided rate limit values' do + is_expected.to contain_trove_config('DEFAULT/http_get_rate').with_value('1000') + is_expected.to contain_trove_config('DEFAULT/http_post_rate').with_value('1000') + is_expected.to contain_trove_config('DEFAULT/http_put_rate').with_value('1000') + is_expected.to contain_trove_config('DEFAULT/http_delete_rate').with_value('1000') + is_expected.to contain_trove_config('DEFAULT/http_mgmt_post_rate').with_value('2000') + end end context 'when using a single RabbitMQ server' do @@ -82,6 +120,23 @@ describe 'trove::api' do end it 'configures trove-api with RabbitMQ' do is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1') + is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') + is_expected.to contain_trove_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') + end + end + + context 'when using a single RabbitMQ server with enable ha options' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rabbit_ha_queues => 'true', + amqp_durable_queues => 'true', + rabbit_host => '10.0.0.1'}" + end + it 'configures trove-api with RabbitMQ' do + is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1') + is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') + is_expected.to contain_trove_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') end end @@ -93,19 +148,47 @@ describe 'trove::api' do end it 'configures trove-api with RabbitMQ' do is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2']) + is_expected.to contain_trove_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') end end - context 'when using MySQL' do + context 'when using qpid' do let :pre_condition do "class { 'trove': nova_proxy_admin_pass => 'verysecrete', - database_connection => 'mysql://trove:pass@10.0.0.1/trove'}" + rpc_backend => 'qpid', + qpid_hostname => '10.0.0.1', + qpid_username => 'guest', + qpid_password => 'password'}" end - it 'configures trove-api with RabbitMQ' do - is_expected.to contain_trove_config('database/connection').with_value('mysql://trove:pass@10.0.0.1/trove') + it 'configures trove-api with qpid' do + is_expected.to contain_trove_config('DEFAULT/rpc_backend').with_value('qpid') + is_expected.to contain_trove_config('oslo_messaging_qpid/qpid_hostname').with_value('10.0.0.1') + is_expected.to contain_trove_config('oslo_messaging_qpid/qpid_username').with_value('guest') + is_expected.to contain_trove_config('oslo_messaging_qpid/qpid_password').with_value('password') + is_expected.to contain_trove_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') end end + + context 'when using qpid with SSL enabled' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rpc_backend => 'qpid', + qpid_hostname => '10.0.0.1', + qpid_username => 'guest', + qpid_password => 'password', + qpid_protocol => 'ssl'}" + end + it 'configures trove-api with qpid' do + is_expected.to contain_trove_config('DEFAULT/rpc_backend').with_value('qpid') + is_expected.to contain_trove_config('oslo_messaging_qpid/qpid_hostname').with_value('10.0.0.1') + is_expected.to contain_trove_config('oslo_messaging_qpid/qpid_username').with_value('guest') + is_expected.to contain_trove_config('oslo_messaging_qpid/qpid_password').with_value('password') + is_expected.to contain_trove_config('oslo_messaging_qpid/qpid_protocol').with_value('ssl') + end + end + end context 'with SSL enabled with kombu' do diff --git a/deployment_scripts/puppet/modules/trove/spec/classes/trove_conductor_spec.rb b/deployment_scripts/puppet/modules/trove/spec/classes/trove_conductor_spec.rb index 1414e77..a945949 100644 --- a/deployment_scripts/puppet/modules/trove/spec/classes/trove_conductor_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/classes/trove_conductor_spec.rb @@ -41,6 +41,23 @@ describe 'trove::conductor' do end it 'configures trove-conductor with RabbitMQ' do is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1') + is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') + is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') + end + end + + context 'when using a single RabbitMQ server with enable ha options' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rabbit_ha_queues => 'true', + amqp_durable_queues => 'true', + rabbit_host => '10.0.0.1'}" + end + it 'configures trove-api with RabbitMQ' do + is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1') + is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') + is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') end end @@ -52,6 +69,44 @@ describe 'trove::conductor' do end it 'configures trove-conductor with RabbitMQ' do is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2']) + is_expected.to contain_trove_conductor_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') + end + end + + context 'when using qpid' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rpc_backend => 'qpid', + qpid_hostname => '10.0.0.1', + qpid_username => 'guest', + qpid_password => 'password'}" + end + it 'configures trove-conductor with qpid' do + is_expected.to contain_trove_conductor_config('DEFAULT/rpc_backend').with_value('qpid') + is_expected.to contain_trove_conductor_config('oslo_messaging_qpid/qpid_hostname').with_value('10.0.0.1') + is_expected.to contain_trove_conductor_config('oslo_messaging_qpid/qpid_username').with_value('guest') + is_expected.to contain_trove_conductor_config('oslo_messaging_qpid/qpid_password').with_value('password') + is_expected.to contain_trove_conductor_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') + end + end + + context 'when using qpid with SSL enabled' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rpc_backend => 'qpid', + qpid_hostname => '10.0.0.1', + qpid_username => 'guest', + qpid_password => 'password', + qpid_protocol => 'ssl'}" + end + it 'configures trove-conductor with qpid' do + is_expected.to contain_trove_conductor_config('DEFAULT/rpc_backend').with_value('qpid') + is_expected.to contain_trove_conductor_config('oslo_messaging_qpid/qpid_hostname').with_value('10.0.0.1') + is_expected.to contain_trove_conductor_config('oslo_messaging_qpid/qpid_username').with_value('guest') + is_expected.to contain_trove_conductor_config('oslo_messaging_qpid/qpid_password').with_value('password') + is_expected.to contain_trove_conductor_config('oslo_messaging_qpid/qpid_protocol').with_value('ssl') end end diff --git a/deployment_scripts/puppet/modules/trove/spec/classes/trove_db_spec.rb b/deployment_scripts/puppet/modules/trove/spec/classes/trove_db_spec.rb new file mode 100644 index 0000000..f8d277c --- /dev/null +++ b/deployment_scripts/puppet/modules/trove/spec/classes/trove_db_spec.rb @@ -0,0 +1,119 @@ +require 'spec_helper' + +describe 'trove::db' do + + shared_examples 'trove::db' do + + context 'with default parameters' do + + it { is_expected.to contain_trove_config('database/connection').with_value('sqlite:////var/lib/trove/trove.sqlite').with_secret(true) } + it { is_expected.to contain_trove_config('database/idle_timeout').with_value('3600') } + it { is_expected.to contain_trove_config('database/min_pool_size').with_value('1') } + it { is_expected.to contain_trove_config('database/max_pool_size').with_value('10') } + it { is_expected.to contain_trove_config('database/max_overflow').with_value('20') } + it { is_expected.to contain_trove_config('database/max_retries').with_value('10') } + it { is_expected.to contain_trove_config('database/retry_interval').with_value('10') } + + end + + context 'with specific parameters' do + let :params do + { :database_connection => 'mysql+pymysql://trove:trove@localhost/trove', + :database_idle_timeout => '3601', + :database_min_pool_size => '2', + :database_max_pool_size => '21', + :database_max_retries => '11', + :database_max_overflow => '21', + :database_retry_interval => '11', } + end + + it { is_expected.to contain_trove_config('database/connection').with_value('mysql+pymysql://trove:trove@localhost/trove').with_secret(true) } + it { is_expected.to contain_trove_config('database/idle_timeout').with_value('3601') } + it { is_expected.to contain_trove_config('database/min_pool_size').with_value('2') } + it { is_expected.to contain_trove_config('database/max_retries').with_value('11') } + it { is_expected.to contain_trove_config('database/max_pool_size').with_value('21') } + it { is_expected.to contain_trove_config('database/max_overflow').with_value('21') } + it { is_expected.to contain_trove_config('database/retry_interval').with_value('11') } + end + + context 'with MySQL-python library as backend package' do + let :params do + { :database_connection => 'mysql://trove:trove@localhost/trove', } + end + + it { is_expected.to contain_package('python-mysqldb').with(:ensure => 'present') } + end + + context 'with postgresql backend' do + let :params do + { :database_connection => 'postgresql://trove:trove@localhost/trove', } + end + + it 'install the proper backend package' do + is_expected.to contain_package('python-psycopg2').with(:ensure => 'present') + end + + end + + context 'with incorrect database_connection string' do + let :params do + { :database_connection => 'redis://trove:trove@localhost/trove', } + end + + it_raises 'a Puppet::Error', /validate_re/ + end + + context 'with incorrect pymysql database_connection string' do + let :params do + { :database_connection => 'foo+pymysql://trove:trove@localhost/trove', } + end + + it_raises 'a Puppet::Error', /validate_re/ + end + + end + + context 'on Debian platforms' do + let :facts do + { :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => 'jessie', + } + end + + it_configures 'trove::db' + + context 'using pymysql driver' do + let :params do + { :database_connection => 'mysql+pymysql://trove:trove@localhost/trove', } + end + + it 'install the proper backend package' do + is_expected.to contain_package('trove-backend-package').with( + :ensure => 'present', + :name => 'python-pymysql', + :tag => 'openstack' + ) + end + end + end + + context 'on Redhat platforms' do + let :facts do + { :osfamily => 'RedHat', + :operatingsystemrelease => '7.1', + } + end + + it_configures 'trove::db' + + context 'using pymysql driver' do + let :params do + { :database_connection => 'mysql+pymysql://trove:trove@localhost/trove', } + end + + it { is_expected.not_to contain_package('trove-backend-package') } + end + end + +end diff --git a/deployment_scripts/puppet/modules/trove/spec/classes/trove_guestagent_spec.rb b/deployment_scripts/puppet/modules/trove/spec/classes/trove_guestagent_spec.rb index f142b83..c72498c 100644 --- a/deployment_scripts/puppet/modules/trove/spec/classes/trove_guestagent_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/classes/trove_guestagent_spec.rb @@ -8,6 +8,7 @@ describe 'trove::guestagent' do let :pre_condition do "class { 'trove': + os_region_name => 'RegionOne', nova_proxy_admin_pass => 'verysecrete'}" end @@ -28,9 +29,11 @@ describe 'trove::guestagent' do it 'configures trove-guestagent with default parameters' do is_expected.to contain_trove_guestagent_config('DEFAULT/verbose').with_value(false) is_expected.to contain_trove_guestagent_config('DEFAULT/debug').with_value(false) - is_expected.to contain_trove_guestagent_config('DEFAULT/nova_proxy_admin_user').with_value('admin') - is_expected.to contain_trove_guestagent_config('DEFAULT/nova_proxy_admin_pass').with_value('verysecrete') - is_expected.to contain_trove_guestagent_config('DEFAULT/nova_proxy_admin_tenant_name').with_value('admin') + is_expected.to contain_trove_guestagent_config('DEFAULT/os_region_name').with_value('RegionOne') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_hosts').with_value(false) + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value(false) end context 'when using a single RabbitMQ server' do @@ -41,6 +44,23 @@ describe 'trove::guestagent' do end it 'configures trove-guestagent with RabbitMQ' do is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') + end + end + + context 'when using a single RabbitMQ server with enable ha options' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rabbit_ha_queues => 'true', + amqp_durable_queues => 'true', + rabbit_host => '10.0.0.1'}" + end + it 'configures trove-api with RabbitMQ' do + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') end end @@ -52,6 +72,44 @@ describe 'trove::guestagent' do end it 'configures trove-guestagent with RabbitMQ' do is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2']) + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') + end + end + + context 'when using qpid' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rpc_backend => 'qpid', + qpid_hostname => '10.0.0.1', + qpid_username => 'guest', + qpid_password => 'password'}" + end + it 'configures trove-guestagent with qpid' do + is_expected.to contain_trove_guestagent_config('DEFAULT/rpc_backend').with_value('qpid') + is_expected.to contain_trove_guestagent_config('oslo_messaging_qpid/qpid_hostname').with_value('10.0.0.1') + is_expected.to contain_trove_guestagent_config('oslo_messaging_qpid/qpid_username').with_value('guest') + is_expected.to contain_trove_guestagent_config('oslo_messaging_qpid/qpid_password').with_value('password') + is_expected.to contain_trove_guestagent_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') + end + end + + context 'when using qpid with SSL enabled' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rpc_backend => 'qpid', + qpid_hostname => '10.0.0.1', + qpid_username => 'guest', + qpid_password => 'password', + qpid_protocol => 'ssl'}" + end + it 'configures trove-guestagent with qpid' do + is_expected.to contain_trove_guestagent_config('DEFAULT/rpc_backend').with_value('qpid') + is_expected.to contain_trove_guestagent_config('oslo_messaging_qpid/qpid_hostname').with_value('10.0.0.1') + is_expected.to contain_trove_guestagent_config('oslo_messaging_qpid/qpid_username').with_value('guest') + is_expected.to contain_trove_guestagent_config('oslo_messaging_qpid/qpid_password').with_value('password') + is_expected.to contain_trove_guestagent_config('oslo_messaging_qpid/qpid_protocol').with_value('ssl') end end end @@ -64,11 +122,17 @@ describe 'trove::guestagent' do let :params do { :auth_url => "http://10.0.0.1:5000/v2.0", - :swift_url => "http://10.0.0.1:8080/v1/AUTH_" } + :swift_url => "http://10.0.0.1:8080/v1/AUTH_", + :rabbit_host => '10.1.0.1', + :rabbit_port => '5673', + :rabbit_use_ssl => 'true'} end it 'configures trove-guestagent with custom parameters' do is_expected.to contain_trove_guestagent_config('DEFAULT/trove_auth_url').with_value('http://10.0.0.1:5000/v2.0') is_expected.to contain_trove_guestagent_config('DEFAULT/swift_url').with_value('http://10.0.0.1:8080/v1/AUTH_') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_host').with_value('10.1.0.1') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') + is_expected.to contain_trove_guestagent_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true') end end diff --git a/deployment_scripts/puppet/modules/trove/spec/classes/trove_init_spec.rb b/deployment_scripts/puppet/modules/trove/spec/classes/trove_init_spec.rb index a5d625f..39b7357 100644 --- a/deployment_scripts/puppet/modules/trove/spec/classes/trove_init_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/classes/trove_init_spec.rb @@ -23,10 +23,12 @@ require 'spec_helper' describe 'trove' do let :params do - { :nova_proxy_admin_pass => 'passw0rd', - :nova_compute_url => 'http://localhost:8774/v2', - :cinder_url => 'http://localhost:8776/v1', - :swift_url => 'http://localhost:8080/v1/AUTH_' } + { :nova_proxy_admin_pass => 'passw0rd', + :nova_compute_url => 'http://localhost:8774/v2', + :cinder_url => 'http://localhost:8776/v1', + :swift_url => 'http://localhost:8080/v1/AUTH_', + :neutron_url => 'http://localhost:9696/', + } end shared_examples_for 'trove' do @@ -37,6 +39,7 @@ describe 'trove' do is_expected.to contain_trove_config('DEFAULT/nova_compute_url').with_value('http://localhost:8774/v2') is_expected.to contain_trove_config('DEFAULT/cinder_url').with_value('http://localhost:8776/v1') is_expected.to contain_trove_config('DEFAULT/swift_url').with_value('http://localhost:8080/v1/AUTH_') + is_expected.to contain_trove_config('DEFAULT/neutron_url').with_value('http://localhost:9696/') } end end @@ -55,9 +58,10 @@ describe 'trove' do end it 'installs common package' do - should contain_package('trove').with( + is_expected.to contain_package('trove').with( :name => 'openstack-trove', :ensure => 'present', + :tag => ['openstack', 'trove-package'], ) end diff --git a/deployment_scripts/puppet/modules/trove/spec/classes/trove_keystone_auth_spec.rb b/deployment_scripts/puppet/modules/trove/spec/classes/trove_keystone_auth_spec.rb index dde648f..4b26c5e 100644 --- a/deployment_scripts/puppet/modules/trove/spec/classes/trove_keystone_auth_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/classes/trove_keystone_auth_spec.rb @@ -35,7 +35,6 @@ describe 'trove::keystone::auth' do it { is_expected.to contain_keystone_user('trove').with( :ensure => 'present', :password => 'trove_password', - :tenant => 'foobar' ) } it { is_expected.to contain_keystone_user_role('trove@foobar').with( @@ -43,13 +42,12 @@ describe 'trove::keystone::auth' do :roles => ['admin'] )} - it { is_expected.to contain_keystone_service('trove').with( + it { is_expected.to contain_keystone_service('trove::database').with( :ensure => 'present', - :type => 'database', :description => 'Trove Database Service' ) } - it { is_expected.to contain_keystone_endpoint('RegionOne/trove').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/trove::database').with( :ensure => 'present', :public_url => "http://127.0.0.1:8779/v1.0/%(tenant_id)s", :admin_url => "http://127.0.0.1:8779/v1.0/%(tenant_id)s", @@ -76,7 +74,7 @@ describe 'trove::keystone::auth' do :admin_url => 'http://10.10.10.12:81/v1.0/%(tenant_id)s' } end - it { is_expected.to contain_keystone_endpoint('RegionOne/trove').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/trove::database').with( :ensure => 'present', :public_url => 'https://10.10.10.10:80/v1.0/%(tenant_id)s', :internal_url => 'http://10.10.10.11:81/v1.0/%(tenant_id)s', @@ -97,7 +95,7 @@ describe 'trove::keystone::auth' do :admin_address => '10.10.10.12' } end - it { is_expected.to contain_keystone_endpoint('RegionOne/trove').with( + it { is_expected.to contain_keystone_endpoint('RegionOne/trove::database').with( :ensure => 'present', :public_url => 'https://10.10.10.10:80/v1.0/%(tenant_id)s', :internal_url => 'https://10.10.10.11:81/v1.0/%(tenant_id)s', @@ -113,8 +111,8 @@ describe 'trove::keystone::auth' do it { is_expected.to contain_keystone_user('trovey') } it { is_expected.to contain_keystone_user_role('trovey@services') } - it { is_expected.to contain_keystone_service('trovey') } - it { is_expected.to contain_keystone_endpoint('RegionOne/trovey') } + it { is_expected.to contain_keystone_service('trovey::database') } + it { is_expected.to contain_keystone_endpoint('RegionOne/trovey::database') } end describe 'when overriding service name' do @@ -126,8 +124,8 @@ describe 'trove::keystone::auth' do it { is_expected.to contain_keystone_user('trove') } it { is_expected.to contain_keystone_user_role('trove@services') } - it { is_expected.to contain_keystone_service('trove_service') } - it { is_expected.to contain_keystone_endpoint('RegionOne/trove_service') } + it { is_expected.to contain_keystone_service('trove_service::database') } + it { is_expected.to contain_keystone_endpoint('RegionOne/trove_service::database') } end describe 'when disabling endpoint configuration' do @@ -136,6 +134,6 @@ describe 'trove::keystone::auth' do :password => 'trove_password' } end - it { is_expected.to_not contain_keystone_endpoint('RegionOne/neutron') } + it { is_expected.to_not contain_keystone_endpoint('RegionOne/neutron::database') } end end diff --git a/deployment_scripts/puppet/modules/trove/spec/classes/trove_quota_spec.rb b/deployment_scripts/puppet/modules/trove/spec/classes/trove_quota_spec.rb new file mode 100644 index 0000000..83f82ef --- /dev/null +++ b/deployment_scripts/puppet/modules/trove/spec/classes/trove_quota_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +describe 'trove::quota' do + + describe 'with default parameters' do + it 'contains default values' do + is_expected.to contain_trove_config('DEFAULT/max_instances_per_user').with( + :value => 5) + is_expected.to contain_trove_config('DEFAULT/max_accepted_volume_size').with( + :value => 5) + is_expected.to contain_trove_config('DEFAULT/max_volumes_per_user').with( + :value => 20) + is_expected.to contain_trove_config('DEFAULT/max_backups_per_user').with( + :value => 50) + is_expected.to contain_trove_config('DEFAULT/quota_driver').with( + :value => 'trove.quota.quota.DbQuotaDriver') + end + end + + describe 'with overridden parameters' do + let :params do + { :max_instances_per_user => 10, + :max_accepted_volume_size => 10, + :max_volumes_per_user => 100, + :max_backups_per_user => 100, + } + end + it 'contains overrided values' do + is_expected.to contain_trove_config('DEFAULT/max_instances_per_user').with( + :value => 10) + is_expected.to contain_trove_config('DEFAULT/max_accepted_volume_size').with( + :value => 10) + is_expected.to contain_trove_config('DEFAULT/max_volumes_per_user').with( + :value => 100) + is_expected.to contain_trove_config('DEFAULT/max_backups_per_user').with( + :value => 100) + end + end +end diff --git a/deployment_scripts/puppet/modules/trove/spec/classes/trove_taskmanager_spec.rb b/deployment_scripts/puppet/modules/trove/spec/classes/trove_taskmanager_spec.rb index 09e4303..4760872 100644 --- a/deployment_scripts/puppet/modules/trove/spec/classes/trove_taskmanager_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/classes/trove_taskmanager_spec.rb @@ -27,7 +27,13 @@ describe 'trove::taskmanager' do let :pre_condition do "class { 'trove': - nova_proxy_admin_pass => 'verysecrete'}" + nova_proxy_admin_pass => 'verysecrete', + os_region_name => 'RegionOne', + nova_compute_service_type => 'compute', + cinder_service_type => 'volume', + swift_service_type => 'object-store', + heat_service_type => 'orchestration', + neutron_service_type => 'network'}" end it 'installs trove-taskmanager package and service' do @@ -50,6 +56,31 @@ describe 'trove::taskmanager' do is_expected.to contain_trove_taskmanager_config('DEFAULT/nova_proxy_admin_user').with_value('admin') is_expected.to contain_trove_taskmanager_config('DEFAULT/nova_proxy_admin_pass').with_value('verysecrete') is_expected.to contain_trove_taskmanager_config('DEFAULT/nova_proxy_admin_tenant_name').with_value('admin') + is_expected.to contain_trove_taskmanager_config('DEFAULT/default_neutron_networks').with_value(nil) + is_expected.to contain_trove_config('DEFAULT/default_neutron_networks').with_value(nil) + is_expected.to contain_trove_taskmanager_config('DEFAULT/os_region_name').with_value('RegionOne') + is_expected.to contain_trove_taskmanager_config('DEFAULT/nova_compute_service_type').with_value('compute') + is_expected.to contain_trove_taskmanager_config('DEFAULT/cinder_service_type').with_value('volume') + is_expected.to contain_trove_taskmanager_config('DEFAULT/swift_service_type').with_value('object-store') + is_expected.to contain_trove_taskmanager_config('DEFAULT/heat_service_type').with_value('orchestration') + is_expected.to contain_trove_taskmanager_config('DEFAULT/neutron_service_type').with_value('network') + is_expected.to contain_trove_config('DEFAULT/taskmanager_queue').with_value('taskmanager') + is_expected.to contain_file('/etc/trove/trove-guestagent.conf') + end + + context 'when set use_guestagent_template to false' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete',} + class { 'trove::taskmanager': + use_guestagent_template => false,}" + end + it 'configures trove-taskmanager with trove::guestagent' do + is_expected.to contain_class('trove::guestagent').with( + :enabled => false, + :manage_service => false, + ) + end end context 'when using a single RabbitMQ server' do @@ -60,6 +91,23 @@ describe 'trove::taskmanager' do end it 'configures trove-taskmanager with RabbitMQ' do is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') + end + end + + context 'when using a single RabbitMQ server with enable ha options' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rabbit_ha_queues => 'true', + amqp_durable_queues => 'true' + rabbit_host => '10.0.0.1'}" + end + it 'configures trove-api with RabbitMQ' do + is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_host').with_value('10.0.0.1') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') end end @@ -71,6 +119,44 @@ describe 'trove::taskmanager' do end it 'configures trove-taskmanager with RabbitMQ' do is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_hosts').with_value(['10.0.0.1,10.0.0.2']) + is_expected.to contain_trove_taskmanager_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') + end + end + + context 'when using qpid' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rpc_backend => 'qpid', + qpid_hostname => '10.0.0.1', + qpid_username => 'guest', + qpid_password => 'password'}" + end + it 'configures trove-taskmanager with qpid' do + is_expected.to contain_trove_taskmanager_config('DEFAULT/rpc_backend').with_value('qpid') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_qpid/qpid_hostname').with_value('10.0.0.1') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_qpid/qpid_username').with_value('guest') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_qpid/qpid_password').with_value('password') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') + end + end + + context 'when using qpid with SSL enabled' do + let :pre_condition do + "class { 'trove': + nova_proxy_admin_pass => 'verysecrete', + rpc_backend => 'qpid', + qpid_hostname => '10.0.0.1', + qpid_username => 'guest', + qpid_password => 'password', + qpid_protocol => 'ssl'}" + end + it 'configures trove-taskmanager with qpid' do + is_expected.to contain_trove_taskmanager_config('DEFAULT/rpc_backend').with_value('qpid') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_qpid/qpid_hostname').with_value('10.0.0.1') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_qpid/qpid_username').with_value('guest') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_qpid/qpid_password').with_value('password') + is_expected.to contain_trove_taskmanager_config('oslo_messaging_qpid/qpid_protocol').with_value('ssl') end end @@ -88,12 +174,18 @@ describe 'trove::taskmanager' do context 'when using Neutron' do let :pre_condition do "class { 'trove': - nova_proxy_admin_pass => 'verysecrete', - use_neutron => true}" + nova_proxy_admin_pass => 'verysecrete', + use_neutron => true} + class { 'trove::taskmanager': + default_neutron_networks => 'trove_service', + } + " end it 'configures trove to use the Neutron network driver' do + is_expected.to contain_trove_config('DEFAULT/default_neutron_networks').with_value('trove_service') + is_expected.to contain_trove_taskmanager_config('DEFAULT/default_neutron_networks').with_value('trove_service') is_expected.to contain_trove_config('DEFAULT/network_driver').with_value('trove.network.neutron.NeutronDriver') is_expected.to contain_trove_taskmanager_config('DEFAULT/network_driver').with_value('trove.network.neutron.NeutronDriver') diff --git a/deployment_scripts/puppet/modules/trove/spec/shared_examples.rb b/deployment_scripts/puppet/modules/trove/spec/shared_examples.rb index db3b783..01ee5f7 100644 --- a/deployment_scripts/puppet/modules/trove/spec/shared_examples.rb +++ b/deployment_scripts/puppet/modules/trove/spec/shared_examples.rb @@ -11,13 +11,15 @@ shared_examples 'generic trove service' do |service| is_expected.to contain_package(service[:name]).with({ :name => service[:package_name], :ensure => 'present', - :notify => "Service[#{service[:name]}]" + :notify => "Service[#{service[:name]}]", + :tag => ['openstack', 'trove-package'], }) is_expected.to contain_service(service[:name]).with({ :name => service[:service_name], :ensure => 'stopped', :hasstatus => true, - :enable => false + :enable => false, + :tag => 'trove-service', }) end end @@ -32,13 +34,15 @@ shared_examples 'generic trove service' do |service| is_expected.to contain_package(service[:name]).with({ :name => service[:package_name], :ensure => '2014.1-1', - :notify => "Service[#{service[:name]}]" + :notify => "Service[#{service[:name]}]", + :tag => ['openstack', 'trove-package'], }) is_expected.to contain_service(service[:name]).with({ :name => service[:service_name], :ensure => 'running', :hasstatus => true, - :enable => true + :enable => true, + :tag => 'trove-service', }) end end diff --git a/deployment_scripts/puppet/modules/trove/spec/spec_helper.rb b/deployment_scripts/puppet/modules/trove/spec/spec_helper.rb index 53d4dd0..172614e 100644 --- a/deployment_scripts/puppet/modules/trove/spec/spec_helper.rb +++ b/deployment_scripts/puppet/modules/trove/spec/spec_helper.rb @@ -5,3 +5,5 @@ RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' end + +at_exit { RSpec::Puppet::Coverage.report! } diff --git a/deployment_scripts/puppet/modules/trove/spec/spec_helper_acceptance.rb b/deployment_scripts/puppet/modules/trove/spec/spec_helper_acceptance.rb index 144b31e..15e8cc9 100644 --- a/deployment_scripts/puppet/modules/trove/spec/spec_helper_acceptance.rb +++ b/deployment_scripts/puppet/modules/trove/spec/spec_helper_acceptance.rb @@ -38,7 +38,7 @@ RSpec.configure do |c| zuul_clone_cmd += "git://git.openstack.org #{repo}" on host, zuul_clone_cmd else - on host, "git clone -b stable/kilo https://git.openstack.org/#{repo} #{repo}" + on host, "git clone https://git.openstack.org/#{repo} -b stable/liberty #{repo}" end on host, "ZUUL_REF=#{zuul_ref} ZUUL_BRANCH=#{zuul_branch} ZUUL_URL=#{zuul_url} bash #{repo}/install_modules.sh" diff --git a/deployment_scripts/puppet/modules/trove/spec/unit/provider/trove_config/ini_setting_spec.rb b/deployment_scripts/puppet/modules/trove/spec/unit/provider/trove_config/ini_setting_spec.rb index 239dc6f..8b9fb3d 100644 --- a/deployment_scripts/puppet/modules/trove/spec/unit/provider/trove_config/ini_setting_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/unit/provider/trove_config/ini_setting_spec.rb @@ -13,6 +13,17 @@ $LOAD_PATH.push( 'inifile', 'lib') ) +$LOAD_PATH.push( + File.join( + File.dirname(__FILE__), + '..', + '..', + '..', + 'fixtures', + 'modules', + 'openstacklib', + 'lib') +) require 'spec_helper' provider_class = Puppet::Type.type(:trove_config).provider(:ini_setting) describe provider_class do @@ -34,4 +45,23 @@ describe provider_class do expect(provider.section).to eq('dude') expect(provider.setting).to eq('foo') end + + it 'should ensure absent when is specified as a value' do + resource = Puppet::Type::Trove_config.new( + {:name => 'dude/foo', :value => ''} + ) + provider = provider_class.new(resource) + provider.exists? + expect(resource[:ensure]).to eq :absent + end + + it 'should ensure absent when value matches ensure_absent_val' do + resource = Puppet::Type::Trove_config.new( + {:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' } + ) + provider = provider_class.new(resource) + provider.exists? + expect(resource[:ensure]).to eq :absent + end + end diff --git a/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_conductor_config_spec.rb b/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_conductor_config_spec.rb new file mode 100644 index 0000000..b63978a --- /dev/null +++ b/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_conductor_config_spec.rb @@ -0,0 +1,17 @@ +require 'puppet/type/trove_conductor_config' + +describe 'Puppet::Type.type(:trove_conductor_config)' do + before :each do + @trove_conductor_config = Puppet::Type.type(:trove_conductor_config).new(:name => 'DEFAULT/foo', :value => 'bar') + end + + it 'should autorequire the package that installs the file' do + catalog = Puppet::Resource::Catalog.new + package = Puppet::Type.type(:package).new(:name => 'trove-conductor') + catalog.add_resource package, @trove_conductor_config + dependency = @trove_conductor_config.autorequire + expect(dependency.size).to eq(1) + expect(dependency[0].target).to eq(@trove_conductor_config) + expect(dependency[0].source).to eq(package) + end +end diff --git a/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_conductor_guestagent_spec.rb b/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_conductor_guestagent_spec.rb new file mode 100644 index 0000000..77e1ff7 --- /dev/null +++ b/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_conductor_guestagent_spec.rb @@ -0,0 +1,17 @@ +require 'puppet/type/trove_guestagent_config' + +describe 'Puppet::Type.type(:trove_guestagent_config)' do + before :each do + @trove_guestagent_config = Puppet::Type.type(:trove_guestagent_config).new(:name => 'DEFAULT/foo', :value => 'bar') + end + + it 'should autorequire the package that installs the file' do + catalog = Puppet::Resource::Catalog.new + package = Puppet::Type.type(:package).new(:name => 'trove-guestagent') + catalog.add_resource package, @trove_guestagent_config + dependency = @trove_guestagent_config.autorequire + expect(dependency.size).to eq(1) + expect(dependency[0].target).to eq(@trove_guestagent_config) + expect(dependency[0].source).to eq(package) + end +end diff --git a/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_config_spec.rb b/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_config_spec.rb index 486d517..2df2859 100644 --- a/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_config_spec.rb +++ b/deployment_scripts/puppet/modules/trove/spec/unit/type/trove_config_spec.rb @@ -49,4 +49,14 @@ describe 'Puppet::Type.type(:trove_config)' do @trove_config[:ensure] = :latest }.to raise_error(Puppet::Error, /Invalid value/) end + + it 'should autorequire the package that installs the file' do + catalog = Puppet::Resource::Catalog.new + package = Puppet::Type.type(:package).new(:name => 'trove-api') + catalog.add_resource package, @trove_config + dependency = @trove_config.autorequire + expect(dependency.size).to eq(1) + expect(dependency[0].target).to eq(@trove_config) + expect(dependency[0].source).to eq(package) + end end diff --git a/deployment_scripts/puppet/modules/trove/templates/rabbitmq-init-centos.erb b/deployment_scripts/puppet/modules/trove/templates/rabbitmq-init-centos.erb deleted file mode 100644 index 28d7229..0000000 --- a/deployment_scripts/puppet/modules/trove/templates/rabbitmq-init-centos.erb +++ /dev/null @@ -1,182 +0,0 @@ -#!/bin/sh -# -# rabbitmq-server Trove RabbitMQ broker -# -# chkconfig: - 80 05 -# description: Enable AMQP service provided by RabbitMQ -# - -### BEGIN INIT INFO -# Provides: rabbitmq-server -# Required-Start: $remote_fs $network -# Required-Stop: $remote_fs $network -# Description: RabbitMQ broker -# Short-Description: Enable AMQP service provided by RabbitMQ broker for Trove -### END INIT INFO - -PATH="/sbin:/usr/sbin:/bin:/usr/bin" -NAME="rabbitmq-server-trove" -DAEMON="/usr/sbin/rabbitmq-server" -CONTROL="/usr/sbin/rabbitmqctl" -DESC="Trove RabbitMQ Server" -USER="rabbitmq" -ROTATE_SUFFIX=".old" - -export RABBITMQ_LOG_DIR="/var/log/rabbitmq" -export RABBITMQ_PID_FILE="/var/run/rabbitmq-trove/pid" -export RABBITMQ_CONFIG_FILE="/etc/rabbitmq/rabbitmq-trove" -export RABBITMQ_MNESIA_BASE="/var/lib/rabbitmq/mnesia-trove" -export RABBITMQ_LOG_BASE="/var/log/rabbitmq-trove" -export RABBITMQ_ENABLED_PLUGINS_FILE="/etc/rabbitmq/enabled_plugins_trove" -export RABBITMQ_NODENAME="trove@localhost" -export RABBITMQ_NODE_PORT="<%= @rabbit_port %>" -export RABBITMQ_NODE_IP_ADDRESS="0.0.0.0" - -START_PROG="runuser rabbitmq --session-command" -LOCK_FILE="/var/lock/subsys/${NAME}" - -test -x "${DAEMON}" || exit 0 -test -x "${CONTROL}" || exit 0 - -CONTROL="${CONTROL} -n ${RABBITMQ_NODENAME}" - -RETVAL="0" - -[ -f /etc/default/${NAME} ] && . /etc/default/${NAME} - -check_dir () { - mkdir -p "${1}" - chown -R "${USER}:${USER}" "${1}" - chmod "755" "${1}" -} - -ensure_dirs () { - PID_DIR=`dirname ${RABBITMQ_PID_FILE}` - check_dir "${PID_DIR}" - check_dir "${RABBITMQ_LOG_DIR}" - check_dir "${RABBITMQ_LOG_BASE}" - check_dir "${RABBITMQ_MNESIA_BASE}" -} - -remove_pid () { - rm -f "${RABBITMQ_PID_FILE}" -} - -start_rabbitmq () { - status_rabbitmq quiet - - if [ "${RETVAL}" = "0" ] ; then - echo "Trove RabbitMQ is currently running!" - RETVAL="0" - return - fi - - ensure_dirs - ${START_PROG} "${DAEMON}" 1> "${RABBITMQ_LOG_BASE}/startup_log" 2> "${RABBITMQ_LOG_BASE}/startup_err" 0<&- & - ${CONTROL} wait "${RABBITMQ_PID_FILE}" 1> "/dev/null" 2>&1 - RETVAL="${?}" - - if [ "${RETVAL}" -gt "0" ]; then - remove_pid - echo "Trove RabbitMQ start FAILED!" - RETVAL="1" - else - echo "Trove RabbitMQ start SUCCESS!" - if [ -n "${LOCK_FILE}" ]; then - touch "${LOCK_FILE}" - fi - RETVAL="0" - fi -} - -stop_rabbitmq () { - status_rabbitmq quiet - - if [ "${RETVAL}" != 0 ]; then - echo "RabbitMQ is not running!" - RETVAL="0" - return - fi - - ${CONTROL} stop "${RABBITMQ_PID_FILE}" > "${RABBITMQ_LOG_BASE}/shutdown_log" 2> "${RABBITMQ_LOG_BASE}/shutdown_err" - RETVAL="${?}" - - if [ "${RETVAL}" = "0" ] ; then - remove_pid - echo "Trove RabbitMQ stop SUCCESS!" - if [ -n "{$LOCK_FILE}" ] ; then - rm -f "${LOCK_FILE}" - fi - RETVAL="0" - else - echo "Trove RabbitMQ stop FAILED!" - RETVAL="1" - fi -} - -status_rabbitmq () { - if [ "${1}" != "quiet" ] ; then - ${CONTROL} status 2>&1 - else - ${CONTROL} status > /dev/null 2>&1 - fi - - if [ "${?}" != "0" ]; then - RETVAL="3" - fi -} - -rotate_logs_rabbitmq () { - ${CONTROL} rotate_logs "${ROTATE_SUFFIX}" - if [ $? != 0 ]; then - RETVAL="1" - fi -} - -restart_running_rabbitmq () { - status_rabbitmq quiet - - if [ "${RETVAL}" != "0" ]; then - echo "RabbitMQ is not runnning!" - exit 0 - fi - - restart_rabbitmq -} - -restart_rabbitmq () { - stop_rabbitmq - start_rabbitmq -} - -case "${1}" in - start) - echo "Starting $DESC" - start_rabbitmq - ;; - stop) - echo "Stopping $DESC" - stop_rabbitmq - ;; - status) - status_rabbitmq - ;; - rotate-logs) - echo "Rotating log files for $DESC" - rotate_logs_rabbitmq - ;; - force-reload|reload|restart) - echo "Restarting $DESC" - restart_rabbitmq - ;; - try-restart) - echo "Restarting $DESC" - restart_running_rabbitmq - ;; - *) - echo "Usage: $0 {start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload}" >&2 - exit 1 - ;; -esac - -exit "${RETVAL}" diff --git a/deployment_scripts/puppet/modules/trove/templates/rabbitmq-init-ubuntu.erb b/deployment_scripts/puppet/modules/trove/templates/rabbitmq-init-ubuntu.erb deleted file mode 100644 index 914167e..0000000 --- a/deployment_scripts/puppet/modules/trove/templates/rabbitmq-init-ubuntu.erb +++ /dev/null @@ -1,231 +0,0 @@ -#!/bin/sh -# -# rabbitmq-server Trove RabbitMQ broker -# -# chkconfig: - 80 05 -# description: Enable AMQP service provided by RabbitMQ -# - -### BEGIN INIT INFO -# Provides: rabbitmq-server -# Required-Start: $remote_fs $network -# Required-Stop: $remote_fs $network -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Description: RabbitMQ broker -# Short-Description: Enable AMQP service provided by RabbitMQ broker for Trove -### END INIT INFO - -PATH="/sbin:/usr/sbin:/bin:/usr/bin" -NAME="rabbitmq-server-trove" -DAEMON="/usr/sbin/rabbitmq-server" -CONTROL="/usr/sbin/rabbitmqctl" -DESC="Trove RabbitMQ Server" -USER="rabbitmq" -ROTATE_SUFFIX=".old" - -export RABBITMQ_LOG_DIR="/var/log/rabbitmq" -export RABBITMQ_PID_FILE="/var/run/rabbitmq-trove/pid" -export RABBITMQ_CONFIG_FILE="/etc/rabbitmq/rabbitmq-trove" -export RABBITMQ_MNESIA_BASE="/var/lib/rabbitmq/mnesia-trove" -export RABBITMQ_LOG_BASE="/var/log/rabbitmq-trove" -export RABBITMQ_ENABLED_PLUGINS_FILE="/etc/rabbitmq/enabled_plugins_trove" -export RABBITMQ_NODENAME="trove@localhost" -export RABBITMQ_NODE_PORT="<%= @rabbit_port %>" -export RABBITMQ_NODE_IP_ADDRESS="0.0.0.0" - -LOCK_DIR="/var/lock/rabbitmq" -LOCK_FILE="${LOCK_DIR}/${NAME}" -mkdir -p "${LOCK_DIR}" -chown -R "${USER}:${USER}" "${LOCK_DIR}" - -test -x "${DAEMON}" || exit 0 -test -x "${CONTROL}" || exit 0 - -CONTROL="${CONTROL} -n ${RABBITMQ_NODENAME}" - -RETVAL="0" - -[ -f /etc/default/${NAME} ] && . /etc/default/${NAME} - -check_dir () { - mkdir -p "${1}" - chown -R "${USER}:${USER}" "${1}" - chmod "755" "${1}" -} - -ensure_dirs () { - PID_DIR=`dirname ${RABBITMQ_PID_FILE}` - check_dir "${PID_DIR}" - check_dir "${RABBITMQ_LOG_DIR}" - check_dir "${RABBITMQ_LOG_BASE}" - check_dir "${RABBITMQ_MNESIA_BASE}" -} - -remove_pid () { - rm -f "${RABBITMQ_PID_FILE}" -} -##### - -c_start_rabbitmq () { - status_rabbitmq quiet - if [ $RETVAL != 0 ] ; then - #Slave nodes fail to start until master is not up and running - #So, give slaves several attempts to start - #Rabbit database will be moved out before last attempt. - local MAX_START_ATTEMPTS=3 - printf '%s\n' "RabbitMQ is going to make ${MAX_START_ATTEMPTS} \ - attempts to find master node and start." - while test $MAX_START_ATTEMPTS -ne 0 - do - RETVAL=0 - ensure_pid_dir - printf '%s\n' "${MAX_START_ATTEMPTS} attempts left to start \ - RabbitMQ Server before consider start failed." - if [ $MAX_START_ATTEMPTS = 1 ] ; then - move_out_rabbit_database_to_backup - fi - set +e - RABBITMQ_PID_FILE=$PID_FILE start-stop-daemon --quiet \ - --chuid rabbitmq --start --exec $DAEMON \ - --pidfile "$RABBITMQ_PID_FILE" --background - $CONTROL wait $PID_FILE >/dev/null 2>&1 - RETVAL=$? - set -e - if [ $RETVAL != 0 ] ; then - remove_pid - else - if [ $MAX_START_ATTEMPTS = 1 ] ; then - set_nova_rabbit_credentials - RETVAL=0 - fi - break - fi - MAX_START_ATTEMPTS=$((MAX_START_ATTEMPTS - 1)) - done - else - RETVAL=3 - fi -} -##### - -start_rabbitmq () { - status_rabbitmq quiet - - if [ "${RETVAL}" = "0" ] ; then - echo "Trove RabbitMQ is currently running!" - RETVAL="0" - return - fi - - ensure_dirs - start-stop-daemon --quiet --chuid rabbitmq \ - --start --exec "${DAEMON}" \ - --pidfile "${RABBITMQ_PID_FILE}" --background - ${CONTROL} wait "${RABBITMQ_PID_FILE}" 1> "/dev/null" 2>&1 - RETVAL="${?}" - - if [ "${RETVAL}" -gt "0" ]; then - remove_pid - echo "Trove RabbitMQ start FAILED!" - RETVAL="1" - else - echo "Trove RabbitMQ start SUCCESS!" - if [ -n "${LOCK_FILE}" ]; then - touch "${LOCK_FILE}" - fi - RETVAL="0" - fi -} - -stop_rabbitmq () { - status_rabbitmq quiet - - if [ "${RETVAL}" != 0 ]; then - echo "RabbitMQ is not running!" - RETVAL="0" - return - fi - - ${CONTROL} stop "${RABBITMQ_PID_FILE}" > "${RABBITMQ_LOG_BASE}/shutdown_log" 2> "${RABBITMQ_LOG_BASE}/shutdown_err" - RETVAL="${?}" - - if [ "${RETVAL}" = "0" ] ; then - remove_pid - echo "Trove RabbitMQ stop SUCCESS!" - if [ -n "{$LOCK_FILE}" ] ; then - rm -f "${LOCK_FILE}" - fi - RETVAL="0" - else - echo "Trove RabbitMQ stop FAILED!" - RETVAL="1" - fi -} - -status_rabbitmq () { - if [ "${1}" != "quiet" ] ; then - ${CONTROL} status 2>&1 - else - ${CONTROL} status > /dev/null 2>&1 - fi - - if [ "${?}" != "0" ]; then - RETVAL="3" - fi -} - -rotate_logs_rabbitmq () { - ${CONTROL} rotate_logs "${ROTATE_SUFFIX}" - if [ $? != 0 ]; then - RETVAL="1" - fi -} - -restart_running_rabbitmq () { - status_rabbitmq quiet - - if [ "${RETVAL}" != "0" ]; then - echo "RabbitMQ is not runnning!" - exit 0 - fi - - restart_rabbitmq -} - -restart_rabbitmq () { - stop_rabbitmq - start_rabbitmq -} - -case "${1}" in - start) - echo "Starting $DESC" - start_rabbitmq - ;; - stop) - echo "Stopping $DESC" - stop_rabbitmq - ;; - status) - status_rabbitmq - ;; - rotate-logs) - echo "Rotating log files for $DESC" - rotate_logs_rabbitmq - ;; - force-reload|reload|restart) - echo "Restarting $DESC" - restart_rabbitmq - ;; - try-restart) - echo "Restarting $DESC" - restart_running_rabbitmq - ;; - *) - echo "Usage: $0 {start|stop|status|rotate-logs|restart|condrestart|try-restart|reload|force-reload}" >&2 - exit 1 - ;; -esac - -exit "${RETVAL}" diff --git a/deployment_scripts/puppet/modules/trove/templates/rabbitmq.config.erb b/deployment_scripts/puppet/modules/trove/templates/rabbitmq.config.erb deleted file mode 100644 index f82f552..0000000 --- a/deployment_scripts/puppet/modules/trove/templates/rabbitmq.config.erb +++ /dev/null @@ -1,7 +0,0 @@ -[ -{rabbit, [{tcp_listeners, [<%= @rabbit_port %>]}]}, -{kernel,[ - {inet_dist_listen_min, <%= @rabbit_cluster_port %>}, - {inet_dist_listen_max, <%= @rabbit_cluster_port %>} -]} -]. \ No newline at end of file diff --git a/deployment_scripts/puppet/modules/trove/templates/trove-guestagent.conf.erb b/deployment_scripts/puppet/modules/trove/templates/trove-guestagent.conf.erb index 4188e07..21d1e00 100644 --- a/deployment_scripts/puppet/modules/trove/templates/trove-guestagent.conf.erb +++ b/deployment_scripts/puppet/modules/trove/templates/trove-guestagent.conf.erb @@ -1,20 +1,52 @@ [DEFAULT] + +#=========== RPC Configuration ====================== + +# URL representing the messaging driver to use and its full configuration. +# If not set, we fall back to the 'rpc_backend' option and driver specific +# configuration. +#transport_url= + +# The messaging driver to use. Options include rabbit, qpid and zmq. +# Default is rabbit. (string value) +rpc_backend= <%= @rpc_backend %> + +# The default exchange under which topics are scoped. May be +# overridden by an exchange name specified in the 'transport_url option. +control_exchange = <%= @control_exchange %> + +# ========== Sample Logging Configuration ========== + # Show more verbose log output (sets INFO log level output) verbose = <%= @verbose %> # Show debugging output in logs (sets DEBUG log level output) debug = <%= @debug %> -# Address to bind the API server -bind_host = 0.0.0.0 +# Directory and path for log files +log_dir = <%= @log_dir %> +log_file = <%= @log_file %> -# Port the bind the API server to -bind_port = 8778 +# ============ RabbitMQ connection options ======================== -# AMQP Connection info -rabbit_user=<%= @rabbit_userid %> +# The RabbitMQ broker address where a single node is used. +# (string value) +rabbit_host=<%= @rabbit_host %> + +# The RabbitMQ broker port where a single node is used. +# (integer value) +rabbit_port=<%= @rabbit_port %> + +# The RabbitMQ userid. (string value) +rabbit_userid=<%= @rabbit_userid %> + +# The RabbitMQ password. (string value) rabbit_password=<%= @rabbit_password %> +# The RabbitMQ virtual host. (string value) +rabbit_virtual_host=<%= @rabbit_virtual_host %> + + # Path to the extensions api_extensions_path = trove/extensions/routes @@ -22,16 +54,13 @@ api_extensions_path = trove/extensions/routes # These options are for an admin user in your keystone config. # It proxies the token received from the user to send to nova via this admin users creds, # basically acting like the client via that proxy token. -nova_proxy_admin_user = <%= @nova_proxy_admin_user %> -nova_proxy_admin_pass = <%= @nova_proxy_admin_pass %> -nova_proxy_admin_tenant_name = <%= @nova_proxy_admin_tenant_name %> trove_auth_url = <%= @auth_url %> -swift_url = http://localhost:8080/v1/AUTH_ +swift_url = <%= @swift_url %> # Datastore management implementations. Format datastore:manager.impl # datastore_registry_ext = mysql:trove.guestagent.datastore.mysql.manager.Manager, percona:trove.guestagent.datastore.mysql.manager.Manager -# Root configuration +# Permissions to grant "root" user by default root_grant = ALL root_grant_option = True @@ -41,21 +70,16 @@ root_grant_option = True # used by passlib to generate root password #default_password_length = 36 -# For communicating with trove-conductor -control_exchange = <%= @control_exchange %> - -# ============ kombu connection options ======================== - -rabbit_host=<%= @rabbit_host %> - -# ============ Logging information ============================= -log_dir = /tmp/ -log_file = logfile.txt - # Users to ignore for user create/list/delete operations ignore_users = os_admin + +# Databases to ignore for db create/list/delete operations ignore_dbs = lost+found, mysql, information_schema +# ========== Default Storage Options for backup ========== + +# Default configuration for storage strategy and storage options +# for backups # Strategy information for backups backup_namespace = trove.guestagent.strategies.backup.mysql_impl # Additional commandline options to be passed to the backup runner (by strategy). For example: @@ -71,3 +95,23 @@ backup_use_snet = False backup_chunk_size = 65536 backup_segment_max_size = 2147483648 +# ========== Datastore Specific Configuration Options ========== + +[mysql] + +# For mysql, the following are the defaults for backup, and restore: +# backup_strategy = InnoBackupEx +# backup_namespace = trove.guestagent.strategies.backup.mysql_impl +# restore_namespace = trove.guestagent.strategies.restore.mysql_impl + +# Default configuration for mysql replication +# replication_strategy = MysqlBinlogReplication +# replication_namespace = trove.guestagent.strategies.replication.mysql_binlog +# replication_user = slave_user +# replication_password = slave_password + +[vertica] +# For vertica, following are the defaults needed: +# mount_point = /var/lib/vertica +# readahead_size = 2048 +# guestagent_strategy = trove.common.strategies.cluster.experimental.vertica.guestagent.VerticaGuestAgentStrategy diff --git a/deployment_tasks.yaml b/deployment_tasks.yaml index f382b0e..866645b 100644 --- a/deployment_tasks.yaml +++ b/deployment_tasks.yaml @@ -1,84 +1,264 @@ + # These tasks will be merged into deployment graph. Here you # can specify new tasks for any roles, even built-in ones. +- id: primary-trove + type: group + role: [primary-trove] + requires: [deploy_start] + required_for: [deploy_end] + tasks: &common_tasks + - hiera + - setup_repositories + - fuel_pkgs + - globals + - tools + - logging + - netconfig + - hosts + - firewall + - ssl-keys-saving + - ssl-add-trust-chain + - ssl-dns-setup + parameters: + strategy: + type: one_by_one + - id: trove type: group role: [trove] - requires: [deploy_start] + requires: [primary-trove] required_for: [deploy_end] - tasks: - - fuel_pkgs - - hiera - - globals - - logging - - tools - - netconfig - - hosts - - firewall + tasks: *common_tasks parameters: strategy: type: parallel -- id: trove-haproxy +- id: hiera-trove-override + version: 2.0.0 type: puppet - groups: ['primary-controller', 'controller'] - required_for: [task-trove, deploy_end] - requires: [deploy_start, cluster-haproxy] + groups: [primary-trove, trove] + requires: [globals] + required_for: [logging, trove-service] + cross-depends: + - name: globals parameters: - puppet_manifest: puppet/manifests/haproxy.pp - puppet_modules: puppet/modules:/etc/puppet/modules - timeout: 1800 + puppet_manifest: puppet/modules/dbaas_trove/modular/hiera_override.pp + puppet_modules: /etc/puppet/modules:puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes -- id: task-trove-db +- id: trove-firewall + version: 2.0.0 type: puppet - groups: ['primary-controller', 'controller'] - required_for: [task-trove] - requires: [database] + groups: [primary-trove, trove] + requires: [hiera-trove-override, firewall] + required_for: [trove-cluster] + cross-depends: + - name: hiera-trove-override + - name: firewall parameters: - puppet_manifest: puppet/manifests/db.pp + puppet_manifest: puppet/modules/dbaas_trove/modular/firewall.pp + puppet_modules: /etc/puppet/modules:puppet/modules + timeout: 3600 + +- id: trove-ssl-keys-saving + version: 2.0.0 + type: puppet + role: ['/.*/'] + requires: [trove-firewall, ssl-keys-saving] + cross-depends: + - name: trove-firewall + - name: ssl-keys-saving + condition: "(settings:public_ssl.horizon.value == true or settings:public_ssl.services.value == true) and settings:public_ssl.cert_source.value == 'user_uploaded'" + required_for: [deploy_end] + parameters: + puppet_manifest: puppet/modules/dbaas_trove/modular/ssl_keys_saving.pp + puppet_modules: /etc/puppet/modules:puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes + test_pre: + cmd: ruby /etc/puppet/modules/osnailyfacter/modular/ssl/ssl_keys_saving_pre.rb + +- id: trove-ssl-add-trust-chain + type: puppet + version: 2.0.0 + role: ['/.*/'] + requires: [trove-firewall, trove-ssl-keys-saving] + cross-depends: + - name: trove-firewall + - name: trove-ssl-keys-saving + condition: "settings:public_ssl.horizon.value == true or settings:public_ssl.services.value == true" + required_for: [hosts] + parameters: + puppet_manifest: puppet/modules/dbaas_trove/modular/ssl_add_trust_chain.pp + puppet_modules: /etc/puppet/modules:puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes + test_pre: + cmd: ruby /etc/puppet/modules/osnailyfacter/modular/ssl/ssl_keys_saving_pre.rb + +- id: trove-ssl-dns-setup + type: puppet + version: 2.0.0 + groups: [primary-controller, controller] + requires: [trove-firewall, trove-ssl-add-trust-chain] + cross-depends: + - name: trove-firewall + - name: trove-ssl-add-trust-chain + condition: "settings:public_ssl.horizon.value == true or settings:public_ssl.services.value == true" + required_for: [hosts] + parameters: + puppet_manifest: puppet/modules/dbaas_trove/modular/ssl_dns_setup.pp + puppet_modules: /etc/puppet/modules:puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes + +- id: primary-trove-cluster + version: 2.0.0 + type: puppet + groups: [primary-trove] + requires: [hosts, trove-firewall, hiera-trove-override] + required_for: [deploy_end] + cross-depends: + - name: hosts + - name: trove-firewall + - name: hiera-trove-override + parameters: + puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/cluster/cluster.pp puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes + +- id: trove-cluster + version: 2.0.0 + type: puppet + groups: [trove] + requires: [hosts, trove-firewall, hiera-trove-override, primary-trove-cluster] + required_for: [deploy_end] + cross-depends: + - name: hosts + - name: trove-firewall + - name: hiera-trove-override + - name: primary-trove-cluster + parameters: + puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/cluster/cluster.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes + +- id: primary-trove-rabbitmq + version: 2.0.0 + type: puppet + groups: [primary-trove] + requires: [trove-firewall, primary-trove-cluster, trove-cluster, hiera-trove-override] + required_for: [trove-service] + cross-depends: + - name: trove-firewall + - name: hiera-trove-override + - name: /(primary-)?trove-cluster/ + parameters: + puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/rabbitmq/rabbitmq.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes + +- id: trove-rabbitmq + version: 2.0.0 + type: puppet + groups: [trove] + requires: [trove-firewall, primary-trove-cluster, trove-cluster, hiera-trove-override, primary-trove-rabbitmq] + required_for: [trove-service] + cross-depends: + - name: trove-firewall + - name: hiera-trove-override + - name: /(primary-)?trove-cluster/ + - name: primary-trove-rabbitmq + - name: trove-rabbitmq + parameters: + puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/rabbitmq/rabbitmq.pp + puppet_modules: puppet/modules:/etc/puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes + +- id: trove-db + version: 2.0.0 + type: puppet + groups: [primary-controller] + requires: [primary-database, database] + required_for: [trove-service] + cross-depends: + - name: /(primary-)?database/ + parameters: + puppet_manifest: puppet/modules/dbaas_trove/modular/db.pp + puppet_modules: /etc/puppet/modules:puppet/modules timeout: 1800 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes - id: trove-keystone + version: 2.0.0 type: puppet - groups: ['primary-controller', 'controller'] - required_for: [task-trove] - requires: [keystone] + groups: [primary-controller] + requires: [primary-keystone, keystone] + required_for: [trove-service] + cross-depends: + - name: /(primary-)?keystone/ parameters: - puppet_manifest: puppet/manifests/keystone.pp - puppet_modules: puppet/modules:/etc/puppet/modules + puppet_manifest: puppet/modules/dbaas_trove/modular/keystone.pp + puppet_modules: /etc/puppet/modules:puppet/modules timeout: 1800 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes -- id: task-trove +- id: openstack-haproxy-trove type: puppet - groups: [trove] + version: 2.0.0 + groups: [primary-controller, controller] + requires: [primary-cluster-haproxy, cluster-haproxy] + required_for: [trove-service] + cross-depends: + - name: /(primary-)?cluster-haproxy/ + parameters: + puppet_manifest: puppet/modules/dbaas_trove/modular/openstack-haproxy-trove.pp + puppet_modules: /etc/puppet/modules:puppet/modules + timeout: 3600 + # reexecute_on is needed for scale-down operations + reexecute_on: + - deploy_changes + +- id: trove-service + version: 2.0.0 + type: puppet + groups: [primary-trove, trove] + requires: [trove-rabbitmq, trove-db, trove-keystone, openstack-haproxy-trove] required_for: [deploy_end] - requires: [rabbitmq, trove-haproxy, task-trove-db, trove-keystone, task-rabbitmq] + cross-depends: + - name: /(primary-)?trove-rabbitmq/ + - name: trove-db + - name: trove-keystone + - name: openstack-haproxy-trove + cross-depended-by: + - name: deploy_end parameters: - puppet_manifest: puppet/manifests/trove.pp - puppet_modules: puppet/modules:/etc/puppet/modules - timeout: 1800 - -############################################## -# RabbitMQ and Cluster - -# Deployment tasks -- id: task-rabbitmq - type: puppet - groups: [trove] - requires: [task-rabbitmq-cluster] - required_for: [task-trove] - parameters: - puppet_manifest: puppet/manifests/rabbitmq.pp - puppet_modules: puppet/modules:/etc/puppet/modules - timeout: 1800 - -- id: task-rabbitmq-cluster - type: puppet - groups: [trove] - requires: [hosts, firewall, deploy_start] - required_for: [task-rabbitmq] - parameters: - puppet_manifest: puppet/manifests/cluster.pp - puppet_modules: puppet/modules:/etc/puppet/modules + puppet_manifest: puppet/modules/dbaas_trove/modular/trove.pp + puppet_modules: /etc/puppet/modules:puppet/modules timeout: 1800 diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..0b051ea --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,177 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# User-friendly check for sphinx-build +ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1) +$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/) +endif + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/OpenStackTrovepluginforFuel.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/OpenStackTrovepluginforFuel.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/OpenStackTrovepluginforFuel" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/OpenStackTrovepluginforFuel" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/docs/source/_static/enable_plugin.png b/docs/source/_static/enable_plugin.png new file mode 100644 index 0000000..9968293 Binary files /dev/null and b/docs/source/_static/enable_plugin.png differ diff --git a/docs/source/_static/env_nodes.png b/docs/source/_static/env_nodes.png new file mode 100644 index 0000000..57cc98d Binary files /dev/null and b/docs/source/_static/env_nodes.png differ diff --git a/docs/source/_static/env_ready.png b/docs/source/_static/env_ready.png new file mode 100644 index 0000000..14b2961 Binary files /dev/null and b/docs/source/_static/env_ready.png differ diff --git a/docs/source/_static/nodes_tab.png b/docs/source/_static/nodes_tab.png new file mode 100644 index 0000000..d2c3738 Binary files /dev/null and b/docs/source/_static/nodes_tab.png differ diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..7cb0719 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,340 @@ +# -*- coding: utf-8 -*- +# +# OpenStack Trove plugin for Fuel documentation build configuration file, created by +# sphinx-quickstart on Tue Aug 16 20:00:41 2016. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys +import os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +#needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.doctest', + 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.mathjax', + 'sphinx.ext.ifconfig', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'OpenStack Trove plugin for Fuel' +copyright = u'2016, AT&T Services, Inc.' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '1.0-1.0.3-1' +# The full version, including alpha/beta/rc tags. +release = '1.0-1.0.3-1' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = [] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +#keep_warnings = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +#html_extra_path = [] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'OpenStackTrovepluginforFueldoc' + + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + ('index', 'OpenStackTrovepluginforFuel.tex', u'OpenStack Trove plugin for Fuel Documentation', + u'AT\\&T Services, Inc.', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + ('index', 'openstacktrovepluginforfuel', u'OpenStack Trove plugin for Fuel Documentation', + [u'AT&T Services, Inc.'], 1) +] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + ('index', 'OpenStackTrovepluginforFuel', u'OpenStack Trove plugin for Fuel Documentation', + u'AT&T Services, Inc.', 'OpenStackTrovepluginforFuel', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +#texinfo_no_detailmenu = False + + +# -- Options for Epub output ---------------------------------------------- + +# Bibliographic Dublin Core info. +epub_title = u'OpenStack Trove plugin for Fuel' +epub_author = u'AT&T Services, Inc.' +epub_publisher = u'AT&T Services, Inc.' +epub_copyright = u'2016, AT&T Services, Inc.' + +# The basename for the epub file. It defaults to the project name. +#epub_basename = u'OpenStack Trove plugin for Fuel' + +# The HTML theme for the epub output. Since the default themes are not optimized +# for small screen space, using the same theme for HTML and epub output is +# usually not wise. This defaults to 'epub', a theme designed to save visual +# space. +#epub_theme = 'epub' + +# The language of the text. It defaults to the language option +# or en if the language is not set. +#epub_language = '' + +# The scheme of the identifier. Typical schemes are ISBN or URL. +#epub_scheme = '' + +# The unique identifier of the text. This can be a ISBN number +# or the project homepage. +#epub_identifier = '' + +# A unique identification for the text. +#epub_uid = '' + +# A tuple containing the cover image and cover page html template filenames. +#epub_cover = () + +# A sequence of (type, uri, title) tuples for the guide element of content.opf. +#epub_guide = () + +# HTML files that should be inserted before the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_pre_files = [] + +# HTML files shat should be inserted after the pages created by sphinx. +# The format is a list of tuples containing the path and title. +#epub_post_files = [] + +# A list of files that should not be packed into the epub file. +epub_exclude_files = ['search.html'] + +# The depth of the table of contents in toc.ncx. +#epub_tocdepth = 3 + +# Allow duplicate toc entries. +#epub_tocdup = True + +# Choose between 'default' and 'includehidden'. +#epub_tocscope = 'default' + +# Fix unsupported image types using the PIL. +#epub_fix_images = False + +# Scale large images. +#epub_max_image_width = 0 + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#epub_show_urls = 'inline' + +# If false, no index is generated. +#epub_use_index = True + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..9201f28 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,24 @@ +.. OpenStack Trove plugin for Fuel documentation master file, created by + sphinx-quickstart on Tue Aug 16 20:00:41 2016. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to OpenStack Trove plugin for Fuel's documentation! +=========================================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + overview + installation_guide + user_guide + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + diff --git a/docs/source/installation_guide.rst b/docs/source/installation_guide.rst new file mode 100644 index 0000000..924b4e2 --- /dev/null +++ b/docs/source/installation_guide.rst @@ -0,0 +1,45 @@ +.. _installation: + +Installation Guide +================== + +#. Start with `installing Fuel Master node`_. + +#. Install `Fuel Plugin Builder on Fuel Master node`_. + +#. Install Git on Fuel Master node:: + + [root@fuel ~]# yum install git -y + +#. Clone the plugin from `Github`_.:: + + [root@fuel ~]# git clone http://github.com/openstack/fuel-plugin-dbaas-trove.git -b stable/8.0 + [root@fuel ~]# cd fuel-plugin-dbaas-trove + +#. Download Liberty Trove Debian packages from `Ubuntu Repo`_ and stage + into repositories/ubuntu/ directory. + +.. note:: Liberty version is '4.0.0-0ubuntu1~cloud0_all' + +#. Build the plugin:: + + [root@fuel ~]# fpb --build . + +#. Install the plugin:: + + [root@fuel ~]# fuel plugins --install fuel-plugin-dbaas-trove-1.0-1.0.3-1.noarch.rpm + +#. Verify that the plugin is installed correctly:: + + [root@nailgun ~]# fuel plugins + id | name | version | package_version + ---|-------------------------|---------|---------------- + 1 | fuel-plugin-dbaas-trove | 1.0.3 | 4.0.0 + + + +.. target-notes:: +.. _installing Fuel Master node: https://docs.mirantis.com/openstack/fuel/fuel-8.0/fuel-install-guide.html#introduction-to-fuel-installation +.. _Fuel Plugin Builder on Fuel Master node: https://wiki.openstack.org/wiki/Fuel/Plugins#install_latest +.. _Github: http://github.com/openstack/fuel-plugin-dbaas-trove.git +.. _Ubuntu Repo: http://ubuntu-cloud.archive.canonical.com/ubuntu/pool/main/o/openstack-trove diff --git a/docs/source/overview.rst b/docs/source/overview.rst new file mode 100644 index 0000000..ee719d1 --- /dev/null +++ b/docs/source/overview.rst @@ -0,0 +1,53 @@ +.. _overview: + +Document purpose +================ + +This document provides instructions for installing, configuring and using +OpenStack Trove plugin for Fuel. + + +OpenStack Trove plugin +---------------------- + +The OpenStack Trove plugin provides ability to install an OpenStack +environment with Trove deployed on dedicated nodes. Trove provides scalable +and reliable Cloud Database as a Service provisioning functionality for both +relational and non-relational database engines, and to continue to improve +its fully-featured and extensible open source framework. + +Plugin is hot-pluggable and It can be enabled in a new environment or existing +deployed environment without the plugin. + +Requirements +------------ + ++----------------------------+--------------------+ +| Requirement | Version/Comment | ++============================+====================+ +| Fuel | 8.0 release | ++----------------------------+--------------------+ +| OpenStack compatibility | Liberty | ++----------------------------+--------------------+ +| Operating systems | Ubuntu 14.04 LTS | ++----------------------------+--------------------+ + + +Limitations +----------- + +OpenStack Trove plugin deploys a dedicated RabbitMQ Cluster on Trove nodes for +for security reasons. +`Dedicated RabbitMQ `_. + +If the OpenStack Trove plugin is enabled for an environment, it is impossible +to assign Trove and Controller roles to the same node. + +There is a Detach RabbitMQ plugin, which enable user to install RabbitMQ +on separate nodes. Detach RabbitMQ plugin role should not be used together +with Trove plugin role, User should ensure that: + + * Trove and RabbitMQ roles shoud not to be assigned to the same nodes + +Trove Guest service on Tenant VM will comminicate with Trove RabbitMQ VIP +over SSL Connection only when the environment is confifured with SSL support. diff --git a/docs/source/user_guide.rst b/docs/source/user_guide.rst new file mode 100644 index 0000000..b03a457 --- /dev/null +++ b/docs/source/user_guide.rst @@ -0,0 +1,63 @@ +.. _user-guide: + +User Guide +========== + +#. After the plugin is installed, `create a new OpenStack environment`_. + +#. Open the Settings tab of the Fuel web UI and then select the OpenStack + Services menu. Select "Trove Setting" checkbox. + + .. image:: _static/enable_plugin.png + +#. Go to the Nodes tab and here push Add Nodes button + + .. image:: _static/nodes_tab.png + + Note that now Trove role is available in the roles list. + +#. Add nodes to the environment with RabbitMQ role assigned to some of them. + On the screenshot below you may see environment with 1 CONTROLLER, + 1 (COMPUTE + CINDER) and 1 TROVE node. You can assign Trove role to more + than one node. + + .. image:: _static/env_nodes.png + +#. Finish `configuring your environment`_. + +#. `Deploy your environment`_. + + .. image:: _static/env_ready.png + +How it works +------------ + +With the plugin enabled, Fuel deploys RabbitMQ and Trove Services on Trove +nodes and here RabbitMQ is also managed by Pacemaker. Also note that two +separate Pacemaker clusters are running on the Controller and Trove nodes +and they are not aware of each other. + +The Trove service logs could be found at : + - on Trove node in /var/log/trove directory + +When the plugin is enabled, RabbitMQ log could be found in its regular place: + - on Trove node in /var/log/rabbitmq directory + - on master node in /var/log/remote//rabbitmq-\*.log files + +The same applies to log of Pacemaker which manages RabbitMQ. Its location is: + - on Trove node /var/log/pacemaker.log + - on master node in the following files: + + - /var/log/remote//attrd.log + - /var/log/remote//crmd.log + - /var/log/remote//cib.log + - /var/log/remote//lrmd.log + - /var/log/remote//pengine.log + + + +.. target-notes:: +.. _create a new OpenStack environment: https://docs.mirantis.com/openstack/fuel/fuel-8.0/fuel-user-guide.html#create-a-new-openstack-environment +.. _configuring your environment: http://docs.mirantis.com/openstack/fuel/fuel-8.0/fuel-user-guide.html#configure-your-environment +.. _Deploy your environment: http://docs.mirantis.com/openstack/fuel/fuel-8.0/fuel-user-guide.html#deploy-changes + diff --git a/environment_config.yaml b/environment_config.yaml index 48b8191..eb94500 100644 --- a/environment_config.yaml +++ b/environment_config.yaml @@ -1,11 +1,84 @@ -attributes: - metadata: - label: "Trove Service" - weight: 90 - db_password: - generator: "password" - user_password: - generator: "password" - rabbit_password: - generator: "password" - rabbit_user: "trove" +attributes: + metadata: + # Settings group can be one of "general", "security", "compute", "network", + # "storage", "logging", "openstack_services" and "other". + group: 'openstack_services' + label: "Trove Settings" + + auth_name: + value: 'trove' + label: 'Auth Username' + description: '' + weight: 20 + type: "text" + regex: + source: '^[\S]{4,}$' + error: "Username length should not be less than 4 characters" + restrictions: + - action: hide + condition: settings:fuel-plugin-dbaas-trove.metadata.enabled == false + + auth_password: + label: 'Auth Password' + description: '' + weight: 21 + type: 'password' + value: 'NN2eNK27rPLQM2cf2JrNPnwc' + regex: + source: '^[\S]{8,}$' + error: "Password length should not be less than 8 characters" + restrictions: + - action: hide + condition: settings:fuel-plugin-dbaas-trove.metadata.enabled == false + + db_password: + label: 'Database Password' + description: '' + weight: 22 + type: 'password' + value: 'nupTgLU9a6SyFCBnsMfYH7Ag' + regex: + source: '^[\S]{8,}$' + error: "Password length should not be less than 8 characters" + restrictions: + - action: hide + condition: settings:fuel-plugin-dbaas-trove.metadata.enabled == false + + rabbit_user: + label: 'RabbitMQ Username' + description: '' + weight: 23 + type: 'text' + value: 'trove' + regex: + source: '^[\S]{4,}$' + error: "Username length should not be less than 4 characters" + restrictions: + - action: hide + condition: settings:fuel-plugin-dbaas-trove.metadata.enabled == false + + rabbit_password: + label: 'RabbitMQ Password' + description: '' + weight: 24 + type: 'password' + value: '9sk9rWwXWbZnxmBFfhGtrGfP' + regex: + source: '^[\S]{8,}$' + error: "Password length should not be less than 8 characters" + restrictions: + - action: hide + condition: settings:fuel-plugin-dbaas-trove.metadata.enabled == false + + rabbit_port: + value: "55671" + label: "RabbitMQ Port" + description: "" + weight: 25 + type: "text" + restrictions: + - action: hide + condition: settings:fuel-plugin-dbaas-trove.metadata.enabled == false + regex: + source: '^(102[4-9]|10[3-9]\d|1[1-9]\d{2}|[2-9]\d{3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$' + error: "Invalid Port, Enter a port between 1024 and 65535" diff --git a/metadata.yaml b/metadata.yaml index 83e8515..a299268 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -3,38 +3,32 @@ name: fuel-plugin-dbaas-trove # Human-readable name for your plugin title: Trove Service # Plugin version -version: '1.0.0' -# Description -description: Trove plugin for Fuel provides the functionality to deploy OpenStack Trove for providing scalable and reliable Cloud Database as a Service provisioning functionality +version: '1.0.3' +#Description +description: Deploys the Trove services in OpenStack Fuel environment. # Required fuel version -fuel_version: ['7.0'] +fuel_version: ['8.0'] # Specify license of your plugin licenses: ['Apache License Version 2.0'] # Specify author or company name -authors: ['Shaik Apsar'] +authors: ['Shaik Apsar', 'Bhaskara Duvvuri'] # A link to the plugin's page homepage: 'https://github.com/openstack/fuel-plugin-dbaas-trove' # Specify a group which your plugin implements, possible options: -# network, storage, storage::cinder, storage::glance, hypervisor +# network, storage, storage::cinder, storage::glance, hypervisor, +# equipment groups: [] +# Change `false` to `true` if the plugin can be installed in the environment +# after the deployment. +is_hotpluggable: true # The plugin is compatible with releases in the list releases: - os: ubuntu - version: 2015.1.0-7.0 - mode: ['ha', 'multinode'] - deployment_scripts_path: deployment_scripts/ - repository_path: repositories/ubuntu - - os: ubuntu - version: 2015.2.0-7.0 - mode: ['ha', 'multinode'] - deployment_scripts_path: deployment_scripts/ - repository_path: repositories/ubuntu - - os: ubuntu - version: 2015.2.0-8.0 + version: liberty-8.0 mode: ['ha'] deployment_scripts_path: deployment_scripts/ repository_path: repositories/ubuntu # Version of plugin package -package_version: '3.0.0' +package_version: '4.0.0' diff --git a/network_roles.yaml b/network_roles.yaml index 762dd8a..1f68ea9 100644 --- a/network_roles.yaml +++ b/network_roles.yaml @@ -9,3 +9,7 @@ gateway: true # List of VIPs to be allocated vip: [] + # Unique VIP name + # - name: "vip_name" + # Optional linux namespace for VIP + # namespace: "haproxy" diff --git a/node_roles.yaml b/node_roles.yaml index 6372343..fc96ff6 100644 --- a/node_roles.yaml +++ b/node_roles.yaml @@ -2,17 +2,34 @@ trove: # Role name name: "Trove" # Role description - description: "Trove" - # If primaty then during orchestration this role will be - # splitted into primary-role and role - has_primary: false + description: | + Trove provides Cloud Database as a Service (DBaaS) by deploying + the Trove components along with the separate RabbitMQ Cluster + installed on the Trove node as well. + # If primary then during orchestration this role will be + # separated into primary-role and role + has_primary: true # Assign public IP to node if true public_ip_required: false # Weight that will be used to sort out the # roles on the Fuel web UI - weight: 100 + weight: 1000 update_required: - - trove - controller conflicts: - - controller \ No newline at end of file + - compute-vmware + - compute + - cinder-vmware + - virt + - base-os + - controller + - ceph-osd + - ironic + - cinder + - cinder-block-device + limits: + recommended: 3 + min: 0 + restrictions: + - condition: "settings:fuel-plugin-dbaas-trove.metadata.enabled == false" + action: hide diff --git a/pre_build_hook b/pre_build_hook index c1bece5..dc05e98 100755 --- a/pre_build_hook +++ b/pre_build_hook @@ -1,3 +1,5 @@ #!/bin/bash -# Nothing here +# Add here any the actions which are required before plugin build +# like packages building, packages downloading from mirrors and so on. +# The script should return 0 if there were no errors. diff --git a/tasks.yaml b/tasks.yaml new file mode 100644 index 0000000..327fab5 --- /dev/null +++ b/tasks.yaml @@ -0,0 +1,26 @@ +# WARNING: `tasks.yaml` will be deprecated in further releases. +# Please, use `deployment_tasks.yaml` to describe tasks instead. + +# This tasks will be applied on controller nodes, +# here you can also specify several roles, for example +# ['cinder', 'compute'] will be applied only on +# cinder and compute nodes +- role: ['controller'] + stage: post_deployment + type: shell + parameters: + cmd: bash deploy.sh + timeout: 42 +# Task is applied for all roles +- role: '*' + stage: pre_deployment + type: shell + parameters: + cmd: echo all > /tmp/plugin.all + timeout: 42 +# "reboot" task reboots the nodes and waits until they get back online +- role: '*' + stage: pre_deployment + type: reboot + parameters: + timeout: 600 diff --git a/volumes.yaml b/volumes.yaml index f643131..1f871a3 100644 --- a/volumes.yaml +++ b/volumes.yaml @@ -1,8 +1,7 @@ volumes_roles_mapping: # Default role mapping - fuel-plugin-dbaas-trove: + trove: - {allocate_size: "min", id: "os"} - {allocate_size: "min", id: "logs"} - # Set here new volumes for your role volumes: []