Remove dependency on memcached_node_ips_v6

This is set via all_nodes_config in t-h-t, but it's a special case for
this service, so it'll be better if we handle the ipv6 transformation
in puppet instead of relying on the service specific list mangling in
t-h-t (one aspect of which has been identified as a potential performance
problem).

Related-Bug: #1684272
Change-Id: Iccb9089db4b382db3adb9340f18f6d2364ca7f58
This commit is contained in:
Steven Hardy 2017-07-06 12:29:50 +01:00
parent dbc3c765e5
commit 6462e2e3c3
4 changed files with 28 additions and 28 deletions

View File

@ -31,10 +31,15 @@
# (Optional) A hash of parameters to enable features specific to Neutron # (Optional) A hash of parameters to enable features specific to Neutron
# Defaults to hiera('horizon::neutron_options', {}) # Defaults to hiera('horizon::neutron_options', {})
# #
# [*memcached_ips*]
# (Optional) Array of ipv4 or ipv6 addresses for memcache.
# Defaults to hiera('memcached_node_ips')
#
class tripleo::profile::base::horizon ( class tripleo::profile::base::horizon (
$step = Integer(hiera('step')), $step = Integer(hiera('step')),
$bootstrap_node = hiera('bootstrap_nodeid', undef), $bootstrap_node = hiera('bootstrap_nodeid', undef),
$neutron_options = hiera('horizon::neutron_options', {}), $neutron_options = hiera('horizon::neutron_options', {}),
$memcached_ips = hiera('memcached_node_ips')
) { ) {
if $::hostname == downcase($bootstrap_node) { if $::hostname == downcase($bootstrap_node) {
$is_bootstrap = true $is_bootstrap = true
@ -52,12 +57,14 @@ class tripleo::profile::base::horizon (
$_profile_support = 'None' $_profile_support = 'None'
} }
$neutron_options_real = merge({'profile_support' => $_profile_support }, $neutron_options) $neutron_options_real = merge({'profile_support' => $_profile_support }, $neutron_options)
$memcached_ipv6 = hiera('memcached_ipv6', false)
if $memcached_ipv6 { if is_ipv6_address($memcached_ips[0]) {
$horizon_memcached_servers = hiera('memcached_node_ips_v6', '[::1]') $horizon_memcached_servers = prefix(any2array(normalize_ip_for_uri($memcached_ips)), 'inet6:')
} else { } else {
$horizon_memcached_servers = hiera('memcached_node_ips', '127.0.0.1') $horizon_memcached_servers = any2array(normalize_ip_for_uri($memcached_ips))
} }
class { '::horizon': class { '::horizon':
cache_server_ip => $horizon_memcached_servers, cache_server_ip => $horizon_memcached_servers,
neutron_options => $neutron_options_real, neutron_options => $neutron_options_real,

View File

@ -70,6 +70,9 @@
# (Optional) The current step of the deployment # (Optional) The current step of the deployment
# Defaults to hiera('step') # Defaults to hiera('step')
# #
# [*memcached_ips*]
# (Optional) Array of ipv4 or ipv6 addresses for memcache.
# Defaults to hiera('memcached_node_ips')
class tripleo::profile::base::nova ( class tripleo::profile::base::nova (
$bootstrap_node = hiera('bootstrap_nodeid', undef), $bootstrap_node = hiera('bootstrap_nodeid', undef),
@ -85,6 +88,7 @@ class tripleo::profile::base::nova (
$oslomsg_notify_username = hiera('nova::rabbit_userid', 'guest'), $oslomsg_notify_username = hiera('nova::rabbit_userid', 'guest'),
$oslomsg_use_ssl = hiera('nova::rabbit_use_ssl', '0'), $oslomsg_use_ssl = hiera('nova::rabbit_use_ssl', '0'),
$step = Integer(hiera('step')), $step = Integer(hiera('step')),
$memcached_ips = hiera('memcached_node_ips'),
) { ) {
if $::hostname == downcase($bootstrap_node) { if $::hostname == downcase($bootstrap_node) {
@ -93,10 +97,10 @@ class tripleo::profile::base::nova (
$sync_db = false $sync_db = false
} }
if hiera('nova::use_ipv6', false) { if is_ipv6_address($memcached_ips[0]) {
$memcache_servers = suffix(hiera('memcached_node_ips_v6'), ':11211') $memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
} else { } else {
$memcache_servers = suffix(hiera('memcached_node_ips'), ':11211') $memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
} }
if $step >= 4 or ($step >= 3 and $sync_db) { if $step >= 4 or ($step >= 3 and $sync_db) {

View File

@ -21,34 +21,22 @@
# for more details. # for more details.
# Defaults to hiera('step') # Defaults to hiera('step')
# #
# [*use_ipv6*] # [*memcached_ips*]
# (Optional) Flag indicating if ipv6 should be used for caching # (Optional) Array of ipv4 or ipv6 addresses for memcache.
# Defaults to hiera('nova::use_ipv6', false) # Defaults to hiera('memcached_node_ips')
#
# [*memcache_nodes_ipv6*]
# (Optional) Array of ipv6 addresses for memcache. Used if use_ipv6 is true.
# Defaults to hiera('memcached_node_ipvs_v6', ['::1'])
#
# [*memcache_nodes_ipv4*]
# (Optional) Array of ipv4 addresses for memcache. Used by default unless
# use_ipv6 is set to true.
# Defaults to hiera('memcached_node_ips', ['127.0.0.1'])
# #
class tripleo::profile::base::nova::authtoken ( class tripleo::profile::base::nova::authtoken (
$step = Integer(hiera('step')), $step = Integer(hiera('step')),
$use_ipv6 = hiera('nova::use_ipv6', false), $memcached_ips = hiera('memcached_node_ips'),
$memcache_nodes_ipv6 = hiera('memcached_node_ips_v6', ['::1']),
$memcache_nodes_ipv4 = hiera('memcached_node_ips', ['127.0.0.1']),
) { ) {
if $step >= 3 { if $step >= 3 {
$memcached_ips = $use_ipv6 ? { if is_ipv6_address($memcached_ips[0]) {
true => $memcache_nodes_ipv6, $memcache_servers = prefix(suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211'), 'inet6:')
default => $memcache_nodes_ipv4 } else {
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
} }
$memcache_servers = suffix(any2array(normalize_ip_for_uri($memcached_ips)), ':11211')
class { '::nova::keystone::authtoken': class { '::nova::keystone::authtoken':
memcached_servers => $memcache_servers memcached_servers => $memcache_servers
} }

View File

@ -32,6 +32,7 @@ describe 'tripleo::profile::base::nova::authtoken' do
context 'with step 3' do context 'with step 3' do
let(:params) { { let(:params) { {
:step => 3, :step => 3,
:memcached_ips => '127.0.0.1',
} } } }
it { it {
@ -44,7 +45,7 @@ describe 'tripleo::profile::base::nova::authtoken' do
context 'with step 3 with ipv6' do context 'with step 3 with ipv6' do
let(:params) { { let(:params) { {
:step => 3, :step => 3,
:use_ipv6 => true, :memcached_ips => '::1',
} } } }
it { it {