commit
af42de29af
|
@ -0,0 +1,13 @@
|
|||
module Puppet::Parser::Functions
|
||||
newfunction(:filter_hash, :type => :rvalue, :doc => <<-EOS
|
||||
Map array of hashes $arg0 to an array yielding
|
||||
an element from each hash by key $arg1
|
||||
EOS
|
||||
) do |args|
|
||||
hash = args[0]
|
||||
field = args[1]
|
||||
hash.map do |e|
|
||||
e[field]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -65,6 +65,8 @@ class openstack::swift::storage_node (
|
|||
# install all swift storage servers together
|
||||
class { 'swift::storage::all':
|
||||
storage_local_net_ip => $swift_local_net_ip,
|
||||
devices => $storage_mnt_base_dir,
|
||||
devices_dirs => $storage_devices,
|
||||
swift_zone => $swift_zone,
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ $swift_hash = parsejson($::swift)
|
|||
$cinder_hash = parsejson($::cinder)
|
||||
$access_hash = parsejson($::access)
|
||||
$nodes_hash = parsejson($::nodes)
|
||||
$mp_hash = parsejson($::mp)
|
||||
$network_manager = "nova.network.manager.${novanetwork_params['network_manager']}"
|
||||
$network_size = $novanetwork_params['network_size']
|
||||
$num_networks = $novanetwork_params['num_networks']
|
||||
|
@ -57,6 +58,12 @@ else {
|
|||
$floating_ips_range = parsejson($floating_network_range)
|
||||
}
|
||||
|
||||
if !$swift_partition
|
||||
{
|
||||
$swift_partition = '/var/lib/glance/node'
|
||||
}
|
||||
|
||||
|
||||
##CALCULATED PARAMETERS
|
||||
|
||||
|
||||
|
@ -111,6 +118,7 @@ $controller_storage_addresses = nodes_to_hash($controllers,'name','storage_addre
|
|||
$controller_hostnames = keys($controller_internal_addresses)
|
||||
$controller_nodes = sort(values($controller_internal_addresses))
|
||||
$controller_node_public = $management_vip
|
||||
$mountpoints = filter_hash($mp_hash,'point')
|
||||
$swift_proxies = $controller_storage_addresses
|
||||
$quantum_metadata_proxy_shared_secret = $quantum_params['metadata_proxy_shared_secret']
|
||||
|
||||
|
@ -165,7 +173,7 @@ $multi_host = true
|
|||
$manage_volumes = false
|
||||
$glance_backend = 'swift'
|
||||
$quantum_netnode_on_cnt = true
|
||||
$swift_loopback = 'loopback'
|
||||
$swift_loopback = false
|
||||
$mirror_type = 'external'
|
||||
Exec { logoutput => true }
|
||||
|
||||
|
@ -232,7 +240,8 @@ class compact_controller (
|
|||
cinder_user_password => $cinder_hash[user_password],
|
||||
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
|
||||
cinder_db_password => $cinder_hash[db_password],
|
||||
manage_volumes => false,
|
||||
cinder_volume_group => "cinder",
|
||||
manage_volumes => $is_cinder_node,
|
||||
galera_nodes => $controller_nodes,
|
||||
custom_mysql_setup_class => $custom_mysql_setup_class,
|
||||
mysql_skip_name_resolve => true,
|
||||
|
@ -290,8 +299,10 @@ class virtual_ips () {
|
|||
|
||||
class { compact_controller: }
|
||||
class { 'openstack::swift::storage_node':
|
||||
storage_type => 'loopback',
|
||||
storage_type => $swift_loopback,
|
||||
loopback_size => '5243780',
|
||||
storage_mnt_base_dir => $swift_partition,
|
||||
storage_devices => $mountpoints,
|
||||
swift_zone => $swift_zone,
|
||||
swift_local_net_ip => $storage_address,
|
||||
master_swift_proxy_ip => $master_swift_proxy_ip,
|
||||
|
@ -370,6 +381,7 @@ class virtual_ips () {
|
|||
vncproxy_host => $public_vip,
|
||||
verbose => $verbose,
|
||||
debug => $debug,
|
||||
cinder_volume_group => "cinder",
|
||||
vnc_enabled => true,
|
||||
manage_volumes => $cinder ? { false => $manage_volumes, default =>$is_cinder_node },
|
||||
nova_user_password => $nova_hash[user_password],
|
||||
|
|
|
@ -38,6 +38,7 @@ $swift_hash = parsejson($::swift)
|
|||
$cinder_hash = parsejson($::cinder)
|
||||
$access_hash = parsejson($::access)
|
||||
$nodes_hash = parsejson($::nodes)
|
||||
$mp_hash = parsejson($::mp)
|
||||
$tenant_network_type = $quantum_params['tenant_network_type']
|
||||
$segment_range = $quantum_params['segment_range']
|
||||
$vlan_start = $novanetwork_params['vlan_start']
|
||||
|
@ -71,7 +72,10 @@ if !$debug
|
|||
$debug = 'true'
|
||||
}
|
||||
|
||||
|
||||
if !$swift_partition
|
||||
{
|
||||
$swift_partition = '/srv/node'
|
||||
}
|
||||
|
||||
|
||||
##CALCULATED PARAMETERS
|
||||
|
@ -128,6 +132,7 @@ $controller_nodes = sort(values($controller_internal_addresses))
|
|||
$swift_proxy_nodes = merge_arrays(filter_nodes($nodes_hash,'role','primary-swift-proxy'),filter_nodes($nodes,'role','swift-proxy'))
|
||||
$swift_proxies = nodes_to_hash($swift_proxy_nodes,'name','storage_address')
|
||||
$swift_storages = filter_nodes($nodes_hash, 'role', 'storage')
|
||||
$mountpoints = filter_hash($mp_hash,'point')
|
||||
$controller_node_public = $management_vip
|
||||
$quantum_metadata_proxy_shared_secret = $quantum_params['metadata_proxy_shared_secret']
|
||||
$quantum_gre_bind_addr = $::internal_address
|
||||
|
@ -167,7 +172,7 @@ $manage_volumes = false
|
|||
$glance_backend = 'swift'
|
||||
$quantum_netnode_on_cnt = true
|
||||
|
||||
$swift_loopback = 'loopback'
|
||||
$swift_loopback = false
|
||||
$mirror_type = 'external'
|
||||
|
||||
class ha_controller (
|
||||
|
@ -242,6 +247,7 @@ class ha_controller (
|
|||
segment_range => $segment_range,
|
||||
cinder => true,
|
||||
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
|
||||
cinder_volume_group => "cinder",
|
||||
manage_volumes => $cinder ? { false => $manage_volumes, default =>$is_cinder_node },
|
||||
galera_nodes => $controller_nodes,
|
||||
custom_mysql_setup_class => $custom_mysql_setup_class,
|
||||
|
@ -343,6 +349,7 @@ case $role {
|
|||
segment_range => $segment_range,
|
||||
cinder => $cinder,
|
||||
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
|
||||
cinder_volume_group => "cinder",
|
||||
manage_volumes => $cinder ? { false => $manage_volumes, default =>$is_cinder_node },
|
||||
db_host => $management_vip,
|
||||
cinder_rate_limits => $::cinder_rate_limits,
|
||||
|
@ -364,12 +371,16 @@ case $role {
|
|||
$swift_zone = $node[0]['swift_zone']
|
||||
|
||||
class { 'openstack::swift::storage_node':
|
||||
storage_type => $swift_loopback,
|
||||
storage_type => $swift_loopback,
|
||||
loopback_size => '5243780',
|
||||
storage_mnt_base_dir => $swift_partition,
|
||||
storage_devices => $mountpoints,
|
||||
swift_zone => $swift_zone,
|
||||
swift_local_net_ip => $swift_local_net_ip,
|
||||
master_swift_proxy_ip => $master_swift_proxy_ip,
|
||||
cinder => $cinder,
|
||||
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
|
||||
cinder_volume_group => "cinder",
|
||||
manage_volumes => $cinder ? { false => $manage_volumes, default =>$is_cinder_node },
|
||||
db_host => $management_vip,
|
||||
service_endpoint => $management_vip,
|
||||
|
|
|
@ -167,6 +167,7 @@ if !$debug
|
|||
cinder_user_password => $cinder_hash[user_password],
|
||||
cinder_db_password => $cinder_hash[db_password],
|
||||
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
|
||||
cinder_volume_group => "cinder",
|
||||
manage_volumes => $cinder ? { false => $manage_volumes, default =>$is_cinder_node },
|
||||
use_syslog => true,
|
||||
syslog_log_level => $syslog_log_level,
|
||||
|
@ -300,6 +301,7 @@ if !$debug
|
|||
cinder_user_password => $cinder_hash[user_password],
|
||||
cinder_db_password => $cinder_hash[db_password],
|
||||
cinder_iscsi_bind_addr => $cinder_iscsi_bind_addr,
|
||||
cinder_volume_group => "cinder",
|
||||
manage_volumes => $cinder ? { false => $manage_volumes, default =>$is_cinder_node },
|
||||
db_host => $controller_node_address,
|
||||
verbose => $verbose,
|
||||
|
|
|
@ -19,6 +19,7 @@ class swift::storage::all(
|
|||
$swift_zone,
|
||||
$storage_local_net_ip,
|
||||
$devices = '/srv/node',
|
||||
$devices_dirs = undef,
|
||||
$object_port = '6000',
|
||||
$container_port = '6001',
|
||||
$account_port = '6002',
|
||||
|
@ -32,8 +33,8 @@ class swift::storage::all(
|
|||
storage_local_net_ip => $storage_local_net_ip,
|
||||
}
|
||||
|
||||
if(!defined(File['/srv/node'])) {
|
||||
file {'/srv/node':
|
||||
if(!defined(File[$devices])) {
|
||||
file {$devices:
|
||||
ensure => 'directory',
|
||||
owner => 'swift',
|
||||
group => 'swift',
|
||||
|
@ -42,6 +43,28 @@ class swift::storage::all(
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
define device_directory($devices){
|
||||
if ! defined(File["${devices}/${name}"]){
|
||||
file{"${devices}/${name}":
|
||||
ensure => 'directory',
|
||||
owner => 'swift',
|
||||
group => 'swift',
|
||||
recurse => true,
|
||||
recurselimit => 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($devices_dirs != undef){
|
||||
device_directory {$devices_dirs :
|
||||
devices => $devices,
|
||||
require => File[$devices]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Swift::Storage::Server {
|
||||
swift_zone => $swift_zone,
|
||||
devices => $devices,
|
||||
|
|
Loading…
Reference in New Issue