summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Shubin <james@shubin.ca>2014-04-07 20:16:24 -0400
committerJames Shubin <james@shubin.ca>2014-04-10 17:25:05 -0400
commitb0f645e24d6622008a56504c099fbd2ce64497fe (patch)
treee2d6ca6aff98e087ec4c8c2c291276a977cc83bd
parentb5e83426b9d0af4abff241670bf5a68fdfc265fb (diff)
downloadpuppet-gluster-b0f645e24d6622008a56504c099fbd2ce64497fe.tar.gz
puppet-gluster-b0f645e24d6622008a56504c099fbd2ce64497fe.tar.xz
puppet-gluster-b0f645e24d6622008a56504c099fbd2ce64497fe.zip
Support LVM thin provisioning.
This adds the ability to do LVM thin provisioning. If you haven't fully read 'man 7 lvmthin' then please do as this will answer most of your questions. LVM thin provisioning is used for doing one form of GlusterFS snapshots.
-rw-r--r--DOCUMENTATION.md16
-rw-r--r--manifests/brick.pp57
-rw-r--r--puppet-gluster-documentation.pdfbin227469 -> 229212 bytes
3 files changed, 66 insertions, 7 deletions
diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md
index 541ff39..6f50993 100644
--- a/DOCUMENTATION.md
+++ b/DOCUMENTATION.md
@@ -652,6 +652,22 @@ Do you want to use lvm on the lower level device (typically a partition, or the
device itself), or not. Using lvm might be required when using a commercially
supported GlusterFS solution.
+####`lvm_thinp`
+Set to _true_ to enable LVM thin provisioning. Read 'man 7 lvmthin' to
+understand what thin provisioning is all about. This is needed for one form of
+GlusterFS snapshots. Obviously this requires that you also enable _LVM_.
+
+####`lvm_virtsize`
+The value that will be passed to _--virtualsize_. By default this will pass in
+a command that will return the size of your volume group. This is usually a
+sane value, and help you to remember not to overcommit.
+
+####`lvm_chunksize`
+Value of _--chunksize_ for _lvcreate_ when using thin provisioning.
+
+####`lvm_metadatasize`
+Value of _--poolmetadatasize_ for _lvcreate_ when using thin provisioning.
+
####`fsuuid`
File system UUID. This ensures we can distinctly identify a file system. You
can set this to be used with automatic file system creation, or you can specify
diff --git a/manifests/brick.pp b/manifests/brick.pp
index b4c69c5..c737c85 100644
--- a/manifests/brick.pp
+++ b/manifests/brick.pp
@@ -27,6 +27,10 @@ define gluster::brick(
$labeltype = '', # gpt
$lvm = true, # use lvm or not ?
+ $lvm_thinp = false, # use lvm thin-p or not ?
+ $lvm_virtsize = '', # defaults to 100% available.
+ $lvm_chunksize = '', # chunk size for thin-p
+ $lvm_metadatasize = '', # meta data size for thin-p
$fsuuid = '', # set a uuid for this fs (uuidgen)
$fstype = '', # xfs
@@ -156,8 +160,12 @@ define gluster::brick(
#
# lvm...
#
+ if $lvm_thinp and ( ! $lvm ) {
+ warning('You must enable $lvm if you want to use LVM thin-p.')
+ }
+
if $lvm {
- # NOTE: this is need for thin-provisioning, and RHS compliance!
+ # NOTE: this is used for thin-provisioning, and RHS compliance!
# NOTE: as a consequence of this type of automation, we generate
# really ugly vg names like: "vg_annex1.example.com+_gluster_" !
@@ -166,6 +174,7 @@ define gluster::brick(
$lvm_safename = regsubst("${safename}", ':', '+', 'G') # safe!
$lvm_vgname = "vg_${lvm_safename}"
$lvm_lvname = "lv_${lvm_safename}"
+ $lvm_tpname = "tp_${lvm_safename}" # thin pool (tp)
$lvm_dataalignment = inline_template('<%= @raid_su.to_i*@raid_sw.to_i %>')
@@ -176,14 +185,48 @@ define gluster::brick(
$lvm_vgcreate = "/sbin/vgcreate ${lvm_vgname} ${dev1}"
- # creates dev /dev/vgname/lvname
- # FIXME: should we use --extents or --size and what values ?
- $lvm_lvcreate = "/sbin/lvcreate --extents 100%PVS -n ${lvm_lvname} ${lvm_vgname}"
+ # match --virtualsize with 100% of available vg by default
+ $lvm_thinp_virtsize = "${lvm_virtsize}" ? { # --virtualsize
+ '' => "`/sbin/vgs -o size --units b --noheadings ${lvm_vgname}`",
+ default => "${lvm_virtsize}",
+ }
- $dev2 = "/dev/${lvm_vgname}/${lvm_lvname}"
+ # TODO: is 64k a good/sane default ?
+ $lvm_thinp_chunksize = "${lvm_chunksize}" ? {
+ '' => '',
+ default => "--chunksize ${lvm_chunksize}",
+ }
- } else {
- $dev2 = "${dev1}" # pass through, because not using lvm
+ # TODO: is 16384 a good/sane default ?
+ $lvm_thinp_metadatasize = "${lvm_metadatasize}" ? {
+ '' => '',
+ default => "--poolmetadatasize ${lvm_metadatasize}",
+ }
+
+ # README: 'man 7 lvmthin' to understand lvm thin provisioning
+ # MIRROR: http://man7.org/linux/man-pages/man7/lvmthin.7.html
+ # TODO: is this the optimal setup for thin-p ?
+ $lvm_thinp_lvcreate_cmdlist = [
+ '/sbin/lvcreate',
+ "--thinpool ${lvm_vgname}/${lvm_tpname}", # thinp
+ '--extents 100%FREE', # let lvm figure out the --size
+ "--virtualsize ${lvm_thinp_virtsize}",
+ "${lvm_thinp_chunksize}",
+ "${lvm_thinp_metadatasize}",
+ " -n ${lvm_lvname}", # name it
+ ]
+ $lvm_thinp_lvcreate = join(delete($lvm_thinp_lvcreate_cmdlist, ''), ' ')
+
+ # creates dev /dev/vgname/lvname
+ $lvm_lvcreate = $lvm_thinp ? {
+ true => "${lvm_thinp_lvcreate}",
+ default => "/sbin/lvcreate --extents 100%PVS -n ${lvm_lvname} ${lvm_vgname}",
+ }
+ }
+
+ $dev2 = $lvm ? {
+ false => "${dev1}", # pass through, because not using lvm
+ default => "/dev/${lvm_vgname}/${lvm_lvname}", # thin-p too :)
}
#
diff --git a/puppet-gluster-documentation.pdf b/puppet-gluster-documentation.pdf
index 7fcb78a..ef6f2f1 100644
--- a/puppet-gluster-documentation.pdf
+++ b/puppet-gluster-documentation.pdf
Binary files differ