From 170780287dd99191d1ea908c78ce88489366c0e0 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Tue, 11 Mar 2014 12:14:52 -0400 Subject: Add per volume support for brick chaining. * Don't use this feature unless you _really_ know what you're doing. * Managing chained volumes is much harder than managing normal ones. * If some of the volumes in the cluster use this, and others don't, then you'll probably have an even crazier time with management. * Please verify my algorithm and feel free to suggest changes. * Some edge cases haven't been tested. * This patch breaks out brick layout ordering into individual functions. --- manifests/simple.pp | 2 ++ manifests/volume.pp | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/simple.pp b/manifests/simple.pp index fc4da96..dbd43ed 100644 --- a/manifests/simple.pp +++ b/manifests/simple.pp @@ -20,6 +20,7 @@ class gluster::simple( $volume = 'puppet', # NOTE: this can be a list... $replica = 1, $stripe = 1, # TODO: not fully implemented in puppet-gluster + $layout = '', # brick layout to use (default, chained, etc...) $vip = '', # strongly recommended $vrrp = false, $password = '', # global vrrp password to use @@ -158,6 +159,7 @@ class gluster::simple( gluster::volume { $valid_volumes: replica => $replica, stripe => $stripe, + layout => "${layout}", # NOTE: with this method you do not choose the order of course! # the gluster_fqdns fact is alphabetical, but not complete till # at least a puppet run of each node has occured. watch out for diff --git a/manifests/volume.pp b/manifests/volume.pp index 645c090..c6e285d 100644 --- a/manifests/volume.pp +++ b/manifests/volume.pp @@ -21,6 +21,9 @@ define gluster::volume( $transport = 'tcp', $replica = 1, $stripe = 1, + # TODO: maybe this should be called 'chained' => true/false, and maybe, + # we can also specify an offset count for chaining, or other parameters + $layout = '', # brick layout to use (default, chained, etc...) $vip = '', # vip of the cluster (optional but recommended) $ping = true, # do we want to include fping checks ? $settle = true, # do we want to run settle checks ? @@ -76,9 +79,15 @@ define gluster::volume( $gluster_brick_group_fact = getvar("gluster_brick_group_${group}") $collected_bricks = split($gluster_brick_group_fact, ',') + # run the appropriate layout function here + $ordered_brick_layout = $layout ? { + 'chained' => brick_layout_chained($replica, $collected_bricks), + default => brick_layout_simple($replica, $collected_bricks), + } + $valid_bricks = type($bricks) ? { 'boolean' => $bricks ? { - true => $collected_bricks, # an array... + true => $ordered_brick_layout, # an array... default => [], # invalid type }, 'list' => $bricks, @@ -86,6 +95,7 @@ define gluster::volume( } # helpful debugging! + notice(inline_template('collected_bricks: <%= @collected_bricks.inspect %>')) notice(inline_template('valid_bricks: <%= @valid_bricks.inspect %>')) # NOTE: we're using the valid_bricks value here, and not the collected -- cgit