dracut-module-setup.sh: skip alias of localhost in get_pcs_fence_kdump_nodes()

The current code only exclude the hostname, while localhost can have alias in
/etc/hosts. All of the alias should be excluded from the fence dump node to
avoid deadlock issue.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
Acked-by: Kairui Song <kasong@redhat.com>
This commit is contained in:
Pingfan Liu 2019-08-01 10:34:05 +08:00 committed by Kairui Song
parent 03fd19454b
commit 88bbab963f
1 changed files with 16 additions and 1 deletions

View File

@ -689,6 +689,21 @@ kdump_check_iscsi_targets () {
}
}
is_localhost() {
local hostnames=$(hostname -A)
local shortnames=$(hostname -A -s)
local nodename=$1
hostnames="$hostnames $shortnames"
for name in ${hostnames}; do
if [ "$name" == "$nodename" ]; then
return 0
fi
done
return 1
}
# retrieves fence_kdump nodes from Pacemaker cluster configuration
get_pcs_fence_kdump_nodes() {
local nodes
@ -703,7 +718,7 @@ get_pcs_fence_kdump_nodes() {
eval $node
nodename=$uname
# Skip its own node name
if [ "$nodename" = `hostname` -o "$nodename" = `hostname -s` ]; then
if is_localhost $nodename; then
continue
fi
nodes="$nodes $nodename"