From 310ca91b594f8fb79960a38aee73c077d81b17e5 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Mon, 13 Feb 2012 16:50:41 -0800 Subject: [PATCH] Removed swift::storage::device::* defines Previously, I had created a define intended to wrap the creation of the storage device endpoints with their associated ring configs. I wound up decided against this for two reasons: - Abtstracting storage endpoints together with the ring configurations can be confusing b/c it conflates actions associated with the storage role with actions associated with the ringbuilding role. - Abstracting the ring building hides side effects of this manifest from the user (that it will effect the ringbuilder role) This pull request does the following: - removes the swift::storage::device::* defines - update the following code to use swift::storage::device in combination with ring_*_device -- examples/multi -- swift::storage::node --- examples/multi.pp | 52 ++++++++++++++------------ manifests/storage/device/account.pp | 45 ----------------------- manifests/storage/device/container.pp | 44 ---------------------- manifests/storage/device/object.pp | 44 ---------------------- manifests/storage/node.pp | 53 +++++++++++++-------------- 5 files changed, 55 insertions(+), 183 deletions(-) delete mode 100644 manifests/storage/device/account.pp delete mode 100644 manifests/storage/device/container.pp delete mode 100644 manifests/storage/device/object.pp diff --git a/examples/multi.pp b/examples/multi.pp index 10a71d2a..63bb956f 100644 --- a/examples/multi.pp +++ b/examples/multi.pp @@ -121,36 +121,42 @@ class role_swift_proxy inherits role_swift { class role_swift_storage inherits role_swift { - class { 'swift::storage': } + class { 'swift::storage': + storage_local_net_ip => $swift_local_net_ip, + } # create xfs partitions on a loopback device and mount them swift::storage::loopback { '1': - require => Class['swift'], + base_dir => '/srv/loopback-device', + mnt_base_dir => '/srv/node', + require => Class['swift'], } - swift::storage::device::object { '6001': - device_name => '1', - zone => $swift_zone, - weight => 1, + Swift::Storage::Device { storage_local_net_ip => $swift_local_net_ip, - manage_ring => false, + devices => '/srv/node', + } + + swift::storage::device { '8001': type => 'object',} + @@ring_object_device { "${swift_local_net_ip}:8001": + zone => 1, + device_name => 1, + weight => 1, + } + + swift::storage::device { '8002': type => 'container',} + @@ring_container_device { "${swift_local_net_ip}:8002": + zone => 1, + device_name => 1, + weight => 1, + } + + swift::storage::device { '8003': type => 'account',} + @@ring_account_device { "${swift_local_net_ip}:8003": + zone => 1, + device_name => 1, + weight => 1, } - swift::storage::device::container { '6002': - device_name => '1', - zone => $swift_zone, - weight => 1, - storage_local_net_ip => $swift_local_net_ip, - manage_ring => false, - } - swift::storage::device::account { '6003': - device_name => '1', - zone => $swift_zone, - weight => 1, - storage_local_net_ip => $swift_local_net_ip, - manage_ring => false, - } -} -class ring_hack { } diff --git a/manifests/storage/device/account.pp b/manifests/storage/device/account.pp deleted file mode 100644 index a2bee124..00000000 --- a/manifests/storage/device/account.pp +++ /dev/null @@ -1,45 +0,0 @@ -# -# I am not sure if this is the right name -# - should it be device? -# -# name - is going to be port -define swift::storage::device::account( - $device_name, - $zone, - $weight = 1, - $storage_local_net_ip = '127.0.0.1', - $devices = '/srv/node', - $owner = 'swift', - $group = 'swift', - $max_connections = 25, - $manage_ring = true -) { - - swift::storage::device { $name: - type => 'account', - storage_local_net_ip => $storage_local_net_ip, - devices => $devices, - owner => $owner, - group => $group, - max_connections => $max_connections, - } - - # if we are managing the ring on this node - if($manage_ring) { - ring_account_device { "${storage_local_net_ip}:${name}": - zone => $zone, - device_name => $device_name, - weight => $weight, - } - } - else { - # if we are not managing the ring on this node, just export the resource - @@ring_account_device { "${storage_local_net_ip}:${name}": - zone => $zone, - device_name => $device_name, - weight => $weight, - } - - } - -} diff --git a/manifests/storage/device/container.pp b/manifests/storage/device/container.pp deleted file mode 100644 index f35c8385..00000000 --- a/manifests/storage/device/container.pp +++ /dev/null @@ -1,44 +0,0 @@ -# -# I am not sure if this is the right name -# - should it be device? -# -# name - is going to be port -define swift::storage::device::container( - $device_name, - $zone, - $weight = 1, - $storage_local_net_ip = '127.0.0.1', - $devices = '/srv/node', - $owner = 'swift', - $group = 'swift', - $max_connections = 25, - $manage_ring = true -) { - - swift::storage::device { $name: - type => 'container', - storage_local_net_ip => $storage_local_net_ip, - devices => $devices, - owner => $owner, - group => $group, - max_connections => $max_connections, - } - - # if we are managing the ring on this node - if($manage_ring) { - ring_container_device { "${storage_local_net_ip}:${name}": - zone => $zone, - device_name => $device_name, - weight => $weight, - } - } else { - # if we are not managing the ring on this node, just export the resource - @@ring_container_device { "${storage_local_net_ip}:${name}": - zone => $zone, - device_name => $device_name, - weight => $weight, - } - - } - -} diff --git a/manifests/storage/device/object.pp b/manifests/storage/device/object.pp deleted file mode 100644 index 096eaa43..00000000 --- a/manifests/storage/device/object.pp +++ /dev/null @@ -1,44 +0,0 @@ -# -# I am not sure if this is the right name -# - should it be device? -# -# name - is going to be port -define swift::storage::device::object( - $device_name, - $zone, - $weight = 1, - $storage_local_net_ip = '127.0.0.1', - $devices = '/srv/node', - $owner = 'swift', - $group = 'swift', - $max_connections = 25, - $manage_ring = true -) { - - swift::storage::device { $name: - type => 'object', - storage_local_net_ip => $storage_local_net_ip, - devices => $devices, - owner => $owner, - group => $group, - max_connections => $max_connections, - } - - # if we are managing the ring on this node - if($manage_ring) { - ring_object_device { "${storage_local_net_ip}:${name}": - zone => $zone, - device_name => $device_name, - weight => $weight, - } - } else { - # if we are not managing the ring on this node, just export the resource - @@ring_object_device { "${storage_local_net_ip}:${name}": - zone => $zone, - device_name => $device_name, - weight => $weight, - } - - } - -} diff --git a/manifests/storage/node.pp b/manifests/storage/node.pp index f307a4df..4469e719 100644 --- a/manifests/storage/node.pp +++ b/manifests/storage/node.pp @@ -15,40 +15,39 @@ define swift::storage::node( $manage_ring = true ) { - swift::storage::device::object { "60${name}0": + Swift::Storage::Device { + storage_local_net_ip => $storage_local_net_ip, devices => $mnt_base_dir, - device_name => $name, - zone => $zone, - weight => $weight, + max_connections => $max_connections, owner => $owner, group => $group, - max_connections => $max_connections, - storage_local_net_ip => $storage_local_net_ip, - manage_ring => $manage_ring, } - swift::storage::device::container { "60${name}1": - devices => $mnt_base_dir, - device_name => $name, - zone => $zone, - weight => $weight, - owner => $owner, - group => $group, - max_connections => $max_connections, - storage_local_net_ip => $storage_local_net_ip, - manage_ring => $manage_ring, + swift::storage::device { "60${name}0": + type => 'object', + } + ring_object_device { "${storage_local_net_ip}:60${name}0": + zone => $zone, + device_name => $name, + weight => $weight, } - swift::storage::device::account { "60${name}2": - devices => $mnt_base_dir, - device_name => $name, - zone => $zone, - weight => $weight, - owner => $owner, - group => $group, - max_connections => $max_connections, - storage_local_net_ip => $storage_local_net_ip, - manage_ring => $manage_ring, + swift::storage::device { "60${name}1": + type => 'container', + } + ring_container_device { "${storage_local_net_ip}:60${name}1": + zone => $zone, + device_name => $name, + weight => $weight, + } + + swift::storage::device { "60${name}2": + type => 'account', + } + ring_account_device { "${storage_local_net_ip}:60${name}2": + zone => $zone, + device_name => $name, + weight => $weight, } }