Lightweight composition layer for Puppet TripleO
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

backup.pp 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Copyright 2016 Red Hat, Inc.
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  4. # not use this file except in compliance with the License. You may obtain
  5. # a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  11. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  12. # License for the specific language governing permissions and limitations
  13. # under the License.
  14. #
  15. # == Class: tripleo::profile::pacemaker::cinder::backup
  16. #
  17. # Cinder Backup Pacemaker HA profile for tripleo
  18. #
  19. # === Parameters
  20. #
  21. # [*bootstrap_node*]
  22. # (Optional) The hostname of the node responsible for bootstrapping tasks
  23. # Defaults to hiera('cinder_backup_short_bootstrap_node_name')
  24. #
  25. # [*step*]
  26. # (Optional) The current step in deployment. See tripleo-heat-templates
  27. # for more details.
  28. # Defaults to hiera('step')
  29. #
  30. # [*pcs_tries*]
  31. # (Optional) The number of times pcs commands should be retried.
  32. # Defaults to hiera('pcs_tries', 20)
  33. #
  34. class tripleo::profile::pacemaker::cinder::backup (
  35. $bootstrap_node = hiera('cinder_backup_short_bootstrap_node_name'),
  36. $step = Integer(hiera('step')),
  37. $pcs_tries = hiera('pcs_tries', 20),
  38. ) {
  39. Service <| tag == 'cinder::backup' |> {
  40. hasrestart => true,
  41. restart => '/bin/true',
  42. start => '/bin/true',
  43. stop => '/bin/true',
  44. }
  45. if $::hostname == downcase($bootstrap_node) {
  46. $pacemaker_master = true
  47. } else {
  48. $pacemaker_master = false
  49. }
  50. include ::tripleo::profile::base::cinder::backup
  51. if $step >= 2 {
  52. pacemaker::property { 'cinder-backup-role-node-property':
  53. property => 'cinder-backup-role',
  54. value => true,
  55. tries => $pcs_tries,
  56. node => $::hostname,
  57. }
  58. }
  59. if $step >= 3 and $pacemaker_master and hiera('stack_action') == 'UPDATE' {
  60. Cinder_config<||>
  61. ~> tripleo::pacemaker::resource_restart_flag { "${::cinder::params::backup_service}": }
  62. }
  63. if $step >= 5 and $pacemaker_master {
  64. pacemaker::resource::service { $::cinder::params::backup_service :
  65. op_params => 'start timeout=200s stop timeout=200s',
  66. tries => $pcs_tries,
  67. location_rule => {
  68. resource_discovery => 'exclusive',
  69. score => 0,
  70. expression => ['cinder-backup-role eq true'],
  71. }
  72. }
  73. }
  74. }