1 # == define: cinder::backend::rbd
3 # Setup Cinder to use the RBD driver.
4 # Compatible for multiple backends
9 # (required) Specifies the pool name for the block device driver.
12 # (required) A required parameter to configure OS init scripts and cephx.
14 # [*volume_backend_name*]
15 # (optional) Allows for the volume_backend_name to be separate of $name.
19 # (optional) Path to the ceph configuration file to use
20 # Defaults to '/etc/ceph/ceph.conf'
22 # [*rbd_flatten_volume_from_snapshot*]
23 # (optional) Enable flatten volumes created from snapshots.
27 # (optional) A required parameter to use cephx.
31 # (optional) Location to store temporary image files if the volume
32 # driver does not write them directly to the volume
35 # [*rbd_max_clone_depth*]
36 # (optional) Maximum number of nested clones that can be taken of a
37 # volume before enforcing a flatten prior to next clone.
38 # A value of zero disables cloning
41 # [*glance_api_version*]
42 # (optional) DEPRECATED: Use cinder::glance Class instead.
43 # Glance API version. (Defaults to '2')
44 # Setting this parameter cause a duplicate resource declaration
47 define cinder::backend::rbd (
50 $volume_backend_name = $name,
51 $rbd_ceph_conf = '/etc/ceph/ceph.conf',
52 $rbd_flatten_volume_from_snapshot = false,
53 $rbd_secret_uuid = false,
54 $volume_tmp_dir = false,
55 $rbd_max_clone_depth = '5',
56 # DEPRECATED PARAMETERS
57 $glance_api_version = undef,
60 include cinder::params
62 if $glance_api_version {
63 warning('The glance_api_version parameter is deprecated, use glance_api_version of cinder::glance class instead.')
67 "${name}/volume_backend_name": value => $volume_backend_name;
68 "${name}/volume_driver": value => 'cinder.volume.drivers.rbd.RBDDriver';
69 "${name}/rbd_ceph_conf": value => $rbd_ceph_conf;
70 "${name}/rbd_user": value => $rbd_user;
71 "${name}/rbd_pool": value => $rbd_pool;
72 "${name}/rbd_max_clone_depth": value => $rbd_max_clone_depth;
73 "${name}/rbd_flatten_volume_from_snapshot": value => $rbd_flatten_volume_from_snapshot;
77 cinder_config {"${name}/rbd_secret_uuid": value => $rbd_secret_uuid;}
79 cinder_config {"${name}/rbd_secret_uuid": ensure => absent;}
83 cinder_config {"${name}/volume_tmp_dir": value => $volume_tmp_dir;}
85 cinder_config {"${name}/volume_tmp_dir": ensure => absent;}
90 $override_line = "env CEPH_ARGS=\"--id ${rbd_user}\""
91 $override_match = '^env CEPH_ARGS='
94 $override_line = "export CEPH_ARGS=\"--id ${rbd_user}\""
95 $override_match = '^export CEPH_ARGS='
98 fail("unsuported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms")
102 # Creates an empty file if it doesn't yet exist
103 ensure_resource('file', $::cinder::params::ceph_init_override, {'ensure' => 'present'})
105 ensure_resource('file_line', 'set initscript env', {
106 line => $override_line,
107 path => $::cinder::params::ceph_init_override,
108 match => $override_match,
109 notify => Service['cinder-volume']