/usr/bin/ccs2cib is in pacemaker 1.1.7-1.
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 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | #!/bin/sh
XSL_FILE="/usr/share/pacemaker/cluconf2cib.xsl"
SAXON_JAR="/usr/share/java/saxon.jar"
# Above is autogenerated; DEBUG here is run-time
DEBUG=0
export XSL_FILE SAXON_JAR DEBUG
die()
{
echo "$*"
exit 1
}
_validate()
{
if [ $DEBUG -eq 1 ]; then
echo "debug: adding . to $PATH"
export PATH="$PATH:."
fi
which ccs_flatten &> /dev/null || die "Can't find ccs_flatten in path!"
which java &> /dev/null || die "Can not find java in path!"
if [ -z "$XSL_FILE" ]; then
if [ $DEBUG -eq 1 ]; then
XSL_FILE=./cluconf2cib.xsl
echo "debug: using $XSL_FILE"
else
die "Please specify path to XSLT script using -X <path>."
fi
fi
if [ -z "$SAXON_JAR" ]; then
if [ $DEBUG -eq 1 ]; then
SAXON_JAR=/usr/share/java/saxon.jar
echo "debug: using $SAXON_JAR"
else
die "Please specify path to saxon.jar using -J <path>."
fi
fi
[ -d /usr/share/cluster ] || die "/usr/share/cluster does not exist."
[ -f /usr/share/cluster/service.sh ] || die "Missing rgmanager resource agents?"
[ -f "$XSL_FILE" ] || die "$XSL_FILE does not exist!"
[ -f "$SAXON_JAR" ] || die "$SAXON_JAR does not exist!"
[ -f "$1" ] || die "Input file $1 not found"
if [ -f "$2" ]; then
[ $3 -ne 0 ] || die "Output file $2 exists; please remove or use -f"
fi
return 0
}
help()
{
cat <<EOT
usage: $(basename $1) [options]
-i input_file Configuration input [/etc/cluster/cluster.conf]
-o output_file File to output [cib.xml]
-f Force update (remove output_file if it exists)
-R Disable rgmanager in input file after completion
WARNING: Edits config file in-place
-r output_conf Disable rgmanager, store result in output_conf
instead of modifying input_file in place.
-n Don't call crm_verify on the new cib.xml
-d Enable development/debug mode
-X <path> Specify path to XSLT script
-J <path> Specify path to Saxon jar file
-h This message
EOT
}
# main
declare conf_in cib_out xsl_file saxon_jar conf_out opt do_update tmp
declare force_update no_verify
# defaults
conf_in="/etc/cluster/cluster.conf"
cib_out="cib-converted.xml"
conf_out=""
do_update=0
no_verify=0
force_update=0
tmp=$(mktemp /tmp/ccs2cib.tmp.XXXXXX)
while getopts i:o:X:J:Rr:dnhf opt; do
case $opt in
d)
DEBUG=1
;;
i)
conf_in="$OPTARG"
;;
o)
cib_out="$OPTARG"
;;
R)
do_update=1
;;
r)
do_update=1
conf_out="$OPTARG"
;;
n)
no_verify=1
;;
f)
force_update=1
;;
X)
XSL_FILE="$OPTARG"
;;
J)
SAXON_JAR="$OPTARG"
;;
h)
help $0
exit 0
;;
*)
echo "Error parsing $opt"
help $0
exit 1
;;
esac
done
[ -z "$conf_out" ] && conf_out="$conf_in"
_validate "$conf_in" "$cib_out" $force_update
echo " * Converting configuration"
if ! ccs_flatten "$conf_in" > $tmp; then
rm -f $tmp
die "Flattening of configuration file failed."
fi
if ! java -jar $SAXON_JAR -xsl:$XSL_FILE $tmp > $cib_out; then
rm -f $tmp
die "Conversion failed."
fi
echo " * Calling crm_verify to validate the configuration."
if [ $no_verify -eq 0 ]; then
crm_verify --xml-file $cib_out -V || die "Validation failed."
fi
if [ $do_update -ne 0 ]; then
echo " * Disabling rgmanager in $conf_out"
rm -f $tmp
disable_rgmanager "$conf_in" > "$tmp" || die "Failed to disable rgmanager"
mv "$tmp" "$conf_out"
if [ "$conf_out" = "/etc/cluster/cluster.conf" ]; then
if clustat -Q &> /dev/null; then
echo " * Calling cman_tool to update cluster.conf"
cman_tool version -r
else
echo " * You will need to manually copy $conf_out to the other cluster"
echo " nodes using scp, ccs_sync, or some other utility."
fi
fi
fi
echo " * Proposed cib stored in $cib_out"
exit 0
|