Defined Type: sap::cluster::as_inst
- Defined in:
- manifests/cluster/as_inst.pp
Summary
Creates Corosync/Pacemaker cluster rules for a single AS instance.Overview
This defined type should be used by the sap::cluster class and not called directly externally.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'manifests/cluster/as_inst.pp', line 55
define sap::cluster::as_inst (
Sap::SID $sid,
String $cib_name,
Sap::ClusterDbMode $db_mode,
Stdlib::AbsolutePath $profile_dir,
Array[Stdlib::Host] $relevant_nodes,
Sap::InstType $type,
Sap::InstNumber $number,
Stdlib::Host $host,
Boolean $legacy_start_profile = false,
){
# Define the standard operation latencies
# Note that the master/slave/promote/demote are not actually used here but are
# declare to prevent puppet-corosync from getting fiesty with the default
# monitor statements
$as_operations = [
{
'start' => {
'interval' => '0s',
'timeout' => '320s',
},
},
{
'stop' => {
'interval' => '0s',
'timeout' => '320s',
},
},
{
'monitor' => {
'interval' => '120s',
'timeout' => '60s',
},
},
{
'monitor' => {
'interval' => '121s',
'timeout' => '60s',
'role' => 'Slave',
},
},
{
'monitor' => {
'interval' => '119s',
'timeout' => '60s',
'role' => 'Master',
},
},
{
'promote' => {
'interval' => '0s',
'timeout' => '320s',
},
},
{
'demote' => {
'interval' => '0s',
'timeout' => '320s',
},
},
{
'methods' => {
'interval' => '0s',
'timeout' => '5s',
},
},
]
# Restrict the app server resource to it's local host
$target_node_list = $relevant_nodes.filter |$node| { $node =~ "^${host}" }
if $target_node_list.length != 1 {
fail("ClusterAs: ${title} could not identify node matching ${host}!")
}
$target_node = $target_node_list[0]
# Add failure checks for this instance
$instname = "${sid}_${type}${number}_${host}"
if $legacy_start_profile {
$as_start_profile = "${profile_dir}/START_${type}${number}_${host}"
} else {
$as_start_profile = "${profile_dir}/${instname}"
}
$as_primitive = "prm_${sid}_AS_${host}"
# Construct the instance parameters
$as_parameters = {
'InstanceName' => $instname,
'START_PROFILE' => $as_start_profile,
'DIR_PROFILE' => $profile_dir,
}
# Create the AS primitive
cs_primitive { $as_primitive:
primitive_class => 'ocf',
primitive_type => 'SAPInstance',
provided_by => 'heartbeat',
cib => $cib_name,
parameters => $as_parameters,
operations => $as_operations,
}
# Constrain the AS primitive to the target node
cs_location { "locate-${as_primitive}-on-${target_node}":
cib => $cib_name,
primitive => $as_primitive,
node_name => $target_node,
score => 'INFINITY',
require => Cs_primitive[$as_primitive],
}
# Ensure the SCS instance starts and is promoted first
# TODO: Maybe change this to depend on the IP instead?
$scs_primitive = "prm_${sid}_SCS"
cs_order { "order-promote-ms_${scs_primitive}-then-start-${as_primitive}":
cib => $cib_name,
first => "ms_${scs_primitive}:promote",
second => "${as_primitive}:start",
symmetrical => false,
require => [
Cs_primitive[$as_primitive],
Cs_primitive[$scs_primitive],
],
}
# Ensure the database instance is started or promoted first
# TODO: Maybe change this to depend on the IP instead?
$db_primitive_base = "prm_${sid}_DB"
$order_db_require = "Cs_primitive[${db_primitive_base}]"
case $db_mode {
'log_shipping': {
$db_primitive = "ms_${db_primitive_base}"
$order_db_rule = "order-promote-${db_primitive}-then-start-${as_primitive}"
$order_db_first = "${db_primitive}:promote"
}
'shared_storage': {
$db_primitive = $db_primitive_base
$order_db_rule = "order-start-${db_primitive}-then-start-${as_primitive}"
$order_db_first = "${db_primitive}:start"
}
default: {
fail("ClusterAs: ${title} unsupported database cluster mode: ${db_mode}!")
}
}
cs_order { $order_db_rule:
cib => $cib_name,
first => $order_db_first,
second => "${as_primitive}:start",
symmetrical => false,
require => $order_db_require,
}
}
|