tripleo-common/tripleo_common/utils
Chris Jones 19f3e7a325 Allow fencing config generation before deployment.
With this commit we are able to generate the fencing configuration for
IPMI hosts before deployment, and thus use it as part of the initial
deployment run.

The reason we can generate it before hand is the following:
puppet::tripleo is capable of matching its own host via
https://github.com/openstack/puppet-tripleo/blob/master/manifests/fencing.pp#L73
and by doing that each node will create its own stonith device.
It does so by looking at the macaddress<->IPMI table and if it detects
it's own macaddress it will create the IPMI stonith device
for its own hostname.

Concurrent stonith resource creation from different nodes is possible
in puppet-pacemaker since change I8be5d5d1a9894b0e2915459b10ea2feed703ba8e
got merged.

Tested as follows on a virtual vbmc environment:
1. Before deployment:
$ openstack overcloud generate fencing instackenv.json --output fence.yaml
2. Deployed overcloud adding "fence.yaml"
3. Verified stonith configuration:
[root@controller-0 ~]# pcs status |grep stonith
 stonith-fence_ipmilan-525400c36fc9     (stonith:fence_ipmilan):        Started controller-0
 stonith-fence_ipmilan-5254005c160d     (stonith:fence_ipmilan):        Started controller-2
 stonith-fence_ipmilan-525400ed3293     (stonith:fence_ipmilan):        Started controller-1
[root@controller-0 ~]# pcs property |grep stonith
 stonith-enabled: true
4. Verified the fencing of a specific node:
[root@controller-0 ~]# pcs stonith fence controller-1
Node: controller-1 fenced

<indeed controller-1 has been fenced>

Same test run on BM:
1. Before deployment:
$ openstack overcloud generate fencing instackenv.json --output fence.yaml
2. Deployed overcloud adding "fence.yaml"
3. Verified stonith configuration:
[root@controller-0 ~]# pcs status |grep stonith
 stonith-fence_ipmilan-1866da6126a0     (stonith:fence_ipmilan):        Started overcloud-controller-0
 stonith-fence_ipmilan-1866da612109     (stonith:fence_ipmilan):        Started overcloud-controller-1
 stonith-fence_ipmilan-1866da5faed8     (stonith:fence_ipmilan):        Started overcloud-controller-2
 stonith-fence_ipmilan-1866da612373     (stonith:fence_ipmilan):        Started overcloud-controller-2
 stonith-fence_ipmilan-1866da612295     (stonith:fence_ipmilan):        Started overcloud-controller-0
[root@overcloud-controller-0 ~]# pcs property |grep stonith
 stonith-enabled: true
4. Verified the fencing of a specific node:
[root@overcloud-controller-0 ~]# pcs stonith fence overcloud-controller-1 & ping overcloud-controller-1
[1] 168504
PING overcloud-controller-1.localdomain (172.17.0.14) 56(84) bytes of data.
64 bytes from overcloud-controller-1.localdomain (172.17.0.14): icmp_seq=1 ttl=64 time=0.139 ms
64 bytes from overcloud-controller-1.localdomain (172.17.0.14): icmp_seq=2 ttl=64 time=0.135 ms
64 bytes from overcloud-controller-1.localdomain (172.17.0.14): icmp_seq=3 ttl=64 time=0.132 ms
64 bytes from overcloud-controller-1.localdomain (172.17.0.14): icmp_seq=4 ttl=64 time=0.150 ms
64 bytes from overcloud-controller-1.localdomain (172.17.0.14): icmp_seq=5 ttl=64 time=0.161 ms
<timeout>

Closes-Bug: #1765727
Change-Id: I41f81dc9d68bcf23e6171e35bb053a3943f50c01
2018-04-23 11:42:16 +02:00
..
__init__.py Initial workflow implementation of tripleo-common 2015-12-07 12:38:42 -05:00
config.py config download support for a fixed directory 2018-04-17 17:15:17 -07:00
glance.py Accept glance image ID in addition to name 2017-10-24 15:22:03 -04:00
keystone.py Switch to use sessions on zaqar, nova and swift 2017-11-23 02:47:58 +00:00
nodes.py Allow fencing config generation before deployment. 2018-04-23 11:42:16 +02:00
overcloudrc.py Stop setting IRONIC_API_VERSION and OS_BAREMETAL_API_VERSION in overcloudrc 2017-11-24 14:55:15 +01:00
parameters.py Derive Params (part 1): Initial workflow to start 2017-06-09 03:57:56 -04:00
passwords.py Manage legacy OS::TripleO::RandomString resources in constants 2018-01-08 20:28:27 +00:00
plan.py Use Swift to store Plan environment 2017-06-07 16:51:28 +02:00
roles.py Added networks_skip_config parameter to the roles file 2018-02-21 16:52:10 +05:30
swift.py Make some tweaks to swift logging 2018-03-20 08:53:28 +00:00
tarball.py Add excludes option to create_tarball function 2018-03-17 09:29:16 -04:00
time_functions.py Add GUI logging workflows 2017-08-08 08:55:55 +02:00
validations.py Fix chown command for tripleo validation. 2017-11-22 15:09:08 +00:00