summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMykyta Karpin <mkarpin@mirantis.com>2016-03-08 17:38:18 +0200
committerMykyta Karpin <mkarpin@mirantis.com>2016-03-08 17:46:56 +0200
commit39bd25c060ba5a20f5318a2b78662818050e3452 (patch)
treebdaf84df8df9d556ca2aadbb91e7400fd717b157
parent7aca0c5f1c2b4dbd6b56b762c0bde69f24cf0881 (diff)
fix name for master of redis cluster
value of master name should be the same as in ceilometer redis backend url Co-Authored-By: alexey-mr <Alexey.Morlang@gmail.com> Change-Id: Ic9f6399950597db399718b4e607c6586db5647e3 Closes-Bug: #1553229
Notes
Notes (review): Code-Review+1: Artem Minasyan <aminasyan@mirantis.com> Code-Review+2: Ilya Tyaptin <ityaptin@mirantis.com> Workflow+1: Ilya Tyaptin <ityaptin@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 10 Mar 2016 11:49:03 +0000 Reviewed-on: https://review.openstack.org/289985 Project: openstack/fuel-plugin-ceilometer-redis Branch: refs/heads/master
-rw-r--r--deployment_scripts/puppet/manifests/controller.pp5
-rw-r--r--deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/redis_backend_url.rb5
-rw-r--r--deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/sentinel_confs.rb11
-rw-r--r--deployment_scripts/puppet/modules/redis/manifests/main.pp15
-rw-r--r--deployment_scripts/puppet/modules/redis/manifests/sentinel.pp1
5 files changed, 27 insertions, 10 deletions
diff --git a/deployment_scripts/puppet/manifests/controller.pp b/deployment_scripts/puppet/manifests/controller.pp
index 4b4e2f7..ef95281 100644
--- a/deployment_scripts/puppet/manifests/controller.pp
+++ b/deployment_scripts/puppet/manifests/controller.pp
@@ -26,9 +26,14 @@ $redis_primary_nodes = get_nodes_hash_by_roles(hiera('network_metadata'),
26$redis_primary_address_map = get_node_to_ipaddr_map_by_network_role($redis_primary_nodes, 'ceilometer/api') 26$redis_primary_address_map = get_node_to_ipaddr_map_by_network_role($redis_primary_nodes, 'ceilometer/api')
27$primary_redis_node = values($redis_primary_address_map) 27$primary_redis_node = values($redis_primary_address_map)
28 28
29# TODO: get value from hiera
30$master_name = 'ceilometer_redis_master'
31
32
29class {'::redis::main': 33class {'::redis::main':
30 primary_redis_node => $primary_redis_node[0], 34 primary_redis_node => $primary_redis_node[0],
31 redis_hosts => $redis_hosts, 35 redis_hosts => $redis_hosts,
32 redis_bind_address => $redis_bind_address, 36 redis_bind_address => $redis_bind_address,
33 primary_controller => hiera('primary_controller'), 37 primary_controller => hiera('primary_controller'),
38 master_name => $master_name,
34} 39}
diff --git a/deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/redis_backend_url.rb b/deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/redis_backend_url.rb
index 550fd0a..b1e4dea 100644
--- a/deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/redis_backend_url.rb
+++ b/deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/redis_backend_url.rb
@@ -1,13 +1,14 @@
1module Puppet::Parser::Functions 1module Puppet::Parser::Functions
2 newfunction(:redis_backend_url, :type => :rvalue) do |args| 2 newfunction(:redis_backend_url, :type => :rvalue) do |args|
3 if args.length != 3 3 if args.length != 4
4 raise "Wrong number of arguments" 4 raise "Wrong number of arguments"
5 end 5 end
6 nodes = args[0] 6 nodes = args[0]
7 port = args[1] 7 port = args[1]
8 timeout = args[2] 8 timeout = args[2]
9 master_name = args[3]
9 10
10 backend_url="redis://" + nodes[0] + ":" + port + "?sentinel=" + nodes[0] 11 backend_url="redis://" + nodes[0] + ":" + port + "?sentinel=" + master_name
11 12
12 nodes.each do |value| 13 nodes.each do |value|
13 if value != nodes[0] 14 if value != nodes[0]
diff --git a/deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/sentinel_confs.rb b/deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/sentinel_confs.rb
index d0b151a..e6716de 100644
--- a/deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/sentinel_confs.rb
+++ b/deployment_scripts/puppet/modules/redis/lib/puppet/parser/functions/sentinel_confs.rb
@@ -12,10 +12,13 @@ module Puppet::Parser::Functions
12 hash = {} 12 hash = {}
13 13
14 nodes.each do |value| 14 nodes.each do |value|
15 hash[value] = { 'monitor' => value + ' ' + port + ' ' + quorum, 15 name = value['name']
16 'down-after-milliseconds' => down_after_milliseconds, 16 addr = value['addr']
17 'failover-timeout' => failover_timeout, 17 hash[name] = {
18 'parallel-syncs' => parallel_syncs } 18 'monitor' => addr + ' ' + port + ' ' + quorum,
19 'down-after-milliseconds' => down_after_milliseconds,
20 'failover-timeout' => failover_timeout,
21 'parallel-syncs' => parallel_syncs }
19 end 22 end
20 23
21 hash 24 hash
diff --git a/deployment_scripts/puppet/modules/redis/manifests/main.pp b/deployment_scripts/puppet/modules/redis/manifests/main.pp
index 11f3106..f481815 100644
--- a/deployment_scripts/puppet/modules/redis/manifests/main.pp
+++ b/deployment_scripts/puppet/modules/redis/manifests/main.pp
@@ -54,6 +54,7 @@ class redis::main (
54 $redis_bind_address = '0.0.0.0', 54 $redis_bind_address = '0.0.0.0',
55 $redis_port = '6379', 55 $redis_port = '6379',
56 $redis_sentinel_port = '26379', 56 $redis_sentinel_port = '26379',
57 $master_name = 'mymaster',
57) { 58) {
58 59
59 include ceilometer::params 60 include ceilometer::params
@@ -107,9 +108,14 @@ class redis::main (
107 } 108 }
108 109
109 # Use custom function to generate sentinel configuration 110 # Use custom function to generate sentinel configuration
110 $sentinel_confs = sentinel_confs($redis_hosts, $redis_port, $quorum, 111 $masters_to_monitor = [
111 $parallel_syncs, $down_after_milliseconds, 112 { name => $master_name,
112 $failover_timeout) 113 addr => $primary_redis_node
114 },
115 ]
116 $sentinel_confs = sentinel_confs($masters_to_monitor, $redis_port, $quorum,
117 $parallel_syncs, $down_after_milliseconds,
118 $failover_timeout)
113 119
114 package {'python-redis': 120 package {'python-redis':
115 ensure => 'present', 121 ensure => 'present',
@@ -127,10 +133,11 @@ class redis::main (
127 conf_port => $redis_sentinel_port, 133 conf_port => $redis_sentinel_port,
128 sentinel_confs => $sentinel_confs, 134 sentinel_confs => $sentinel_confs,
129 manage_upstart_scripts => $manage_upstart_scripts, 135 manage_upstart_scripts => $manage_upstart_scripts,
136 master_name => $master_name
130 } 137 }
131 138
132 ceilometer_config { 139 ceilometer_config {
133 'coordination/backend_url' : value => redis_backend_url($redis_hosts, $redis_sentinel_port, $timeout); 140 'coordination/backend_url' : value => redis_backend_url($redis_hosts, $redis_sentinel_port, $timeout, $master_name);
134 'coordination/heartbeat' : value => '1.0'; 141 'coordination/heartbeat' : value => '1.0';
135 'coordination/check_watchers' : value => $timeout; 142 'coordination/check_watchers' : value => $timeout;
136 'notification/workload_partitioning': value => true 143 'notification/workload_partitioning': value => true
diff --git a/deployment_scripts/puppet/modules/redis/manifests/sentinel.pp b/deployment_scripts/puppet/modules/redis/manifests/sentinel.pp
index ded9a87..6a7a60e 100644
--- a/deployment_scripts/puppet/modules/redis/manifests/sentinel.pp
+++ b/deployment_scripts/puppet/modules/redis/manifests/sentinel.pp
@@ -47,6 +47,7 @@ class redis::sentinel (
47 $service_restart = true, 47 $service_restart = true,
48 $manage_upstart_scripts = true, 48 $manage_upstart_scripts = true,
49 $package_name = undef, 49 $package_name = undef,
50 $master_name = 'mymaster'
50) { 51) {
51 52
52 include redis::sentinel_params 53 include redis::sentinel_params