5121bb1ac6ece016d6e3337273661f41dfbc0d8f
[mirror/dsa-puppet.git] / 3rdparty / modules / cinder / manifests / backend / glusterfs.pp
1 #
2 # == Class: cinder::backend::glusterfs
3 #
4 # Configures Cinder to use GlusterFS as a volume driver
5 #
6 # === Parameters
7 #
8 # [*glusterfs_shares*]
9 #   (required) An array of GlusterFS volume locations.
10 #   Must be an array even if there is only one volume.
11 #
12 # [*volume_backend_name*]
13 #   (optional) Allows for the volume_backend_name to be separate of $name.
14 #   Defaults to: $name
15 #
16 # [*glusterfs_disk_util*]
17 #   Removed in Icehouse.
18 #
19 # [*glusterfs_sparsed_volumes*]
20 #   (optional) Whether or not to use sparse (thin) volumes.
21 #   Defaults to undef which uses the driver's default of "true".
22 #
23 # [*glusterfs_mount_point_base*]
24 #   (optional) Where to mount the Gluster volumes.
25 #   Defaults to undef which uses the driver's default of "$state_path/mnt".
26 #
27 # [*glusterfs_shares_config*]
28 #   (optional) The config file to store the given $glusterfs_shares.
29 #   Defaults to '/etc/cinder/shares.conf'
30 #
31 # === Examples
32 #
33 # cinder::backend::glusterfs { 'myGluster':
34 #   glusterfs_shares = ['192.168.1.1:/volumes'],
35 # }
36 #
37 define cinder::backend::glusterfs (
38   $glusterfs_shares,
39   $volume_backend_name        = $name,
40   $glusterfs_disk_util        = false,
41   $glusterfs_sparsed_volumes  = undef,
42   $glusterfs_mount_point_base = undef,
43   $glusterfs_shares_config    = '/etc/cinder/shares.conf'
44 ) {
45
46   if $glusterfs_disk_util {
47     fail('glusterfs_disk_util is removed in Icehouse.')
48   }
49
50   $content = join($glusterfs_shares, "\n")
51
52   file { $glusterfs_shares_config:
53     content => "${content}\n",
54     require => Package['cinder'],
55     notify  => Service['cinder-volume']
56   }
57
58   cinder_config {
59     "${name}/volume_backend_name":  value => $volume_backend_name;
60     "${name}/volume_driver":        value =>
61       'cinder.volume.drivers.glusterfs.GlusterfsDriver';
62     "${name}/glusterfs_shares_config":    value => $glusterfs_shares_config;
63     "${name}/glusterfs_sparsed_volumes":  value => $glusterfs_sparsed_volumes;
64     "${name}/glusterfs_mount_point_base": value => $glusterfs_mount_point_base;
65   }
66 }