Gentoo Archives: gentoo-commits

From: Alexys Jacob <ultrabug@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-cluster/pacemaker/files/
Date: Sun, 11 Feb 2018 16:43:48
Message-Id: 1518367412.a4b74a98d540fe57489b4995740b492196389b2a.ultrabug@gentoo
1 commit: a4b74a98d540fe57489b4995740b492196389b2a
2 Author: Michael Mair-Keimberger <m.mairkeimberger <AT> gmail <DOT> com>
3 AuthorDate: Thu Feb 1 17:07:45 2018 +0000
4 Commit: Alexys Jacob <ultrabug <AT> gentoo <DOT> org>
5 CommitDate: Sun Feb 11 16:43:32 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a4b74a98
7
8 sys-cluster/pacemaker: remove unused file
9
10 Closes: https://github.com/gentoo/gentoo/pull/7016
11
12 sys-cluster/pacemaker/files/ping | 380 ---------------------------------------
13 1 file changed, 380 deletions(-)
14
15 diff --git a/sys-cluster/pacemaker/files/ping b/sys-cluster/pacemaker/files/ping
16 deleted file mode 100644
17 index 52c4c3d4cad..00000000000
18 --- a/sys-cluster/pacemaker/files/ping
19 +++ /dev/null
20 @@ -1,380 +0,0 @@
21 -#!/bin/sh
22 -#
23 -#
24 -# Ping OCF RA that utilizes the system ping
25 -#
26 -# Copyright (c) 2009 Andrew Beekhof
27 -# All Rights Reserved.
28 -#
29 -# This program is free software; you can redistribute it and/or modify
30 -# it under the terms of version 2 of the GNU General Public License as
31 -# published by the Free Software Foundation.
32 -#
33 -# This program is distributed in the hope that it would be useful, but
34 -# WITHOUT ANY WARRANTY; without even the implied warranty of
35 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
36 -#
37 -# Further, this software is distributed without any warranty that it is
38 -# free of the rightful claim of any third person regarding infringement
39 -# or the like. Any license provided herein, whether implied or
40 -# otherwise, applies only to this software file. Patent licenses, if
41 -# any, provided herein do not apply to combinations of this program with
42 -# other software, or any other product whatsoever.
43 -#
44 -# You should have received a copy of the GNU General Public License
45 -# along with this program; if not, write the Free Software Foundation,
46 -# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
47 -#
48 -
49 -#######################################################################
50 -# Initialization:
51 -
52 -: ${OCF_FUNCTIONS=${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs}
53 -. ${OCF_FUNCTIONS}
54 -: ${__OCF_ACTION=$1}
55 -
56 -#######################################################################
57 -
58 -meta_data() {
59 - cat <<END
60 -<?xml version="1.0"?>
61 -<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
62 -<resource-agent name="ping">
63 -<version>1.0</version>
64 -
65 -<longdesc lang="en">
66 -Every time the monitor action is run, this resource agent records (in the CIB) the current number of ping nodes the host can connect to.
67 -It is essentially the same as pingd except that it uses the system ping tool to obtain the results.
68 -</longdesc>
69 -<shortdesc lang="en">node connectivity</shortdesc>
70 -
71 -<parameters>
72 -
73 -<parameter name="pidfile" unique="0">
74 -<longdesc lang="en">PID file</longdesc>
75 -<shortdesc lang="en">PID file</shortdesc>
76 -<content type="string" default="$HA_VARRUN/ping-${OCF_RESOURCE_INSTANCE}" />
77 -</parameter>
78 -
79 -<parameter name="dampen" unique="0">
80 -<longdesc lang="en">
81 -The time to wait (dampening) further changes occur
82 -</longdesc>
83 -<shortdesc lang="en">Dampening interval</shortdesc>
84 -<content type="integer" default="5s"/>
85 -</parameter>
86 -
87 -<parameter name="name" unique="0">
88 -<longdesc lang="en">
89 -The name of the attributes to set. This is the name to be used in the constraints.
90 -</longdesc>
91 -<shortdesc lang="en">Attribute name</shortdesc>
92 -<content type="string" default="pingd"/>
93 -</parameter>
94 -
95 -<parameter name="multiplier" unique="0">
96 -<longdesc lang="en">
97 -The number by which to multiply the number of connected ping nodes by
98 -</longdesc>
99 -<shortdesc lang="en">Value multiplier</shortdesc>
100 -<content type="integer" default=""/>
101 -</parameter>
102 -
103 -<parameter name="host_list" unique="0" required="1">
104 -<longdesc lang="en">
105 -The list of ping nodes to count.
106 -</longdesc>
107 -<shortdesc lang="en">Host list</shortdesc>
108 -<content type="string" default=""/>
109 -</parameter>
110 -
111 -<parameter name="attempts" unique="0">
112 -<longdesc lang="en">
113 -Number of ping attempts, per host, before declaring it dead
114 -</longdesc>
115 -<shortdesc lang="en">no. of ping attempts</shortdesc>
116 -<content type="integer" default="2"/>
117 -</parameter>
118 -
119 -<parameter name="timeout" unique="0">
120 -<longdesc lang="en">
121 -How long, in seconds, to wait before declaring a ping lost
122 -</longdesc>
123 -<shortdesc lang="en">ping timeout in seconds</shortdesc>
124 -<content type="integer" default="2"/>
125 -</parameter>
126 -
127 -<parameter name="options" unique="0">
128 -<longdesc lang="en">
129 -A catch all for any other options that need to be passed to ping.
130 -</longdesc>
131 -<shortdesc lang="en">Extra Options</shortdesc>
132 -<content type="string" default=""/>
133 -</parameter>
134 -
135 -<parameter name="failure_score" unique="0">
136 -<longdesc lang="en">
137 -Resource is failed if the score is less than failure_score.
138 -Default never fails.
139 -</longdesc>
140 -<shortdesc lang="en">failure_score</shortdesc>
141 -<content type="integer" default=""/>
142 -</parameter>
143 -
144 -<parameter name="debug" unique="0">
145 -<longdesc lang="en">
146 -Enables to use default attrd_updater verbose logging on every call.
147 -</longdesc>
148 -<shortdesc lang="en">Verbose logging</shortdesc>
149 -<content type="string" default="false"/>
150 -</parameter>
151 -
152 -</parameters>
153 -
154 -<actions>
155 -<action name="start" timeout="60" />
156 -<action name="stop" timeout="20" />
157 -<action name="reload" timeout="100" />
158 -<action name="monitor" depth="0" timeout="60" interval="10"/>
159 -<action name="meta-data" timeout="5" />
160 -<action name="validate-all" timeout="30" />
161 -</actions>
162 -</resource-agent>
163 -END
164 -}
165 -
166 -#######################################################################
167 -
168 -ping_conditional_log() {
169 - level=$1; shift
170 - if [ ${OCF_RESKEY_debug} = "true" ]; then
171 - ocf_log $level "$*"
172 - fi
173 -}
174 -
175 -ping_usage() {
176 - cat <<END
177 -usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-data}
178 -
179 -Expects to have a fully populated OCF RA-compliant environment set.
180 -END
181 -}
182 -
183 -ping_start() {
184 - ping_monitor
185 - if [ $? = $OCF_SUCCESS ]; then
186 - return $OCF_SUCCESS
187 - fi
188 - touch ${OCF_RESKEY_pidfile}
189 - ping_update
190 -}
191 -
192 -ping_stop() {
193 -
194 - rm -f ${OCF_RESKEY_pidfile}
195 -
196 - attrd_updater -D -n $OCF_RESKEY_name -d $OCF_RESKEY_dampen $attrd_options
197 -
198 - return $OCF_SUCCESS
199 -}
200 -
201 -ping_monitor() {
202 - if [ -f ${OCF_RESKEY_pidfile} ]; then
203 - ping_update
204 - if [ $? -eq 0 ]; then
205 - return $OCF_SUCCESS
206 - fi
207 - return $OCF_ERR_GENERIC
208 - fi
209 - return $OCF_NOT_RUNNING
210 -}
211 -
212 -ping_validate() {
213 - # Is the state directory writable?
214 - state_dir=`dirname "$OCF_RESKEY_pidfile"`
215 - touch "$state_dir/$$"
216 - if [ $? != 0 ]; then
217 - ocf_log err "Invalid location for 'state': $state_dir is not writable"
218 - return $OCF_ERR_ARGS
219 - fi
220 - rm "$state_dir/$$"
221 -
222 -# Pidfile better be an absolute path
223 - case $OCF_RESKEY_pidfile in
224 - /*) ;;
225 - *) ocf_log warn "You should use an absolute path for pidfile not: $OCF_RESKEY_pidfile" ;;
226 - esac
227 -
228 -# Check the host list
229 - if [ "x" = "x$OCF_RESKEY_host_list" ]; then
230 - ocf_log err "Empty host_list. Please specify some nodes to ping"
231 - exit $OCF_ERR_CONFIGURED
232 - fi
233 -
234 - check_binary ping
235 -
236 - return $OCF_SUCCESS
237 -}
238 -
239 -
240 -fping_check() {
241 - active=0
242 - f_out=`mktemp`
243 - f_err=`mktemp`
244 -
245 - n=$OCF_RESKEY_attempts
246 - timeout=`expr $OCF_RESKEY_timeout \* 1000 / $OCF_RESKEY_attempts`
247 -
248 - cmd="fping -r $OCF_RESKEY_attempts -t $timeout -B 1.0 $OCF_RESKEY_host_list"
249 - $cmd>$f_out 2>$f_err; rc=$?
250 - active=`grep alive $f_out|wc -l`
251 -
252 - case $rc in
253 - 0)
254 - ;;
255 - 1)
256 - for h in `grep unreachable $f_out | awk '{print $1}'`; do
257 - ping_conditional_log warn "$h is inactive"
258 - done
259 - ;;
260 - *)
261 - ocf_log err "Unexpected result for '$cmd' $rc: `tr '\n' ';' < $f_err`"
262 - ;;
263 - esac
264 - rm -f $f_out $f_err
265 -
266 - return $active
267 -}
268 -
269 -ping_check() {
270 - active=0
271 - for host in $OCF_RESKEY_host_list; do
272 - p_exe=ping
273 -
274 - case `uname` in
275 - Linux) p_args="-n -q -W $OCF_RESKEY_timeout -c $OCF_RESKEY_attempts";;
276 - Darwin) p_args="-n -q -t $OCF_RESKEY_timeout -c $OCF_RESKEY_attempts -o";;
277 - *) ocf_log err "Unknown host type: `uname`"; exit $OCF_ERR_INSTALLED;;
278 - esac
279 -
280 - case $host in
281 - *:*) p_exe=ping6
282 - esac
283 -
284 - p_out=`$p_exe $p_args $OCF_RESKEY_options $host 2>&1`; rc=$?
285 -
286 - case $rc in
287 - 0) active=`expr $active + 1`;;
288 - 1) ping_conditional_log warn "$host is inactive: $p_out";;
289 - *) ocf_log err "Unexpected result for '$p_exe $p_args $OCF_RESKEY_options $host' $rc: $p_out";;
290 - esac
291 - done
292 - return $active
293 -}
294 -
295 -ping_update() {
296 -
297 - if have_binary fping; then
298 - fping_check
299 - active=$?
300 - else
301 - ping_check
302 - active=$?
303 - fi
304 -
305 - score=`expr $active \* $OCF_RESKEY_multiplier`
306 - attrd_updater -n $OCF_RESKEY_name -v $score -d $OCF_RESKEY_dampen $attrd_options
307 - rc=$?
308 - case $rc in
309 - 0) ping_conditional_log debug "Updated $OCF_RESKEY_name = $score" ;;
310 - *) ocf_log warn "Could not update $OCF_RESKEY_name = $score: rc=$rc";;
311 - esac
312 - if [ $rc -ne 0 ]; then
313 - return $rc
314 - fi
315 -
316 - if [ -n "$OCF_RESKEY_failure_score" -a "$score" -lt "$OCF_RESKEY_failure_score" ]; then
317 - ocf_log warn "$OCF_RESKEY_name is less than failure_score($OCF_RESKEY_failure_score)"
318 - return 1
319 - fi
320 - return 0
321 -}
322 -
323 -: ${OCF_RESKEY_name:="pingd"}
324 -: ${OCF_RESKEY_dampen:="5s"}
325 -: ${OCF_RESKEY_attempts:="3"}
326 -: ${OCF_RESKEY_multiplier:="1"}
327 -: ${OCF_RESKEY_debug:="false"}
328 -: ${OCF_RESKEY_failure_score:="0"}
329 -
330 -: ${OCF_RESKEY_CRM_meta_timeout:="20000"}
331 -: ${OCF_RESKEY_CRM_meta_globally_unique:="true"}
332 -
333 -integer=`echo ${OCF_RESKEY_timeout} | egrep -o '[0-9]*'`
334 -case ${OCF_RESKEY_timeout} in
335 - *[0-9]ms|*[0-9]msec) OCF_RESKEY_timeout=`expr $integer / 1000`;;
336 - *[0-9]m|*[0-9]min) OCF_RESKEY_timeout=`expr $integer \* 60`;;
337 - *[0-9]h|*[0-9]hr) OCF_RESKEY_timeout=`expr $integer \* 60 \* 60`;;
338 - *) OCF_RESKEY_timeout=$integer;;
339 -esac
340 -
341 -if [ -z ${OCF_RESKEY_timeout} ]; then
342 - if [ x"$OCF_RESKEY_host_list" != x ]; then
343 - host_count=`echo $OCF_RESKEY_host_list | awk '{print NF}'`
344 - OCF_RESKEY_timeout=`expr $OCF_RESKEY_CRM_meta_timeout / $host_count / $OCF_RESKEY_attempts`
345 - OCF_RESKEY_timeout=`expr $OCF_RESKEY_timeout / 1100` # Convert to seconds and finish 10% early
346 - else
347 - OCF_RESKEY_timeout=5
348 - fi
349 -fi
350 -
351 -if [ ${OCF_RESKEY_timeout} -lt 1 ]; then
352 - OCF_RESKEY_timeout=5
353 -elif [ ${OCF_RESKEY_timeout} -gt 1000 ]; then
354 - # ping actually complains if this value is too high, 5 minutes is plenty
355 - OCF_RESKEY_timeout=300
356 -fi
357 -
358 -if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then
359 - : ${OCF_RESKEY_pidfile:="$HA_VARRUN/ping-${OCF_RESKEY_name}"}
360 -else
361 - : ${OCF_RESKEY_pidfile:="$HA_VARRUN/ping-${OCF_RESOURCE_INSTANCE}"}
362 -fi
363 -
364 -case $__OCF_ACTION in
365 - meta-data)
366 - meta_data
367 - exit $OCF_SUCCESS
368 - ;;
369 - usage|help)
370 - ping_usage
371 - exit $OCF_SUCCESS
372 - ;;
373 -esac
374 -
375 -attrd_options='-q'
376 -if ocf_is_true ${OCF_RESKEY_debug} ; then
377 - attrd_options=''
378 -fi
379 -
380 -# Check the debug option
381 - case "${OCF_RESKEY_debug}" in
382 - true|True|TRUE|1) OCF_RESKEY_debug=true;;
383 - false|False|FALSE|0) OCF_RESKEY_debug=false;;
384 - *)
385 - ocf_log warn "Value for 'debug' is incorrect. Please specify 'true' or 'false' not: ${OCF_RESKEY_debug}"
386 - OCF_RESKEY_debug=false
387 - ;;
388 - esac
389 -
390 -case $__OCF_ACTION in
391 -start) ping_start;;
392 -stop) ping_stop;;
393 -monitor) ping_monitor;;
394 -reload) ping_start;;
395 -validate-all) ping_validate;;
396 -*) ping_usage
397 - exit $OCF_ERR_UNIMPLEMENTED
398 - ;;
399 -esac
400 -exit $?