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

Related-Bug: #1863442
Change-Id: If9048196b5c03e3cfaba72f043b7f7275568bdc4
(cherry picked from commit d185cbf032)
This commit is contained in:
Michele Baldessari 2020-02-19 21:07:09 +01:00 committed by Emilien Macchi
parent 3273e5589d
commit 844975ef4b
4 changed files with 21 additions and 1 deletions

View File

@ -145,6 +145,9 @@
# (Optional) Maximum value for open-files-limit
# Defaults to 16384
#
# [*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 = undef,
$control_port = 3123,
@ -172,6 +175,7 @@ class tripleo::profile::pacemaker::database::mysql_bundle (
$pcs_tries = hiera('pcs_tries', 20),
$step = Integer(hiera('step')),
$open_files_limit = 16384,
$force_ocf = false,
) {
if $bootstrap_node and $::hostname == downcase($bootstrap_node) {
$pacemaker_master = true
@ -491,6 +495,7 @@ MYSQL_HOST=localhost\n",
require => [Class['::mysql::server'],
Pacemaker::Resource::Bundle['galera-bundle']],
before => Exec['galera-ready'],
force => $force_ocf,
}
exec { 'galera-ready' :

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 $bootstrap_node and $::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

@ -101,6 +101,9 @@
# as MASTER_IP; set to no when using external LB VIP.
# Defaults to 'yes'
#
# [*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 = undef,
@ -121,7 +124,8 @@ class tripleo::profile::pacemaker::ovn_dbs_bundle (
$enable_internal_tls = hiera('enable_internal_tls', false),
$ca_file = undef,
$dbs_timeout = 60,
$listen_on_master_ip_only = 'yes'
$listen_on_master_ip_only = 'yes',
$force_ocf = false,
) {
if $bootstrap_node and $::hostname == downcase($bootstrap_node) {
@ -280,6 +284,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,
}
# This code tells us if ovn_dbs is using a separate ip or is using a the per-network VIP

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 = undef,
$rabbitmq_docker_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 {