Add defines for managing devices and rings
Implements three defines that can be used to manage the three kinds of swift devices: - objects - accounts - containers These defines wrap swift::storage::device (which manages rsync modules and swift device configuration) and add additional resources for managing the ring device entries. The defines accept a parameter called manage_ring which can be used to specify rather the ringbuilding resources should be declared or exported.
This commit is contained in:
45
manifests/storage/device/account.pp
Normal file
45
manifests/storage/device/account.pp
Normal file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# 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,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
44
manifests/storage/device/container.pp
Normal file
44
manifests/storage/device/container.pp
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# 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,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
44
manifests/storage/device/object.pp
Normal file
44
manifests/storage/device/object.pp
Normal file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# 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,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user