Do not avoid same node with INFINITY score

Right now when we create a stonith resource we add the location
constraint as follows:
pcs constraint location stonith-fence_ipmilan-525400bb6781 avoids controller-0

This, by default, will create a location constraint with INFINITY score,
meaning that this stonith manifest will never ever be allowed to run on
controller-0 no matter what:

  Resource: stonith-fence_ipmilan-525400bb6781
    Disabled on: controller-0 (score:-INFINITY) (id:location-stonith-fence_ipmilan-525400bb6781-controller-0--INFINITY)

This is not ideal because we still want to be able to run this stonith
resource on controller-0 if all else fails.
Let's tweak this stonith resource creation to use a very high score
(10000) so that, ultimately the stonith resource is allowed to run
on the same controlled node itself.

Tested and correctly got all location constraints set:
  Resource: stonith-fence_ipmilan-525400116021
    Disabled on: compute-0 (score:-10000) (id:location-stonith-fence_ipmilan-525400116021-compute-0--10000)
  Resource: stonith-fence_ipmilan-5254002a5c13
    Disabled on: controller-0 (score:-10000) (id:location-stonith-fence_ipmilan-5254002a5c13-controller-0--10000)
  Resource: stonith-fence_ipmilan-5254004d7139
    Disabled on: compute-1 (score:-10000) (id:location-stonith-fence_ipmilan-5254004d7139-compute-1--10000)
  Resource: stonith-fence_ipmilan-525400b77dcc
    Disabled on: controller-1 (score:-10000) (id:location-stonith-fence_ipmilan-525400b77dcc-controller-1--10000)
  Resource: stonith-fence_ipmilan-525400bb6781
    Disabled on: controller-2 (score:-10000) (id:location-stonith-fence_ipmilan-525400bb6781-controller-2--10000)

Suggested-by: Ken Gaillot <kgaillot@redhat.com>

Closes-Bug: #1829146
Change-Id: I95d11d85d61bddc6d8600f576801a42af79a6652
This commit is contained in:
Michele Baldessari 2019-05-15 10:05:49 +02:00
parent 487c8f12bb
commit 57f65b8919
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ Puppet::Type.type(:pcmk_stonith).provide(:default) do
def stonith_location_rule_create()
pcmk_host_list = @resource[:pcmk_host_list]
if not_empty_string(pcmk_host_list)
location_cmd = "constraint location #{@resource[:name]} avoids #{pcmk_host_list}"
location_cmd = "constraint location #{@resource[:name]} avoids #{pcmk_host_list}=10000"
Puppet.debug("stonith_location_rule_create: #{location_cmd}")
pcs('create', @resource[:name], location_cmd, @resource[:tries],
@resource[:try_sleep], @resource[:verify_on_create], @resource[:post_success_sleep])