From d185cbf032e02eec7f051e85c51c19732620e192 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Wed, 19 Feb 2020 21:07:09 +0100 Subject: [PATCH] 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 --- manifests/profile/pacemaker/database/mysql_bundle.pp | 5 +++++ manifests/profile/pacemaker/database/redis_bundle.pp | 5 +++++ manifests/profile/pacemaker/ovn_dbs_bundle.pp | 7 ++++++- manifests/profile/pacemaker/rabbitmq_bundle.pp | 5 +++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/manifests/profile/pacemaker/database/mysql_bundle.pp b/manifests/profile/pacemaker/database/mysql_bundle.pp index 4e40f1bdd..87a4571c4 100644 --- a/manifests/profile/pacemaker/database/mysql_bundle.pp +++ b/manifests/profile/pacemaker/database/mysql_bundle.pp @@ -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' : diff --git a/manifests/profile/pacemaker/database/redis_bundle.pp b/manifests/profile/pacemaker/database/redis_bundle.pp index 082125ec4..559ab45d7 100644 --- a/manifests/profile/pacemaker/database/redis_bundle.pp +++ b/manifests/profile/pacemaker/database/redis_bundle.pp @@ -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, } } diff --git a/manifests/profile/pacemaker/ovn_dbs_bundle.pp b/manifests/profile/pacemaker/ovn_dbs_bundle.pp index 4493dc022..3106f2510 100644 --- a/manifests/profile/pacemaker/ovn_dbs_bundle.pp +++ b/manifests/profile/pacemaker/ovn_dbs_bundle.pp @@ -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 diff --git a/manifests/profile/pacemaker/rabbitmq_bundle.pp b/manifests/profile/pacemaker/rabbitmq_bundle.pp index 44813c9b7..c7e21dc1d 100644 --- a/manifests/profile/pacemaker/rabbitmq_bundle.pp +++ b/manifests/profile/pacemaker/rabbitmq_bundle.pp @@ -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 {