Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for arbiter volumes #133

Merged
merged 1 commit into from
Sep 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ This defined type creates a Gluster volume. You can specify a stripe count, a re

Note that creating brick filesystems is up to you. May I recommend the [Puppet Labs LVM module](https://forge.puppetlabs.com/puppetlabs/lvm) ?

If using [arbiter](https://gluster.readthedocs.io/en/latest/Administrator%20Guide/arbiter-volumes-and-quorum/) volumes, you must conform to the replica count that will work with them, at the time of writing this, Gluster 3.12 only supports a configuration of `replica => 2, arbiter => 1`.

When creating a new volume, this defined type will ensure that all of the servers hosting bricks in the volume are members of the storage pool. In this way, you can define the volume at the time you create servers, and once the last peer joins the pool the volume will be created.

Any volume options defined will be applied after the volume is created but before the volume is started.
Expand Down
12 changes: 9 additions & 3 deletions manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#
# stripe: the stripe count to use for a striped volume
# replica: the replica count to use for a replica volume
# arbiter: the arbiter count to use for a replica volume
# transport: the transport to use. Defaults to tcp
# rebalance: whether to rebalance a volume when new bricks are added
# heal: whether to heal a replica volume when adding bricks
Expand Down Expand Up @@ -50,6 +51,7 @@
Optional[Array] $options = undef,
Optional[Integer] $stripe = undef,
Optional[Integer] $replica = undef,
Optional[Integer] $arbiter = undef,
) {

if $force {
Expand Down Expand Up @@ -186,10 +188,14 @@
}

if $replica {
if ( count($bricks) % $replica ) != 0 {
fail("Number of bricks to add is not a multiple of replica count ${replica}")
if $arbiter and $arbiter != 0 {
$r = "replica ${replica} arbiter ${arbiter}"
} else {
if ( count($bricks) % $replica ) != 0 {
fail("Number of bricks to add is not a multiple of replica count ${replica}")
}
$r = "replica ${replica}"
}
$r = "replica ${replica}"
} else {
$r = ''
}
Expand Down