Adding support for ext4 devices
XFS may not be available on all systems
This commit is contained in:
parent
682c6931dc
commit
7034190780
@ -2,6 +2,7 @@ fixtures:
|
|||||||
repositories:
|
repositories:
|
||||||
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
|
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
|
||||||
"concat": "git://github.com/ripienaar/puppet-concat.git"
|
"concat": "git://github.com/ripienaar/puppet-concat.git"
|
||||||
|
"create_resources": "git://github.com/puppetlabs/puppetlabs-create_resources.git"
|
||||||
"keystone": "git://github.com/puppetlabs/puppetlabs-keystone.git"
|
"keystone": "git://github.com/puppetlabs/puppetlabs-keystone.git"
|
||||||
"memcached": "git://github.com/saz/puppet-memcached.git"
|
"memcached": "git://github.com/saz/puppet-memcached.git"
|
||||||
"rsync": "git://github.com/puppetlabs/puppetlabs-rsync.git"
|
"rsync": "git://github.com/puppetlabs/puppetlabs-rsync.git"
|
||||||
|
36
manifests/storage/ext4.pp
Normal file
36
manifests/storage/ext4.pp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# follow the instructions for creating a loopback device
|
||||||
|
# for storage from: http://swift.openstack.org/development_saio.html
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# this define needs to be sent a refresh signal to do anything
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# [*title*]
|
||||||
|
#
|
||||||
|
# [*byte_size*] Byte size to use for every inode in the created filesystem.
|
||||||
|
# It is recommened to use 1024 to ensure that the metadata can fit in a single inode.
|
||||||
|
define swift::storage::ext4(
|
||||||
|
$device,
|
||||||
|
$byte_size = '1024',
|
||||||
|
$mnt_base_dir = '/srv/node',
|
||||||
|
$loopback = false
|
||||||
|
) {
|
||||||
|
|
||||||
|
# does this have to be refreshonly?
|
||||||
|
# how can I know if this drive has been formatted?
|
||||||
|
exec { "mkfs-${name}":
|
||||||
|
command => "mkfs.ext4 -I ${byte_size} -F ${device}",
|
||||||
|
path => ['/sbin/'],
|
||||||
|
refreshonly => true,
|
||||||
|
}
|
||||||
|
|
||||||
|
swift::storage::mount { $name:
|
||||||
|
device => $device,
|
||||||
|
mnt_base_dir => $mnt_base_dir,
|
||||||
|
subscribe => Exec["mkfs-${name}"],
|
||||||
|
loopback => $loopback,
|
||||||
|
fstype => 'ext4',
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -10,7 +10,8 @@ define swift::storage::loopback(
|
|||||||
$base_dir = '/srv/loopback-device',
|
$base_dir = '/srv/loopback-device',
|
||||||
$mnt_base_dir = '/srv/node',
|
$mnt_base_dir = '/srv/node',
|
||||||
$byte_size = '1024',
|
$byte_size = '1024',
|
||||||
$seek = '25000'
|
$seek = '25000',
|
||||||
|
$fstype = 'xfs'
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if(!defined(File[$base_dir])) {
|
if(!defined(File[$base_dir])) {
|
||||||
@ -34,12 +35,13 @@ define swift::storage::loopback(
|
|||||||
require => File[$base_dir],
|
require => File[$base_dir],
|
||||||
}
|
}
|
||||||
|
|
||||||
swift::storage::xfs { $name:
|
$storage_params = {
|
||||||
device => "${base_dir}/${name}",
|
device => "${base_dir}/${name}",
|
||||||
mnt_base_dir => $mnt_base_dir,
|
mnt_base_dir => $mnt_base_dir,
|
||||||
byte_size => $byte_size,
|
byte_size => $byte_size,
|
||||||
subscribe => Exec["create_partition-${name}"],
|
subscribe => Exec["create_partition-${name}"],
|
||||||
loopback => true,
|
loopback => true,
|
||||||
}
|
}
|
||||||
|
$device_config_hash = {"$name" => $storage_params,}
|
||||||
|
create_resources("swift::storage::$fstype", $device_config_hash)
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,22 @@
|
|||||||
define swift::storage::mount(
|
define swift::storage::mount(
|
||||||
$device,
|
$device,
|
||||||
$mnt_base_dir = '/srv/node',
|
$mnt_base_dir = '/srv/node',
|
||||||
$loopback = false
|
$loopback = false,
|
||||||
|
$fstype = 'xfs'
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if($loopback){
|
if($loopback){
|
||||||
$options = 'noatime,nodiratime,nobarrier,logbufs=8,loop'
|
$options = 'noatime,nodiratime,nobarrier,loop'
|
||||||
} else {
|
} else {
|
||||||
$options = 'noatime,nodiratime,nobarrier,logbufs=8'
|
$options = 'noatime,nodiratime,nobarrier'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($fstype == 'xfs'){
|
||||||
|
$fsoptions = 'logbufs=8'
|
||||||
|
} else {
|
||||||
|
$fsoptions = 'user_xattr'
|
||||||
|
}
|
||||||
|
|
||||||
# the directory that represents the mount point
|
# the directory that represents the mount point
|
||||||
# needs to exist
|
# needs to exist
|
||||||
file { "${mnt_base_dir}/${name}":
|
file { "${mnt_base_dir}/${name}":
|
||||||
@ -24,8 +33,8 @@ define swift::storage::mount(
|
|||||||
mount { "${mnt_base_dir}/${name}":
|
mount { "${mnt_base_dir}/${name}":
|
||||||
ensure => present,
|
ensure => present,
|
||||||
device => $device,
|
device => $device,
|
||||||
fstype => 'xfs',
|
fstype => $fstype,
|
||||||
options => $options,
|
options => "$options,$fsoptions",
|
||||||
require => File["${mnt_base_dir}/${name}"]
|
require => File["${mnt_base_dir}/${name}"]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ describe 'swift::storage::mount' do
|
|||||||
|
|
||||||
it { should contain_mount('/srv/node/dans_mount_point').with(
|
it { should contain_mount('/srv/node/dans_mount_point').with(
|
||||||
:device => '/dev/sda',
|
:device => '/dev/sda',
|
||||||
:options => 'noatime,nodiratime,nobarrier,logbufs=8,loop'
|
:options => 'noatime,nodiratime,nobarrier,loop,logbufs=8'
|
||||||
)}
|
)}
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user