Renamed storage::device to storage::server

Changed the name of the defined resource type:
swift::storage::device to be swift::storage::server.

This change was made in order to better align with
the swift terminology since this define was
configuring a swift component server which has no
direct association with a device.

This commit also makes the swift::storage::server
the only place where the swift server template is
used. This allowed me to assume that the variables
device and bind_port will always be available.

Also updates declarations of the renamed type to
use the correct type name.

Removes the direct server file config from
swift::storage, replacing it instead with
declarations of swift::storage::server.
This commit is contained in:
Dan Bode
2012-02-14 14:09:01 -08:00
parent c56bc60bfd
commit 44b1c56d74
6 changed files with 28 additions and 33 deletions

View File

@@ -21,7 +21,8 @@
class swift::storage(
$package_ensure = 'present',
# TODO - should this default to 0.0.0.0?
$storage_local_net_ip = '127.0.0.1'
$storage_local_net_ip = '127.0.0.1',
$devices = '/srv/nodes'
) inherits swift {
@@ -42,6 +43,11 @@ class swift::storage(
group => 'swift',
}
Swift::Storage::Server {
devices => $devices,
storage_local_net_ip => $storage_local_net_ip,
}
# package dependencies
package { ['xfsprogs', 'parted']:
ensure => 'present'
@@ -51,10 +57,9 @@ class swift::storage(
ensure => $package_ensure,
}
file { '/etc/swift/account-server.conf':
ensure => present,
mode => 0660,
content => template('swift/account-server.conf.erb')
swift::storage::server { '6002':
type => 'account',
config_file_path => 'account-server.conf',
}
file { '/etc/swift/account-server/':
@@ -65,14 +70,14 @@ class swift::storage(
provider => 'upstart',
}
# container server configuration
package { 'swift-container':
ensure => $package_ensure,
}
file { '/etc/swift/container-server.conf':
ensure => present,
mode => 0660,
content => template('swift/container-server.conf.erb')
swift::storage::server { '6001':
type => 'container',
config_file_path => 'container-server.conf',
}
file { '/etc/swift/container-server/':
@@ -83,14 +88,14 @@ class swift::storage(
provider => 'upstart',
}
# object server configuration
package { 'swift-object':
ensure => $package_ensure,
}
file { '/etc/swift/object-server.conf':
ensure => present,
mode => 0660,
content => template('swift/object-server.conf.erb')
swift::storage::server { '6000':
type => 'object',
config_file_path => 'object-server.conf',
}
file { '/etc/swift/object-server/':

View File

@@ -15,7 +15,7 @@ define swift::storage::node(
$manage_ring = true
) {
Swift::Storage::Device {
Swift::Storage::Server {
storage_local_net_ip => $storage_local_net_ip,
devices => $mnt_base_dir,
max_connections => $max_connections,
@@ -23,7 +23,7 @@ define swift::storage::node(
group => $group,
}
swift::storage::device { "60${name}0":
swift::storage::server { "60${name}0":
type => 'object',
}
ring_object_device { "${storage_local_net_ip}:60${name}0":
@@ -32,7 +32,7 @@ define swift::storage::node(
weight => $weight,
}
swift::storage::device { "60${name}1":
swift::storage::server { "60${name}1":
type => 'container',
}
ring_container_device { "${storage_local_net_ip}:60${name}1":
@@ -41,7 +41,7 @@ define swift::storage::node(
weight => $weight,
}
swift::storage::device { "60${name}2":
swift::storage::server { "60${name}2":
type => 'account',
}
ring_account_device { "${storage_local_net_ip}:60${name}2":

View File

@@ -3,13 +3,15 @@
# - should it be device?
#
# name - is going to be port
define swift::storage::device(
define swift::storage::server(
$type,
$devices = '/srv/node',
$owner = 'swift',
$group = 'swift',
$max_connections = 25,
$storage_local_net_ip = '127.0.0.1'
$storage_local_net_ip = '127.0.0.1',
# this parameters needs to be specified after type and name
$config_file_path = "${type}-server/${name}.conf"
) {
validate_re($name, '^\d+$')
@@ -19,7 +21,7 @@ define swift::storage::device(
# This makes me think that perhaps the rsync class
# should be split into install and config
#
Swift::Storage::Device[$name] ~> Service['rsync']
Swift::Storage::Server[$name] ~> Service['rsync']
$bind_port = $name
@@ -32,7 +34,7 @@ define swift::storage::device(
read_only => false,
}
file { "/etc/swift/${type}-server/${name}.conf":
file { "/etc/swift/${config_file_path}":
content => template("swift/${type}-server.conf.erb"),
owner => $owner,
group => $group,

View File

@@ -1,11 +1,7 @@
[DEFAULT]
<% if has_variable?('devices') -%>
devices = <%= devices %>
<% end -%>
bind_ip = <%= storage_local_net_ip %>
<% if has_variable?('bind_port') -%>
bind_port = <%= bind_port %>
<% end -%>
mount_check = false
user = swift
log_facility = LOG_LOCAL2

View File

@@ -1,11 +1,7 @@
[DEFAULT]
<% if has_variable?('devices') -%>
devices = <%= devices %>
<% end -%>
bind_ip = <%= storage_local_net_ip %>
<% if has_variable?('bind_port') -%>
bind_port = <%= bind_port %>
<% end -%>
mount_check = false
user = swift
log_facility = LOG_LOCAL2

View File

@@ -1,11 +1,7 @@
[DEFAULT]
<% if has_variable?('devices') -%>
devices = <%= devices %>
<% end -%>
bind_ip = <%= storage_local_net_ip %>
<% if has_variable?('bind_port') -%>
bind_port = <%= bind_port %>
<% end -%>
mount_check = false
user = swift
log_facility = LOG_LOCAL2