From bcd6a9d668af86233b297c862a1a272e63cf598d Mon Sep 17 00:00:00 2001 From: Vladimir Kuklin Date: Tue, 6 Aug 2013 19:46:48 +0400 Subject: [PATCH 1/3] add filter_hash function --- .../lib/puppet/parser/functions/filter_hash.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 deployment/puppet/openstack/lib/puppet/parser/functions/filter_hash.rb diff --git a/deployment/puppet/openstack/lib/puppet/parser/functions/filter_hash.rb b/deployment/puppet/openstack/lib/puppet/parser/functions/filter_hash.rb new file mode 100644 index 0000000000..bbf0529a0c --- /dev/null +++ b/deployment/puppet/openstack/lib/puppet/parser/functions/filter_hash.rb @@ -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 From 89f6752bf8e6039610b5e26cd53f0abe0747a5e6 Mon Sep 17 00:00:00 2001 From: Vladimir Kuklin Date: Tue, 6 Aug 2013 19:49:26 +0400 Subject: [PATCH 2/3] [PRD1156]: Put swift on glance partition --- .../openstack/manifests/swift/storage_node.pp | 2 ++ .../osnailyfacter/manifests/cluster_ha.pp | 8 ++++-- .../manifests/cluster_ha_full.pp | 9 +++++-- .../puppet/swift/manifests/storage/all.pp | 27 +++++++++++++++++-- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/deployment/puppet/openstack/manifests/swift/storage_node.pp b/deployment/puppet/openstack/manifests/swift/storage_node.pp index f404c9254c..45b572a2db 100644 --- a/deployment/puppet/openstack/manifests/swift/storage_node.pp +++ b/deployment/puppet/openstack/manifests/swift/storage_node.pp @@ -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, } diff --git a/deployment/puppet/osnailyfacter/manifests/cluster_ha.pp b/deployment/puppet/osnailyfacter/manifests/cluster_ha.pp index 7f95c75035..a12012d91e 100644 --- a/deployment/puppet/osnailyfacter/manifests/cluster_ha.pp +++ b/deployment/puppet/osnailyfacter/manifests/cluster_ha.pp @@ -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'] @@ -111,6 +112,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 +167,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 } @@ -290,8 +292,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 => "/var/lib/glance/node", + storage_devices => $mountpoints, swift_zone => $swift_zone, swift_local_net_ip => $storage_address, master_swift_proxy_ip => $master_swift_proxy_ip, diff --git a/deployment/puppet/osnailyfacter/manifests/cluster_ha_full.pp b/deployment/puppet/osnailyfacter/manifests/cluster_ha_full.pp index 56ae1b82e4..aaa87da191 100644 --- a/deployment/puppet/osnailyfacter/manifests/cluster_ha_full.pp +++ b/deployment/puppet/osnailyfacter/manifests/cluster_ha_full.pp @@ -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'] @@ -128,6 +129,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 +169,7 @@ $manage_volumes = false $glance_backend = 'swift' $quantum_netnode_on_cnt = true -$swift_loopback = 'loopback' +$swift_loopback = false $mirror_type = 'external' class ha_controller ( @@ -364,7 +366,10 @@ 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 => "/var/lib/glance/node", + storage_devices => $mountpoints, swift_zone => $swift_zone, swift_local_net_ip => $swift_local_net_ip, master_swift_proxy_ip => $master_swift_proxy_ip, diff --git a/deployment/puppet/swift/manifests/storage/all.pp b/deployment/puppet/swift/manifests/storage/all.pp index 529bc44bdc..d15d1f673b 100644 --- a/deployment/puppet/swift/manifests/storage/all.pp +++ b/deployment/puppet/swift/manifests/storage/all.pp @@ -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, From 216e469a220177a6c9b9bcf4655bcc24331a1682 Mon Sep 17 00:00:00 2001 From: Vladimir Kuklin Date: Tue, 6 Aug 2013 22:15:42 +0400 Subject: [PATCH 3/3] fix cinder and swift mount point --- .../puppet/osnailyfacter/manifests/cluster_ha.pp | 12 ++++++++++-- .../osnailyfacter/manifests/cluster_ha_full.pp | 10 ++++++++-- .../puppet/osnailyfacter/manifests/cluster_simple.pp | 2 ++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/deployment/puppet/osnailyfacter/manifests/cluster_ha.pp b/deployment/puppet/osnailyfacter/manifests/cluster_ha.pp index a12012d91e..08969bb75c 100644 --- a/deployment/puppet/osnailyfacter/manifests/cluster_ha.pp +++ b/deployment/puppet/osnailyfacter/manifests/cluster_ha.pp @@ -58,6 +58,12 @@ else { $floating_ips_range = parsejson($floating_network_range) } +if !$swift_partition +{ + $swift_partition = '/var/lib/glance/node' +} + + ##CALCULATED PARAMETERS @@ -234,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, @@ -294,7 +301,7 @@ class virtual_ips () { class { 'openstack::swift::storage_node': storage_type => $swift_loopback, loopback_size => '5243780', - storage_mnt_base_dir => "/var/lib/glance/node", + storage_mnt_base_dir => $swift_partition, storage_devices => $mountpoints, swift_zone => $swift_zone, swift_local_net_ip => $storage_address, @@ -374,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], diff --git a/deployment/puppet/osnailyfacter/manifests/cluster_ha_full.pp b/deployment/puppet/osnailyfacter/manifests/cluster_ha_full.pp index aaa87da191..e78821eb53 100644 --- a/deployment/puppet/osnailyfacter/manifests/cluster_ha_full.pp +++ b/deployment/puppet/osnailyfacter/manifests/cluster_ha_full.pp @@ -72,7 +72,10 @@ if !$debug $debug = 'true' } - +if !$swift_partition +{ + $swift_partition = '/srv/node' +} ##CALCULATED PARAMETERS @@ -244,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, @@ -345,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, @@ -368,13 +373,14 @@ case $role { class { 'openstack::swift::storage_node': storage_type => $swift_loopback, loopback_size => '5243780', - storage_mnt_base_dir => "/var/lib/glance/node", + 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, diff --git a/deployment/puppet/osnailyfacter/manifests/cluster_simple.pp b/deployment/puppet/osnailyfacter/manifests/cluster_simple.pp index cc4e548440..28e4515c55 100644 --- a/deployment/puppet/osnailyfacter/manifests/cluster_simple.pp +++ b/deployment/puppet/osnailyfacter/manifests/cluster_simple.pp @@ -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,