From 8975100f773a2dcfdc39eaf6e979a763dae82866 Mon Sep 17 00:00:00 2001 From: Michele Baldessari Date: Tue, 20 Mar 2018 20:29:51 +0100 Subject: [PATCH] Allow VIP resource to have customized ops Introduce meta_params and op_params which will be passed to the pcs resource create comand when creating the VIPs. This allows us to specify custom ops for VIPs in the following manner, by setting hiera. E.g.: tripleo::profile::pacemaker::haproxy_bundle::op_params: 'start timeout=200s stop timeout=200s monitor timeout=5s' Change-Id: I9a1c700051fc6dfc302e1d94347df2956442354e Depends-On: Iadf0cd3805f72141563707f43130945c9d362f5c Related-Bug: #1719540 --- manifests/pacemaker/haproxy_with_vip.pp | 13 ++++++++++++- manifests/profile/pacemaker/haproxy.pp | 18 ++++++++++++++++++ manifests/profile/pacemaker/haproxy_bundle.pp | 18 ++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) diff --git a/manifests/pacemaker/haproxy_with_vip.pp b/manifests/pacemaker/haproxy_with_vip.pp index 0aabe7a1b..c3d1c3af9 100644 --- a/manifests/pacemaker/haproxy_with_vip.pp +++ b/manifests/pacemaker/haproxy_with_vip.pp @@ -40,6 +40,14 @@ # } # Defaults to undef # +# [*meta_params*] +# (optional) Additional meta parameters to pass to "pcs resource create" for the VIP +# Defaults to '' +# +# [*op_params*] +# (optional) Additional op parameters to pass to "pcs resource create" for the VIP +# Defaults to '' +# # [*pcs_tries*] # (Optional) The number of times pcs commands should be retried. # Defaults to 1 @@ -53,6 +61,8 @@ define tripleo::pacemaker::haproxy_with_vip( $vip_name, $ip_address, $location_rule = undef, + $meta_params = '', + $op_params = '', $pcs_tries = 1, $ensure = true) { @@ -83,8 +93,9 @@ define tripleo::pacemaker::haproxy_with_vip( cidr_netmask => $netmask, nic => $nic, ipv6_addrlabel => $ipv6_addrlabel, - meta_params => 'resource-stickiness=INFINITY', + meta_params => "resource-stickiness=INFINITY ${meta_params}", location_rule => $location_rule, + op_params => $op_params, tries => $pcs_tries, } diff --git a/manifests/profile/pacemaker/haproxy.pp b/manifests/profile/pacemaker/haproxy.pp index ab7e102cd..a001ffa2d 100644 --- a/manifests/profile/pacemaker/haproxy.pp +++ b/manifests/profile/pacemaker/haproxy.pp @@ -31,6 +31,14 @@ # (false means disabled, and true means enabled) # Defaults to hiera('tripleo::firewall::manage_firewall', true) # +# [*meta_params*] +# (optional) Additional meta parameters to pass to "pcs resource create" for the VIP +# Defaults to '' +# +# [*op_params*] +# (optional) Additional op parameters to pass to "pcs resource create" for the VIP +# Defaults to '' +# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. @@ -44,6 +52,8 @@ class tripleo::profile::pacemaker::haproxy ( $bootstrap_node = hiera('haproxy_short_bootstrap_node_name'), $enable_load_balancer = hiera('enable_load_balancer', true), $manage_firewall = hiera('tripleo::firewall::manage_firewall', true), + $meta_params = '', + $op_params = '', $step = Integer(hiera('step')), $pcs_tries = hiera('pcs_tries', 20), ) { @@ -93,6 +103,8 @@ class tripleo::profile::pacemaker::haproxy ( vip_name => 'control', ip_address => $control_vip, location_rule => $haproxy_location_rule, + meta_params => $meta_params, + op_params => $op_params, pcs_tries => $pcs_tries, require => Pacemaker::Property['haproxy-role-node-property'], } @@ -103,6 +115,8 @@ class tripleo::profile::pacemaker::haproxy ( vip_name => 'public', ip_address => $public_vip, location_rule => $haproxy_location_rule, + meta_params => $meta_params, + op_params => $op_params, pcs_tries => $pcs_tries, require => Pacemaker::Property['haproxy-role-node-property'], } @@ -113,6 +127,8 @@ class tripleo::profile::pacemaker::haproxy ( vip_name => 'redis', ip_address => $redis_vip, location_rule => $haproxy_location_rule, + meta_params => $meta_params, + op_params => $op_params, pcs_tries => $pcs_tries, require => Pacemaker::Property['haproxy-role-node-property'], } @@ -126,6 +142,8 @@ class tripleo::profile::pacemaker::haproxy ( vip_name => $net_name, ip_address => $virtual_ip, location_rule => $haproxy_location_rule, + meta_params => $meta_params, + op_params => $op_params, pcs_tries => $pcs_tries, require => Pacemaker::Property['haproxy-role-node-property'], } diff --git a/manifests/profile/pacemaker/haproxy_bundle.pp b/manifests/profile/pacemaker/haproxy_bundle.pp index b39a600bc..c76d31f56 100644 --- a/manifests/profile/pacemaker/haproxy_bundle.pp +++ b/manifests/profile/pacemaker/haproxy_bundle.pp @@ -59,6 +59,14 @@ # when TLS is enabled in the internal network # Defaults to undef # +# [*meta_params*] +# (optional) Additional meta parameters to pass to "pcs resource create" for the VIP +# Defaults to '' +# +# [*op_params*] +# (optional) Additional op parameters to pass to "pcs resource create" for the VIP +# Defaults to '' +# # [*step*] # (Optional) The current step in deployment. See tripleo-heat-templates # for more details. @@ -78,6 +86,8 @@ class tripleo::profile::pacemaker::haproxy_bundle ( $internal_certs_directory = undef, $internal_keys_directory = undef, $deployed_ssl_cert_path = hiera('tripleo::haproxy::service_certificate', undef), + $meta_params = '', + $op_params = '', $step = Integer(hiera('step')), $pcs_tries = hiera('pcs_tries', 20), ) { @@ -239,6 +249,8 @@ class tripleo::profile::pacemaker::haproxy_bundle ( vip_name => 'control', ip_address => $control_vip, location_rule => $haproxy_location_rule, + meta_params => $meta_params, + op_params => $op_params, pcs_tries => $pcs_tries, } @@ -248,6 +260,8 @@ class tripleo::profile::pacemaker::haproxy_bundle ( vip_name => 'public', ip_address => $public_vip, location_rule => $haproxy_location_rule, + meta_params => $meta_params, + op_params => $op_params, pcs_tries => $pcs_tries, } @@ -257,6 +271,8 @@ class tripleo::profile::pacemaker::haproxy_bundle ( vip_name => 'redis', ip_address => $redis_vip, location_rule => $haproxy_location_rule, + meta_params => $meta_params, + op_params => $op_params, pcs_tries => $pcs_tries, } @@ -269,6 +285,8 @@ class tripleo::profile::pacemaker::haproxy_bundle ( vip_name => $net_name, ip_address => $virtual_ip, location_rule => $haproxy_location_rule, + meta_params => $meta_params, + op_params => $op_params, pcs_tries => $pcs_tries, } }