Skip to content

Commit

Permalink
Add btrfs support.
Browse files Browse the repository at this point in the history
This patch adds btrfs support to puppet-gluster. This is not (yet)
officially supported by GlusterFS but should work. It is being added
here to make it easier to test with GlusterFS and report bugs.

Special thanks to Eric Sandeen for adding --uuid support to mkfs.btrfs:

https://bugzilla.redhat.com/show_bug.cgi?id=1094857

Tracker bug for this feature is:

https://bugzilla.redhat.com/show_bug.cgi?id=1094860
  • Loading branch information
purpleidea committed Sep 26, 2014
1 parent b00516e commit 6c96208
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DOCUMENTATION.md
Expand Up @@ -778,6 +778,8 @@ This should be _xfs_ or _ext4_. Using _xfs_ is recommended, but _ext4_ is also
quite common. This only affects a file system that is getting created by this
module. If you provision a new machine, with a root file system of _ext4_, and
the brick you create is a root file system path, then this option does nothing.
A _btrfs_ option is now available for testing. It is not officially supported
by GlusterFS, but testing it anyways, and reporting any issues is encouraged.

####`xfs_inode64`
Set _inode64_ mount option when using the _xfs_ fstype. Choose _true_ to set.
Expand Down
1 change: 1 addition & 0 deletions data/tree/RedHat/Fedora.yaml
Expand Up @@ -14,6 +14,7 @@ gluster::params::program_vgdisplay: '/usr/sbin/vgdisplay'
#gluster::params::program_lvdisplay: '/usr/sbin/lvdisplay'
gluster::params::program_mkfs_xfs: '/usr/sbin/mkfs.xfs'
gluster::params::program_mkfs_ext4: '/usr/sbin/mkfs.ext4'
gluster::params::program_mkfs_btrfs: '/usr/sbin/mkfs.btrfs'
gluster::params::program_findmnt: '/usr/bin/findmnt'
gluster::params::misc_gluster_reload: '/usr/bin/systemctl reload glusterd'

Expand Down
15 changes: 15 additions & 0 deletions manifests/brick.pp
Expand Up @@ -246,6 +246,7 @@
},
default => $fstype ? {
'ext4' => 'ext4', # TODO
'btrfs' => 'btrfs',
default => 'xfs',
},
}
Expand Down Expand Up @@ -351,6 +352,20 @@

# mount options
$options_list = [] # TODO

} elsif ( $valid_fstype == 'btrfs' ) {
# exec requires
include gluster::brick::btrfs
$exec_requires = [Package["${::gluster::params::package_btrfsprogs}"]]

# FIXME: this filesystem has not yet been optimized for performance

# mkfs w/ uuid command
$mkfs_exec = "${::gluster::params::program_mkfs_btrfs} -U '${valid_fsuuid}' ${dev2}"

# mount options
$options_list = [] # TODO

} else {
fail('The $fstype is invalid.')
}
Expand Down
27 changes: 27 additions & 0 deletions manifests/brick/btrfs.pp
@@ -0,0 +1,27 @@
# GlusterFS module by James
# Copyright (C) 2010-2013+ James Shubin
# Written by James Shubin <james@shubin.ca>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

class gluster::brick::btrfs {

include gluster::params

package { "${::gluster::params::package_btrfsprogs}":
ensure => present,
}
}

# vim: ts=8
2 changes: 2 additions & 0 deletions manifests/params.pp
Expand Up @@ -24,6 +24,7 @@

$package_e2fsprogs = 'e2fsprogs',
$package_xfsprogs = 'xfsprogs',
$package_btrfsprogs = 'btrfs-progs',

$package_python_argparse = 'python-argparse',
$package_python_lxml = 'python-lxml',
Expand All @@ -47,6 +48,7 @@
$program_xfsadmin = '/usr/sbin/xfs_admin',
$program_mkfs_xfs = '/sbin/mkfs.xfs',
$program_mkfs_ext4 = '/sbin/mkfs.ext4',
$program_mkfs_btrfs = '/sbin/mkfs.btrfs',

$program_fping = '/usr/sbin/fping',
$program_findmnt = '/bin/findmnt',
Expand Down
Binary file modified puppet-gluster-documentation.pdf
Binary file not shown.
10 changes: 10 additions & 0 deletions vagrant/Vagrantfile
Expand Up @@ -67,6 +67,7 @@ netmask2 = IPAddr.new('255.255.255.255').mask(cidr2).to_s
count = 4 # default number of gluster hosts to build
disks = 0 # default number of disks to attach (after the host os)
bricks = 0 # default number of bricks to build (0 defaults to 1)
fstype = '' # default filesystem for bricks (requires bricks > 0)
version = '' # default gluster version (empty string means latest!)
firewall = false # default firewall enabled (FIXME: default to true when keepalived bug is fixed)
replica = 1 # default replica count
Expand All @@ -88,6 +89,7 @@ if File.exist?(f)
count = settings[:count]
disks = settings[:disks]
bricks = settings[:bricks]
fstype = settings[:fstype]
version = settings[:version]
firewall = settings[:firewall]
replica = settings[:replica]
Expand Down Expand Up @@ -121,6 +123,12 @@ while skip < ARGV.length

bricks = v.to_i # set gluster brick count

elsif ARGV[skip].start_with?(arg='--gluster-fstype=')
v = ARGV.delete_at(skip).dup
v.slice! arg

fstype = v.to_s # set gluster fstype

elsif ARGV[skip].start_with?(arg='--gluster-version=')
v = ARGV.delete_at(skip).dup
v.slice! arg
Expand Down Expand Up @@ -189,6 +197,7 @@ settings = {
:count => count,
:disks => disks,
:bricks => bricks,
:fstype => fstype,
:version => version,
:firewall => firewall,
:replica => replica,
Expand Down Expand Up @@ -460,6 +469,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
'vagrant' => '1',
'vagrant_gluster_disks' => disks.to_s,
'vagrant_gluster_bricks' => bricks.to_s,
'vagrant_gluster_fstype' => fstype.to_s,
'vagrant_gluster_replica' => replica.to_s,
'vagrant_gluster_layout' => layout,
'vagrant_gluster_setgroup' => setgroup,
Expand Down
4 changes: 4 additions & 0 deletions vagrant/puppet/manifests/site.pp
Expand Up @@ -69,6 +69,10 @@
$brick_param_defaults = {
# TODO: set these from vagrant variables...
'lvm' => false,
'fstype' => "${::vagrant_gluster_fstype}" ? {
'' => undef,
default => "${::vagrant_gluster_fstype}",
},
'xfs_inode64' => true,
'force' => true,
}
Expand Down

0 comments on commit 6c96208

Please sign in to comment.