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:
parent
3d2f312c33
commit
58372157fc
@ -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) {
|
||||
|
@ -0,0 +1,4 @@
|
||||
notice('MODULAR: memcached.pp')
|
||||
class { 'memcached':
|
||||
listen_ip => hiera('internal_address'),
|
||||
}
|
@ -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
|
11
deployment/puppet/osnailyfacter/modular/memcached/tasks.yaml
Normal file
11
deployment/puppet/osnailyfacter/modular/memcached/tasks.yaml
Normal 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
|
Loading…
Reference in New Issue
Block a user