Allow OCF resources to be created with --force

While moving to running pcs commands on the host and off short-lived
containers, we are confronted with the issue that pcs usually checks
for the resource agent's existence on the host before creating it.
Since we'd rather avoid installing the needed resource agents on the
host (as it is inside a container), we allow a new 'force_ocf' parameter
to be passed to those situations where we might need it.

Depends-On: I20eb78a061a334b20f6b2274591c5d313a0af532
Depends-On: I4bea96767a3246054c5d98271d8378d84fefc247

NB: Small conflicts due to context change in the following files:
  manifests/profile/pacemaker/database/mysql_bundle.pp
  manifests/profile/pacemaker/ovn_dbs_bundle.pp

Related-Bug: #1863442
Change-Id: If9048196b5c03e3cfaba72f043b7f7275568bdc4
(cherry picked from commit d185cbf032)
(cherry picked from commit 844975ef4b)
This commit is contained in:
Michele Baldessari 2020-02-19 21:07:09 +01:00
parent 0d42695d11
commit cb960b93f9
4 changed files with 20 additions and 0 deletions

View File

@ -155,6 +155,9 @@
# before pacemaker considers the operation timed out.
# Defaults to 300
#
# [*force_ocf*]
# (optional) Use --force when creating the ocf resource via pcs
# Defaults to false
class tripleo::profile::pacemaker::database::mysql_bundle (
$mysql_docker_image = hiera('tripleo::profile::pacemaker::database::mysql_bundle::mysql_docker_image', undef),
$control_port = hiera('tripleo::profile::pacemaker::database::mysql_bundle::control_port', '3123'),
@ -184,6 +187,7 @@ class tripleo::profile::pacemaker::database::mysql_bundle (
$step = Integer(hiera('step')),
$open_files_limit = 16384,
$promote_timeout = 300,
$force_ocf = false,
) {
if $::hostname == downcase($bootstrap_node) {
$pacemaker_master = true
@ -509,6 +513,7 @@ MYSQL_HOST=localhost\n",
bundle => 'galera-bundle',
require => [Class['::mysql::server']],
before => Exec['galera-ready'],
force => $force_ocf,
}
# Resource relation: we normally want the bundle resource to

View File

@ -113,6 +113,9 @@
# (optional) Set the --user= switch to be passed to pcmk
# Defaults to 'root'
#
# [*force_ocf*]
# (optional) Use --force when creating the ocf resource via pcs
# Defaults to false
class tripleo::profile::pacemaker::database::redis_bundle (
$certificate_specs = hiera('redis_certificate_specs', {}),
$enable_internal_tls = hiera('enable_internal_tls', false),
@ -133,6 +136,7 @@ class tripleo::profile::pacemaker::database::redis_bundle (
$tls_proxy_port = 6379,
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$bundle_user = 'root',
$force_ocf = false,
) {
if $::hostname == downcase($bootstrap_node) {
$pacemaker_master = true
@ -394,6 +398,7 @@ slave-announce-port ${local_tuple[0][2]}
},
bundle => 'redis-bundle',
require => [Pacemaker::Resource::Bundle['redis-bundle']],
force => $force_ocf,
}
}

View File

@ -107,6 +107,9 @@
# dict called: force_vip_nic_overrides[<vip/network name>] = 'dummy'
# Defaults to hiera('tripleo::pacemaker::force_nic', undef)
#
# [*force_ocf*]
# (optional) Use --force when creating the ocf resource via pcs
# Defaults to false
class tripleo::profile::pacemaker::ovn_dbs_bundle (
$ovn_dbs_docker_image = hiera('tripleo::profile::pacemaker::ovn_dbs_bundle::ovn_dbs_docker_image', undef),
@ -129,6 +132,7 @@ class tripleo::profile::pacemaker::ovn_dbs_bundle (
$dbs_timeout = hiera('tripleo::profile::pacemaker::ovn_dbs_bundle::dbs_timeout', 60),
$listen_on_master_ip_only = hiera('tripleo::profile::pacemaker::ovn_dbs_bundle::listen_on_master_ip_only', 'yes'),
$force_nic = hiera('tripleo::pacemaker::force_nic', undef),
$force_ocf = false,
) {
if $::hostname == downcase($bootstrap_node) {
@ -289,6 +293,7 @@ monitor interval=30s role=Slave timeout=${dbs_timeout}s",
location_rule => $ovn_dbs_location_rule,
meta_params => 'notify=true container-attribute-target=host',
bundle => 'ovn-dbs-bundle',
force => $force_ocf,
}
if downcase($listen_on_master_ip_only) == 'yes' {

View File

@ -101,6 +101,9 @@
# (optional) Set the --user= switch to be passed to pcmk
# Defaults to 'root'
#
# [*force_ocf*]
# (optional) Use --force when creating the ocf resource via pcs
# Defaults to false
class tripleo::profile::pacemaker::rabbitmq_bundle (
$rabbitmq_docker_image = hiera('tripleo::profile::pacemaker::rabbitmq_bundle::rabbitmq_docker_image', undef),
$rabbitmq_docker_control_port = hiera('tripleo::profile::pacemaker::rabbitmq_bundle::control_port', '3122'),
@ -123,6 +126,7 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
$log_file = '/var/log/containers/stdouts/rabbitmq-bundle.log',
$tls_priorities = hiera('tripleo::pacemaker::tls_priorities', undef),
$bundle_user = 'root',
$force_ocf = false,
) {
# is this an additional nova cell?
if hiera('nova_is_additional_cell', undef) {
@ -338,6 +342,7 @@ class tripleo::profile::pacemaker::rabbitmq_bundle (
require => [Class['::rabbitmq'],
Pacemaker::Resource::Bundle['rabbitmq-bundle']],
before => Exec['rabbitmq-ready'],
force => $force_ocf,
}
if size($rabbit_nodes) == 1 {