Memcached task

Configures memcached in a separate task.

CI disabled because it also needs rabbitmq task.

Fuel-CI: disable
Change-Id: I3984e3d8deea7fe977e3778cd142d6fbb3f91f00
Related-Blueprint: fuel-library-modularization
This commit is contained in:
Aleksandr Didenko 2015-03-03 19:34:59 +02:00
parent 3d2f312c33
commit 58372157fc
4 changed files with 97 additions and 6 deletions

View File

@ -361,12 +361,6 @@ class openstack::controller (
} #end else
} #end cinder
if !defined(Class['memcached']){
class { 'memcached':
listen_ip => $memcached_bind_address,
}
}
######## Ceilometer ########
if ($ceilometer) {

View File

@ -0,0 +1,4 @@
notice('MODULAR: memcached.pp')
class { 'memcached':
listen_ip => hiera('internal_address'),
}

View File

@ -0,0 +1,82 @@
require 'hiera'
require 'test/unit'
require 'socket'
def hiera
return $hiera if $hiera
$hiera = Hiera.new(:config => '/etc/puppet/hiera.yaml')
end
def internal_address
return $internal_address if $internal_address
$internal_address = hiera.lookup 'internal_address', nil, {}
end
def process_tree
return $process_tree if $process_tree
$process_tree = {}
ps = `ps haxo pid,ppid,cmd`
ps.split("\n").each do |p|
f = p.split
pid = f.shift.to_i
ppid = f.shift.to_i
cmd = f.join ' '
# create entry for this pid if not present
$process_tree[pid] = {
:children => []
} unless $process_tree.key? pid
# fill this entry
$process_tree[pid][:ppid] = ppid
$process_tree[pid][:pid] = pid
$process_tree[pid][:cmd] = cmd
unless ppid == 0
# create entry for parent process if not present
$process_tree[ppid] = {
:children => [],
:cmd => '',
} unless $process_tree.key? ppid
# fill parent's children
$process_tree[ppid][:children] << pid
end
end
$process_tree
end
def test_connection(host, port)
begin
s = TCPSocket.open(host, port)
s.close
rescue
return false
end
true
end
def memcached_backend_online?
test_connection(internal_address, '11211')
end
PROCESSES = %w(
memcached
)
class MemcachedPostTest < Test::Unit::TestCase
def self.create_tests
PROCESSES.each do |process|
method_name = "test_iprocess_#{process}_running"
define_method method_name do
assert process_tree.find { |pid, proc| proc[:cmd].include? process }, "Process '#{process}' is not running!"
end
end
end
def test_memcached_backend_online
assert memcached_backend_online?, 'Can not connect to memcached on this host!'
end
end
MemcachedPostTest.create_tests

View File

@ -0,0 +1,11 @@
- id: memcached
type: puppet
groups: [primary-controller, controller]
required_for: [deploy_end, keystone]
requires: [openstack-haproxy]
parameters:
puppet_manifest: /etc/puppet/modules/osnailyfacter/modular/memcached/memcached.pp
puppet_modules: /etc/puppet/modules
timeout: 3600
test_post:
cmd: ruby /etc/puppet/modules/osnailyfacter/modular/memcached/memcached_post.rb