5.2. Deploying and testing fencing on the overcloud
The fencing configuration process includes the following stages:
- Reviewing the state of STONITH and Pacemaker.
-
Generating the
fencing.yaml
file. - Redeploying the overcloud and testing the configuration.
Prerequisites
Make sure that you can access the nodes.json
file that you created when you registered your Controller nodes in director. This file is a required input for the fencing.yaml
file that you generate during deployment.
Review the state of STONITH and Pacemaker
- Log in to each Controller node as the heat-admin user.
Verify that the cluster is running:
sudo pcs status
$ sudo pcs status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that STONITH is disabled:
sudo pcs property show
$ sudo pcs property show
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example output:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Generate the fencing.yaml
environment file
Choose one of the following options:
If you use the IPMI or Red Hat Virtualization (RHV) fencing agent, run the following command to generate the
fencing.yaml
environment file:openstack overcloud generate fencing --output fencing.yaml nodes.json
$ openstack overcloud generate fencing --output fencing.yaml nodes.json
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 注記-
This command converts
ilo
anddrac
power management details to IPMI equivalents. -
Make sure that the
nodes.json
file contains the MAC address of one of the network interfaces (NICs) on the node. For more information, see Registering Nodes for the Overcloud. -
If you use RHV, make sure that you use a role with permissions to create and launch virtual machine, such as
UserVMManager
.
-
This command converts
If you use a different fencing agent, such as Storage Block Device (SBD),
fence_kdump
, or Redfish, generate thefencing.yaml
file manually.注記If you use pre-provisioned nodes, you also must create the
fencing.yaml
file manually.
For more information about supported fencing agents, see 「Supported fencing agents」.
Redeploy the overcloud and test the configuration
Run the
overcloud deploy
command and include thefencing.yaml
file that you generated to configure fencing on the Controller nodes:openstack overcloud deploy --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e ~/templates/network-environment.yaml \ -e ~/templates/storage-environment.yaml --control-scale 3 --compute-scale 3 --ceph-storage-scale 3 --control-flavor control --compute-flavor Compute --ceph-storage-flavor ceph-storage --ntp-server pool.ntp.org --neutron-network-type vxlan --neutron-tunnel-types vxlan \ -e fencing.yaml
openstack overcloud deploy --templates \ -e /usr/share/openstack-tripleo-heat-templates/environments/network-isolation.yaml \ -e ~/templates/network-environment.yaml \ -e ~/templates/storage-environment.yaml --control-scale 3 --compute-scale 3 --ceph-storage-scale 3 --control-flavor control --compute-flavor Compute --ceph-storage-flavor ceph-storage --ntp-server pool.ntp.org --neutron-network-type vxlan --neutron-tunnel-types vxlan \ -e fencing.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Log in to the overcloud and verify that fencing is configured for each of the Controller nodes:
Check that Pacemaker is configured as the resource manager:
source stackrc nova list | grep controller ssh heat-admin@<controller-x_ip> sudo pcs status |grep fence
$ source stackrc $ nova list | grep controller $ ssh heat-admin@<controller-x_ip> $ sudo pcs status |grep fence stonith-overcloud-controller-x (stonith:fence_ipmilan): Started overcloud-controller-y
Copy to Clipboard Copied! Toggle word wrap Toggle overflow In this example, Pacemaker is configured to use a STONITH resource for each of the Controller nodes that are specified in the
fencing.yaml
file.注記You must not configure the
fence-resource
process on the same node that it controls.Run the
pcs stonith show
command to check the fencing resource attributes:sudo pcs stonith show <stonith-resource-controller-x>
$ sudo pcs stonith show <stonith-resource-controller-x>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The STONITH attribute values must match the values in the
fencing.yaml
file.
Verify fencing on the Controller nodes
To test whether fencing works correctly, you trigger fencing by closing all ports on a Controller node and rebooting the server.
Log in to a Controller node:
source stackrc nova list |grep controller ssh heat-admin@<controller-x_ip>
$ source stackrc $ nova list |grep controller $ ssh heat-admin@<controller-x_ip>
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Change to the root user and run the
iptables
command on each port:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 重要This step drops all connections to the Controller node, which causes the server to reboot.
From a different Controller node, locate the fencing event in the Pacemaker log file:
ssh heat-admin@<controller-x_ip> less /var/log/cluster/corosync.log
$ ssh heat-admin@<controller-x_ip> $ less /var/log/cluster/corosync.log (less): /fenc*
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the STONITH service performed the fencing action on the Controller, the log file will show a fencing event.
-
Wait a few minutes and then verify that the rebooted Controller node is running in the cluster again by running the
pcs status
command.