Files
puppet-openstack/manifests/swift/storage-node.pp
newptone 255444266b Update openstack::swift to support disk storage_type
As the swift::disk patch added in puppet-swift, this patch
update the openstack::swift::storage-node to support disk
storage_type.

Fix bug 1191339

Change-Id: I22e9b565b004ca9be5beb0a843dd4dfd4d29e552
2013-06-22 11:27:40 +08:00

67 lines
1.8 KiB
Puppet

class openstack::swift::storage-node (
$swift_zone,
$swift_hash_suffix = 'swift_secret',
$swift_local_net_ip = $::ipaddress_eth0,
$storage_type = 'loopback',
$storage_base_dir = '/srv/loopback-device',
$storage_mnt_base_dir = '/srv/node',
$storage_devices = ['1', '2'],
$storage_weight = 1,
$package_ensure = 'present',
$byte_size = '1024',
) {
class { 'swift':
swift_hash_suffix => $swift_hash_suffix,
package_ensure => $package_ensure,
}
case $storage_type {
'loopback': {
# create xfs partitions on a loopback device and mount them
swift::storage::loopback { $storage_devices:
base_dir => $storage_base_dir,
mnt_base_dir => $storage_mnt_base_dir,
require => Class['swift'],
}
}
# make xfs filesystem on physical disk and mount them
'disk': {
swift::storage::disk {$storage_devices:
mnt_base_dir => $storage_mnt_base_dir,
byte_size => $byte_size,
}
}
}
# install all swift storage servers together
class { 'swift::storage::all':
storage_local_net_ip => $swift_local_net_ip,
}
define device_endpoint ($swift_local_net_ip, $zone, $weight) {
@@ring_object_device { "${swift_local_net_ip}:6000/${name}":
zone => $zone,
weight => $weight,
}
@@ring_container_device { "${swift_local_net_ip}:6001/${name}":
zone => $zone,
weight => $weight,
}
@@ring_account_device { "${swift_local_net_ip}:6002/${name}":
zone => $zone,
weight => $weight,
}
}
device_endpoint { $storage_devices:
swift_local_net_ip => $swift_local_net_ip,
zone => $swift_zone,
weight => $storage_weight,
}
# collect resources for synchronizing the ring databases
Swift::Ringsync<<||>>
}