summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--manifests/haproxy.pp2
-rw-r--r--manifests/profile/base/database/redis.pp2
-rw-r--r--manifests/profile/base/gnocchi/api.pp24
-rw-r--r--manifests/profile/pacemaker/ovn_northd.pp36
-rw-r--r--spec/classes/tripleo_profile_base_database_redis_spec.rb106
-rw-r--r--spec/classes/tripleo_profile_base_gnocchi_api_spec.rb22
-rw-r--r--spec/fixtures/hieradata/default.yaml1
7 files changed, 130 insertions, 63 deletions
diff --git a/manifests/haproxy.pp b/manifests/haproxy.pp
index 208f328..98c9c96 100644
--- a/manifests/haproxy.pp
+++ b/manifests/haproxy.pp
@@ -780,7 +780,7 @@ class tripleo::haproxy (
'cookie' => 'SERVERID insert indirect nocache',
'rsprep' => '^Location:\ http://(.*) Location:\ https://\1',
# NOTE(jaosorior): We always redirect to https for the public_virtual_ip.
- 'redirect' => "scheme https code 301 if { hdr(host) -i ${public_virtual_ip} } !{ ssl_fc }",
+ 'redirect' => 'scheme https code 301 if !{ ssl_fc }',
'option' => [ 'forwardfor', 'httpchk' ],
'http-request' => [
'set-header X-Forwarded-Proto https if { ssl_fc }',
diff --git a/manifests/profile/base/database/redis.pp b/manifests/profile/base/database/redis.pp
index 14f6af4..3890244 100644
--- a/manifests/profile/base/database/redis.pp
+++ b/manifests/profile/base/database/redis.pp
@@ -37,7 +37,7 @@ class tripleo::profile::base::database::redis (
$step = hiera('step'),
) {
if $step >= 2 {
- if $bootstrap_nodeid == $::hostname {
+ if downcase($bootstrap_nodeid) == $::hostname {
$slaveof = undef
} else {
$slaveof = "${bootstrap_nodeid} 6379"
diff --git a/manifests/profile/base/gnocchi/api.pp b/manifests/profile/base/gnocchi/api.pp
index a4e9a30..910375f 100644
--- a/manifests/profile/base/gnocchi/api.pp
+++ b/manifests/profile/base/gnocchi/api.pp
@@ -89,12 +89,11 @@ class tripleo::profile::base::gnocchi::api (
$tls_keyfile = undef
}
- if $step >= 3 and $sync_db {
+ if $step >= 4 and $sync_db {
include ::gnocchi::db::sync
}
- if $step >= 3 {
- include ::gnocchi::api
+ if $step >= 4 or ($step >= 3 and $sync_db) {
include ::apache::mod::ssl
class { '::gnocchi::wsgi::apache':
ssl_cert => $tls_certfile,
@@ -107,19 +106,20 @@ class tripleo::profile::base::gnocchi::api (
coordination_url => join(['redis://:', $gnocchi_redis_password, '@', normalize_ip_for_uri($redis_vip), ':6379/']),
}
case $gnocchi_backend {
- 'swift': { include ::gnocchi::storage::swift }
+ 'swift': {
+ include ::gnocchi::storage::swift
+ if $sync_db {
+ include ::swift::deps
+ # Ensure we have swift proxy available before running gnocchi-upgrade
+ # as storage is initialized at this point.
+ Anchor<| title == 'swift::service::end' |> ~> Class['Gnocchi::db::sync']
+ }
+ }
'file': { include ::gnocchi::storage::file }
'rbd': { include ::gnocchi::storage::ceph }
default: { fail('Unrecognized gnocchi_backend parameter.') }
}
+ include ::gnocchi::api
}
- # Re-run gnochci upgrade with storage as swift/ceph should be up at this
- # stage.
- if $step >= 5 and $sync_db {
- exec {'run gnocchi upgrade with storage':
- command => 'gnocchi-upgrade --config-file=/etc/gnocchi/gnocchi.conf',
- path => ['/usr/bin', '/usr/sbin'],
- }
- }
}
diff --git a/manifests/profile/pacemaker/ovn_northd.pp b/manifests/profile/pacemaker/ovn_northd.pp
index af946af..57bbc35 100644
--- a/manifests/profile/pacemaker/ovn_northd.pp
+++ b/manifests/profile/pacemaker/ovn_northd.pp
@@ -32,7 +32,8 @@
# Defaults to hiera('pcs_tries', 20)
#
# [*ovn_dbs_vip*]
-# (Optional) The OVN database virtual IP to be managed by the pacemaker.
+# (Optional) The vip to be used for OVN DB servers. It is expected that
+# the vip resource to be created before calling this class.
# Defaults to hiera('ovn_dbs_vip')
#
# [*nb_db_port*]
@@ -67,21 +68,9 @@ class tripleo::profile::pacemaker::ovn_northd (
$ovndb_servers_ocf_name = 'ovn:ovndb-servers'
$ovndb_vip_resource_name = "ip-${ovn_dbs_vip}"
- if is_ipv6_address($ovn_dbs_vip) {
- $netmask = '128'
- $nic = interface_for_ip($ovn_dbs_vip)
- } else {
- $netmask = '32'
- $nic = ''
- }
-
- pacemaker::resource::ip { "${ovndb_vip_resource_name}":
- ip_address => $ovn_dbs_vip,
- cidr_netmask => $netmask,
- nic => $nic,
- tries => $pcs_tries,
- }
-
+ # By step 3, all the VIPs would have been created.
+ # After creating ovn ocf resource, colocate it with the
+ # VIP - ip-${ovn_dbs_vip}.
pacemaker::resource::ocf { "${ovndb_servers_resource_name}":
ocf_agent_name => "${ovndb_servers_ocf_name}",
master_params => '',
@@ -96,15 +85,6 @@ class tripleo::profile::pacemaker::ovn_northd (
meta_params => 'notify=true'
}
- pacemaker::constraint::order { "${ovndb_vip_resource_name}-then-${ovndb_servers_resource_name}":
- first_resource => "${ovndb_vip_resource_name}",
- second_resource => "${ovndb_servers_resource_name}-master",
- first_action => 'start',
- second_action => 'start',
- constraint_params => 'kind=Mandatory',
- tries => $pcs_tries,
- }
-
pacemaker::constraint::colocation { "${ovndb_vip_resource_name}-with-${ovndb_servers_resource_name}":
source => "${ovndb_vip_resource_name}",
target => "${ovndb_servers_resource_name}-master",
@@ -113,9 +93,7 @@ class tripleo::profile::pacemaker::ovn_northd (
tries => $pcs_tries,
}
- Pacemaker::Resource::Ip["${ovndb_vip_resource_name}"] ->
- Pacemaker::Resource::Ocf["${ovndb_servers_resource_name}"] ->
- Pacemaker::Constraint::Order["${ovndb_vip_resource_name}-then-${ovndb_servers_resource_name}"] ->
- Pacemaker::Constraint::Colocation["${ovndb_vip_resource_name}-with-${ovndb_servers_resource_name}"]
+ Pacemaker::Resource::Ocf["${ovndb_servers_resource_name}"] ->
+ Pacemaker::Constraint::Colocation["${ovndb_vip_resource_name}-with-${ovndb_servers_resource_name}"]
}
}
diff --git a/spec/classes/tripleo_profile_base_database_redis_spec.rb b/spec/classes/tripleo_profile_base_database_redis_spec.rb
new file mode 100644
index 0000000..8f94cc9
--- /dev/null
+++ b/spec/classes/tripleo_profile_base_database_redis_spec.rb
@@ -0,0 +1,106 @@
+#
+# Copyright (C) 2017 Red Hat, 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.
+#
+
+require 'spec_helper'
+
+describe 'tripleo::profile::base::database::redis' do
+ shared_examples_for 'tripleo::profile::base::database::redis' do
+
+ context 'with step less than 2' do
+ let(:params) { {
+ :step => 1,
+ :bootstrap_nodeid => 'node.example.com',
+ :redis_node_ips => []
+ } }
+
+ it 'should do nothing' do
+ is_expected.to contain_class('tripleo::profile::base::database::redis')
+ is_expected.to_not contain_class('redis')
+ is_expected.to_not contain_class('redis::sentinel')
+ is_expected.to_not contain_class('tripleo::redis_notification')
+ end
+ end
+
+ context 'with step 2 on bootstrap node' do
+ let(:params) { {
+ :step => 2,
+ :bootstrap_nodeid => 'node.example.com',
+ :redis_node_ips => ['10.0.0.1']
+ } }
+
+ it 'should configure redis' do
+ is_expected.to contain_class('tripleo::profile::base::database::redis')
+ is_expected.to contain_class('redis')
+ is_expected.to_not contain_class('redis::sentinel')
+ is_expected.to_not contain_class('tripleo::redis_notification')
+ end
+ end
+
+ context 'with step 2 on bootstrap node with capital letters' do
+ let(:params) { {
+ :step => 2,
+ :bootstrap_nodeid => 'NODE.example.com',
+ :redis_node_ips => ['10.0.0.1']
+ } }
+
+ it 'should configure redis' do
+ is_expected.to contain_class('tripleo::profile::base::database::redis')
+ is_expected.to contain_class('redis').with(:slaveof => nil)
+ end
+ end
+
+ context 'with step 2 not on bootstrap node' do
+ let(:params) { {
+ :step => 2,
+ :bootstrap_nodeid => 'othernode.example.com',
+ :redis_node_ips => ['10.0.0.1']
+ } }
+
+ it 'should configure redis' do
+ is_expected.to contain_class('tripleo::profile::base::database::redis')
+ is_expected.to contain_class('redis').with(:slaveof => "#{params[:bootstrap_nodeid]} 6379")
+ is_expected.to_not contain_class('redis::sentinel')
+ is_expected.to_not contain_class('tripleo::redis_notification')
+ end
+ end
+
+ context 'with step 2 with multiple nodes' do
+ let(:params) { {
+ :step => 2,
+ :bootstrap_nodeid => 'othernode.example.com',
+ :redis_node_ips => ['10.0.0.1', '10.0.0.2']
+ } }
+
+ it 'should configure redis' do
+ is_expected.to contain_class('tripleo::profile::base::database::redis')
+ is_expected.to contain_class('redis').with(:slaveof => "#{params[:bootstrap_nodeid]} 6379")
+ is_expected.to contain_class('redis::sentinel')
+ is_expected.to contain_class('tripleo::redis_notification')
+ end
+ end
+
+ end
+
+ on_supported_os.each do |os, facts|
+ context "on #{os}" do
+ let(:facts) do
+ facts.merge({ :hostname => 'node.example.com' })
+ end
+
+ it_behaves_like 'tripleo::profile::base::database::redis'
+ end
+ end
+end
diff --git a/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb b/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb
index 6c04e9d..90bdea0 100644
--- a/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb
+++ b/spec/classes/tripleo_profile_base_gnocchi_api_spec.rb
@@ -36,9 +36,9 @@ describe 'tripleo::profile::base::gnocchi::api' do
}
end
- context 'with step 3 on bootstrap' do
+ context 'with step 4 on bootstrap' do
let(:params) { {
- :step => 3,
+ :step => 4,
:bootstrap_node => 'node.example.com',
:gnocchi_redis_password => 'gnocchi',
:redis_vip => '127.0.0.1'
@@ -51,20 +51,6 @@ describe 'tripleo::profile::base::gnocchi::api' do
}
end
- context 'with step 3' do
- let(:params) { {
- :step => 3,
- :gnocchi_redis_password => 'gnocchi',
- :redis_vip => '127.0.0.1'
- } }
-
- it {
- is_expected.to_not contain_class('gnocchi::db::sync')
- is_expected.to contain_class('gnocchi::api')
- is_expected.to contain_class('gnocchi::wsgi::apache')
- }
- end
-
context 'with step 4' do
let(:params) { {
:step => 4,
@@ -129,10 +115,6 @@ describe 'tripleo::profile::base::gnocchi::api' do
it {
is_expected.to contain_class('gnocchi::api')
is_expected.to contain_class('gnocchi::wsgi::apache')
- is_expected.to contain_exec('run gnocchi upgrade with storage').with(
- :command => 'gnocchi-upgrade --config-file=/etc/gnocchi/gnocchi.conf',
- :path => ['/usr/bin', '/usr/sbin']
- )
}
end
end
diff --git a/spec/fixtures/hieradata/default.yaml b/spec/fixtures/hieradata/default.yaml
index ad2da39..5d978cc 100644
--- a/spec/fixtures/hieradata/default.yaml
+++ b/spec/fixtures/hieradata/default.yaml
@@ -6,6 +6,7 @@ not_hash: string
aodh::rabbit_password: 'password'
aodh_redis_password: 'password'
redis_vip: '127.0.0.1'
+redis::bind: '10.0.0.1'
aodh::auth::auth_password: 'password'
aodh::db::mysql::password: 'password'
aodh::keystone::authtoken::password: 'password'