File: volume.pp

package info (click to toggle)
puppet-module-cinder 27.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,512 kB
  • sloc: ruby: 6,697; python: 33; sh: 10; makefile: 10
file content (112 lines) | stat: -rw-r--r-- 4,138 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# == Class: cinder::volume
#
# === Parameters
#
# [*package_ensure*]
#   (Optional) The state of the package.
#   Defaults to 'present'.
#
# [*enabled*]
#   (Optional) The state of the service (boolean value)
#   Defaults to true.
#
# [*manage_service*]
#   (Optional) Whether to start/stop the service (boolean value)
#   Defaults to true.
#
# [*cluster*]
#   (Optional) Cluster name when running in active/active mode.
#   Defaults to $facts['os_service_default'].
#
# [*volume_clear*]
#   (Optional) Method used to wipe old volumes.
#   Defaults to $facts['os_service_default'].
#
# [*volume_clear_size*]
#   (Optional) Size in MiB to wipe at start of old volumes.
#   Set to '0' means all.
#   Defaults to $facts['os_service_default'].
#
# [*volume_clear_ionice*]
#   (Optional) The flag to pass to ionice to alter the i/o priority
#   of the process used to zero a volume after deletion,
#   for example "-c3" for idle only priority.
#   Defaults to $facts['os_service_default'].
#
# [*migration_create_volume_timeout_secs*]
#   (Optional) Timeout for creating the volume to migrate to when performing
#   volume migration (seconds).
#   Defaults to $facts['os_service_default'].
#
# [*volume_service_inithost_offload*]
#   (Optional) Offload pending volume delete during volume service startup.
#   Defaults to $facts['os_service_default'].
#
# [*reinit_driver_count*]
#   (Optional) Maximum times to reinitialize the driver if volume
#   initialization fails.
#   Defaults to $facts['os_service_default'].
#
# [*init_host_max_objects_retrieval*]
#   (Optional) Max number of volumes and snapshots to be retrieved per batch
#   during volume manager host initialization.
#   Defaults to $facts['os_service_default'].
#
# [*backend_stats_polling_interval*]
#   (Optional) Time in seconds between requests for usage statistics from
#   the backend.
#   Defaults to $facts['os_service_default'].
#
class cinder::volume (
  Stdlib::Ensure::Package $package_ensure = 'present',
  Boolean $enabled                        = true,
  Boolean $manage_service                 = true,
  $cluster                                = $facts['os_service_default'],
  $volume_clear                           = $facts['os_service_default'],
  $volume_clear_size                      = $facts['os_service_default'],
  $volume_clear_ionice                    = $facts['os_service_default'],
  $migration_create_volume_timeout_secs   = $facts['os_service_default'],
  $volume_service_inithost_offload        = $facts['os_service_default'],
  $reinit_driver_count                    = $facts['os_service_default'],
  $init_host_max_objects_retrieval        = $facts['os_service_default'],
  $backend_stats_polling_interval         = $facts['os_service_default'],
) {
  include cinder::deps
  include cinder::params

  if $cinder::params::volume_package {
    package { 'cinder-volume':
      ensure => $package_ensure,
      name   => $cinder::params::volume_package,
      tag    => ['openstack', 'cinder-package'],
    }
  }

  if $manage_service {
    if $enabled {
      $ensure = 'running'
    } else {
      $ensure = 'stopped'
    }

    service { 'cinder-volume':
      ensure    => $ensure,
      name      => $cinder::params::volume_service,
      enable    => $enabled,
      hasstatus => true,
      tag       => 'cinder-service',
    }
  }

  cinder_config {
    'DEFAULT/cluster':                              value => $cluster;
    'DEFAULT/volume_clear':                         value => $volume_clear;
    'DEFAULT/volume_clear_size':                    value => $volume_clear_size;
    'DEFAULT/volume_clear_ionice':                  value => $volume_clear_ionice;
    'DEFAULT/migration_create_volume_timeout_secs': value => $migration_create_volume_timeout_secs;
    'DEFAULT/volume_service_inithost_offload':      value => $volume_service_inithost_offload;
    'DEFAULT/reinit_driver_count':                  value => $reinit_driver_count;
    'DEFAULT/init_host_max_objects_retrieval':      value => $init_host_max_objects_retrieval;
    'DEFAULT/backend_stats_polling_interval':       value => $backend_stats_polling_interval;
  }
}