This file is indexed.

/usr/lib/stonith/plugins/xen0-ha-dom0-stonith-helper is in cluster-glue 1.0.12-7build1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
# Author:      Lars Marowsky-Bree
#
# Copyright 2008 Lars Marowsky-Bree
# License:      GNU General Public License (GPL)

# This is not an external/stonith plugin by itself, but instead a helper
# script which gets installed in Dom0.

# TODO:
# - Error handling
#   - How to handle if the DomU resource doesn't exist?
#   - Does this truly work with split-brain?
#   - Is the handling of non-existent resources adequate?
#   ...
# Basically: more testing. This is proof-of-concept and works, but deserves
# validation.

CMD="$1"
DOMU="$2"
TIMEOUT="$3"

# Make sure the timeout is an integer:
if [ "0$TIMEOUT" -eq 0 ]; then
	TIMEOUT=300
fi

SetTargetRole() {
	local new_role="$1"
	crm_resource -r $DOMU --meta -p target_role -v $new_role

	local timeout="$TIMEOUT"

	# We only need to wait for "stopped".
	if [ "$new_role" != "stopped" ]; then
		return 0
	fi

	while [ $timeout -gt 0 ]; do
		local rc
		crm_resource -W -r $DOMU 2>&1 | grep -q "is NOT running"
		rc=$?
		if [ $rc -eq 0 ]; then
			return 0
		fi
		timeout=$[timeout-1];
		sleep 1
	done
	return 1
}


case $CMD in
on)	SetTargetRole started
	exit $?
	;;
off)	SetTargetRole stopped
	exit $?
	;;
reset)	SetTargetRole stopped || exit 1
	SetTargetRole started
	exit $?
	;;
status) exit 0
	;;
*)	ha_log.sh err "Called with unknown command: $CMD"
   	exit 1
	;;
esac

exit 1