Merge pull request #477 from enovance/consolidate_ringbuilder
Refactor ringbuilder
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
#
|
#
|
||||||
# Swift ring builder node
|
# Swift ring builder node
|
||||||
#
|
#
|
||||||
|
|
||||||
class cloud::object::ringbuilder(
|
class cloud::object::ringbuilder(
|
||||||
$rsyncd_ipaddress = '127.0.0.1',
|
$rsyncd_ipaddress = '127.0.0.1',
|
||||||
$replicas = 3,
|
$replicas = 3,
|
||||||
@@ -28,44 +27,15 @@ class cloud::object::ringbuilder(
|
|||||||
Ring_container_device <<| |>>
|
Ring_container_device <<| |>>
|
||||||
Ring_account_device <<| |>>
|
Ring_account_device <<| |>>
|
||||||
|
|
||||||
Class['swift'] -> Class['cloud::object::ringbuilder']
|
class {'swift::ringbuilder' :
|
||||||
|
|
||||||
swift::ringbuilder::create{ ['account', 'container']:
|
|
||||||
part_power => 9,
|
|
||||||
replicas => $replicas,
|
|
||||||
min_part_hours => 24,
|
|
||||||
}
|
|
||||||
|
|
||||||
swift::ringbuilder::create{'object':
|
|
||||||
part_power => 15,
|
part_power => 15,
|
||||||
replicas => $replicas,
|
replicas => $replicas,
|
||||||
min_part_hours => 24,
|
min_part_hours => 24,
|
||||||
}
|
}
|
||||||
|
|
||||||
Swift::Ringbuilder::Create['object'] -> Ring_object_device <| |> ~> Swift::Ringbuilder::Rebalance['object']
|
class {'swift::ringserver' :
|
||||||
Swift::Ringbuilder::Create['container'] -> Ring_container_device <| |> ~> Swift::Ringbuilder::Rebalance['container']
|
local_net_ip => $rsyncd_ipaddress,
|
||||||
Swift::Ringbuilder::Create['account'] -> Ring_account_device <| |> ~> Swift::Ringbuilder::Rebalance['account']
|
|
||||||
|
|
||||||
swift::ringbuilder::rebalance{ ['object', 'account', 'container']: }
|
|
||||||
|
|
||||||
class { 'rsync::server':
|
|
||||||
use_xinetd => true,
|
|
||||||
address => $rsyncd_ipaddress,
|
|
||||||
use_chroot => 'no',
|
|
||||||
}
|
|
||||||
|
|
||||||
Rsync::Server::Module {
|
|
||||||
incoming_chmod => 'u=rwX,go=rX',
|
|
||||||
outgoing_chmod => 'u=rwX,go=rX',
|
|
||||||
}
|
|
||||||
|
|
||||||
rsync::server::module { 'swift_server':
|
|
||||||
path => '/etc/swift',
|
|
||||||
lock_file => '/var/lock/swift_server.lock',
|
|
||||||
uid => 'swift',
|
|
||||||
gid => 'swift',
|
|
||||||
max_connections => $swift_rsync_max_connections,
|
max_connections => $swift_rsync_max_connections,
|
||||||
read_only => true,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# exports rsync gets that can be used to sync the ring files
|
# exports rsync gets that can be used to sync the ring files
|
||||||
|
|||||||
47
spec/classes/cloud_object_ringbuilder_spec.rb
Normal file
47
spec/classes/cloud_object_ringbuilder_spec.rb
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'cloud::object::ringbuilder' do
|
||||||
|
|
||||||
|
shared_examples_for 'openstack swift ringbuilder' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{
|
||||||
|
:rsyncd_ipaddress => '127.0.0.1',
|
||||||
|
:replicas => 3,
|
||||||
|
:swift_rsync_max_connections => 5,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'create the three rings' do
|
||||||
|
should contain_class('swift::ringbuilder').with({
|
||||||
|
'part_power' => '15',
|
||||||
|
'replicas' => '3',
|
||||||
|
'min_part_hours' => '24',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'create the ring rsync server' do
|
||||||
|
should contain_class('swift::ringserver').with({
|
||||||
|
'local_net_ip' => '127.0.0.1',
|
||||||
|
'max_connections' => '5',
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on Debian platforms' do
|
||||||
|
let :facts do
|
||||||
|
{ :osfamily => 'Debian' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'openstack swift ringbuilder'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on RedHat platforms' do
|
||||||
|
let :facts do
|
||||||
|
{ :osfamily => 'RedHat' }
|
||||||
|
end
|
||||||
|
it_configures 'openstack swift ringbuilder'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user