Do not call crm_node -n when running in a container

In lib/facter/pacemaker_node_name.rb we do the following:
Facter.add('pacemaker_node_name') do
  setcode do
    Facter::Core::Execution.exec 'crm_node -n'
  end
end

This is problematic because starting with pacemaker 1.1.19 crm_node -n
will trigger a newly-introduced CRM_OP_NODE_INFO query which will hang
if the container runs 1.1.19 code and the cluster runs 1.1.18 code.

Let's simply avoid running these queries when run inside a container.

Tested this by deploying successfully an overcloud with pcmk-1.1.19 in
containers and 1.1.18 on the host:
[root@controller-0 ~]# rpm -q pacemaker
pacemaker-1.1.18-11.el7_5.3.x86_64
[root@controller-0 ~]# docker exec -it galera-bundle-docker-0 sh -c "rpm -q pacemaker"
pacemaker-1.1.19-3.el7.x86_64

For this to work we also need the following RA fix:
https://github.com/ClusterLabs/resource-agents/pull/1173/

Previously this would fail with crm_node -n just hanging.

Change-Id: I9ae7df2f49f918507c5f98b2441b5b17423a38da
Closes-Bug: #1782231
This commit is contained in:
Michele Baldessari 2018-07-18 07:44:00 +02:00
parent d465e25f4b
commit 966943a79e
1 changed files with 5 additions and 3 deletions

View File

@ -1,7 +1,9 @@
require 'facter'
Facter.add('pacemaker_node_name') do
setcode do
Facter::Core::Execution.exec 'crm_node -n'
if not File.exists?('/.dockerenv')
Facter.add('pacemaker_node_name') do
setcode do
Facter::Core::Execution.exec 'crm_node -n'
end
end
end