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:
@@ -21,7 +21,8 @@
|
|||||||
class swift::storage(
|
class swift::storage(
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
# TODO - should this default to 0.0.0.0?
|
# 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 {
|
) inherits swift {
|
||||||
|
|
||||||
|
|
||||||
@@ -42,6 +43,11 @@ class swift::storage(
|
|||||||
group => 'swift',
|
group => 'swift',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Swift::Storage::Server {
|
||||||
|
devices => $devices,
|
||||||
|
storage_local_net_ip => $storage_local_net_ip,
|
||||||
|
}
|
||||||
|
|
||||||
# package dependencies
|
# package dependencies
|
||||||
package { ['xfsprogs', 'parted']:
|
package { ['xfsprogs', 'parted']:
|
||||||
ensure => 'present'
|
ensure => 'present'
|
||||||
@@ -51,10 +57,9 @@ class swift::storage(
|
|||||||
ensure => $package_ensure,
|
ensure => $package_ensure,
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/swift/account-server.conf':
|
swift::storage::server { '6002':
|
||||||
ensure => present,
|
type => 'account',
|
||||||
mode => 0660,
|
config_file_path => 'account-server.conf',
|
||||||
content => template('swift/account-server.conf.erb')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/swift/account-server/':
|
file { '/etc/swift/account-server/':
|
||||||
@@ -65,14 +70,14 @@ class swift::storage(
|
|||||||
provider => 'upstart',
|
provider => 'upstart',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# container server configuration
|
||||||
package { 'swift-container':
|
package { 'swift-container':
|
||||||
ensure => $package_ensure,
|
ensure => $package_ensure,
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/swift/container-server.conf':
|
swift::storage::server { '6001':
|
||||||
ensure => present,
|
type => 'container',
|
||||||
mode => 0660,
|
config_file_path => 'container-server.conf',
|
||||||
content => template('swift/container-server.conf.erb')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/swift/container-server/':
|
file { '/etc/swift/container-server/':
|
||||||
@@ -83,14 +88,14 @@ class swift::storage(
|
|||||||
provider => 'upstart',
|
provider => 'upstart',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# object server configuration
|
||||||
package { 'swift-object':
|
package { 'swift-object':
|
||||||
ensure => $package_ensure,
|
ensure => $package_ensure,
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/swift/object-server.conf':
|
swift::storage::server { '6000':
|
||||||
ensure => present,
|
type => 'object',
|
||||||
mode => 0660,
|
config_file_path => 'object-server.conf',
|
||||||
content => template('swift/object-server.conf.erb')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
file { '/etc/swift/object-server/':
|
file { '/etc/swift/object-server/':
|
||||||
|
@@ -15,7 +15,7 @@ define swift::storage::node(
|
|||||||
$manage_ring = true
|
$manage_ring = true
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Swift::Storage::Device {
|
Swift::Storage::Server {
|
||||||
storage_local_net_ip => $storage_local_net_ip,
|
storage_local_net_ip => $storage_local_net_ip,
|
||||||
devices => $mnt_base_dir,
|
devices => $mnt_base_dir,
|
||||||
max_connections => $max_connections,
|
max_connections => $max_connections,
|
||||||
@@ -23,7 +23,7 @@ define swift::storage::node(
|
|||||||
group => $group,
|
group => $group,
|
||||||
}
|
}
|
||||||
|
|
||||||
swift::storage::device { "60${name}0":
|
swift::storage::server { "60${name}0":
|
||||||
type => 'object',
|
type => 'object',
|
||||||
}
|
}
|
||||||
ring_object_device { "${storage_local_net_ip}:60${name}0":
|
ring_object_device { "${storage_local_net_ip}:60${name}0":
|
||||||
@@ -32,7 +32,7 @@ define swift::storage::node(
|
|||||||
weight => $weight,
|
weight => $weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
swift::storage::device { "60${name}1":
|
swift::storage::server { "60${name}1":
|
||||||
type => 'container',
|
type => 'container',
|
||||||
}
|
}
|
||||||
ring_container_device { "${storage_local_net_ip}:60${name}1":
|
ring_container_device { "${storage_local_net_ip}:60${name}1":
|
||||||
@@ -41,7 +41,7 @@ define swift::storage::node(
|
|||||||
weight => $weight,
|
weight => $weight,
|
||||||
}
|
}
|
||||||
|
|
||||||
swift::storage::device { "60${name}2":
|
swift::storage::server { "60${name}2":
|
||||||
type => 'account',
|
type => 'account',
|
||||||
}
|
}
|
||||||
ring_account_device { "${storage_local_net_ip}:60${name}2":
|
ring_account_device { "${storage_local_net_ip}:60${name}2":
|
||||||
|
@@ -3,13 +3,15 @@
|
|||||||
# - should it be device?
|
# - should it be device?
|
||||||
#
|
#
|
||||||
# name - is going to be port
|
# name - is going to be port
|
||||||
define swift::storage::device(
|
define swift::storage::server(
|
||||||
$type,
|
$type,
|
||||||
$devices = '/srv/node',
|
$devices = '/srv/node',
|
||||||
$owner = 'swift',
|
$owner = 'swift',
|
||||||
$group = 'swift',
|
$group = 'swift',
|
||||||
$max_connections = 25,
|
$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+$')
|
validate_re($name, '^\d+$')
|
||||||
@@ -19,7 +21,7 @@ define swift::storage::device(
|
|||||||
# This makes me think that perhaps the rsync class
|
# This makes me think that perhaps the rsync class
|
||||||
# should be split into install and config
|
# should be split into install and config
|
||||||
#
|
#
|
||||||
Swift::Storage::Device[$name] ~> Service['rsync']
|
Swift::Storage::Server[$name] ~> Service['rsync']
|
||||||
|
|
||||||
$bind_port = $name
|
$bind_port = $name
|
||||||
|
|
||||||
@@ -32,7 +34,7 @@ define swift::storage::device(
|
|||||||
read_only => false,
|
read_only => false,
|
||||||
}
|
}
|
||||||
|
|
||||||
file { "/etc/swift/${type}-server/${name}.conf":
|
file { "/etc/swift/${config_file_path}":
|
||||||
content => template("swift/${type}-server.conf.erb"),
|
content => template("swift/${type}-server.conf.erb"),
|
||||||
owner => $owner,
|
owner => $owner,
|
||||||
group => $group,
|
group => $group,
|
@@ -1,11 +1,7 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
<% if has_variable?('devices') -%>
|
|
||||||
devices = <%= devices %>
|
devices = <%= devices %>
|
||||||
<% end -%>
|
|
||||||
bind_ip = <%= storage_local_net_ip %>
|
bind_ip = <%= storage_local_net_ip %>
|
||||||
<% if has_variable?('bind_port') -%>
|
|
||||||
bind_port = <%= bind_port %>
|
bind_port = <%= bind_port %>
|
||||||
<% end -%>
|
|
||||||
mount_check = false
|
mount_check = false
|
||||||
user = swift
|
user = swift
|
||||||
log_facility = LOG_LOCAL2
|
log_facility = LOG_LOCAL2
|
||||||
|
@@ -1,11 +1,7 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
<% if has_variable?('devices') -%>
|
|
||||||
devices = <%= devices %>
|
devices = <%= devices %>
|
||||||
<% end -%>
|
|
||||||
bind_ip = <%= storage_local_net_ip %>
|
bind_ip = <%= storage_local_net_ip %>
|
||||||
<% if has_variable?('bind_port') -%>
|
|
||||||
bind_port = <%= bind_port %>
|
bind_port = <%= bind_port %>
|
||||||
<% end -%>
|
|
||||||
mount_check = false
|
mount_check = false
|
||||||
user = swift
|
user = swift
|
||||||
log_facility = LOG_LOCAL2
|
log_facility = LOG_LOCAL2
|
||||||
|
@@ -1,11 +1,7 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
<% if has_variable?('devices') -%>
|
|
||||||
devices = <%= devices %>
|
devices = <%= devices %>
|
||||||
<% end -%>
|
|
||||||
bind_ip = <%= storage_local_net_ip %>
|
bind_ip = <%= storage_local_net_ip %>
|
||||||
<% if has_variable?('bind_port') -%>
|
|
||||||
bind_port = <%= bind_port %>
|
bind_port = <%= bind_port %>
|
||||||
<% end -%>
|
|
||||||
mount_check = false
|
mount_check = false
|
||||||
user = swift
|
user = swift
|
||||||
log_facility = LOG_LOCAL2
|
log_facility = LOG_LOCAL2
|
||||||
|
Reference in New Issue
Block a user