Horms wrote:
In article <[EMAIL PROTECTED]> you wrote:
Guochun Shi wrote:
excellent, this fixed bug 952
-Guochun
linux-ha-cvs@lists.linux-ha.org wrote:
linux-ha CVS committal
Author : sunjd
Host : Project : linux-ha
Module : lib
Dir : linux-ha/lib/plugins/stonith/external
Modified Files:
ssh.in
Log Message:
bug952: avoid to freeze for a long time
===================================================================
RCS file:
/home/cvs/linux-ha/linux-ha/lib/plugins/stonith/external/ssh.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- ssh.in 17 Nov 2005 05:32:31 -0000 1.7
+++ ssh.in 30 Nov 2005 02:28:37 -0000 1.8
@@ -41,7 +41,7 @@
for j in 1 2 3
do
if
- ping -w0.5 -c1 "$1" >/dev/null 2>&1
+ ping -w1 -c1 "$1" >/dev/null 2>&1
then
return 1
fi
@@ -97,7 +97,7 @@
for h in $hostlist
do
if
- host $h 2>&1 | grep "not found:"
+ ping -w1 -c1 "$h" 2>&1 | grep "unknown host"
But, this change is in error.
You should not fail to verify the parameters just because the host is
down. That's what the code originally did - and it's wrong. Ping is
the wrong command to issue in this case. On the other hand, this is
probably exactly what caused the problem in my site - since they aren't
in DNS, but only in /etc/hosts.
So, the right thing to do is write a function - maybe called checkhost()
which looks in /etc/hosts, and if it's not there, then use host as it
originally did.
I think it would be better to write a small c programme that exposes
gethostbyname as a shell command. This would honour the previling
nsswitch.conf and let libc worry about the details.
Something like the code below. Sorry its a bit over engineered,
I pieced it from code I had lying around the house.
I don't think that anything complex is needed. This is only test code,
and it's never going to use this to contact the machines - just to
figure out if the names given are valid. If they're found in
/etc/hosts, OR in DNS, it's all good. It won't cover those people who
might be using yellow pages or something like that. But, I really don't
care about that case for testing (which is all this code is good for).
--
Alan Robertson <[EMAIL PROTECTED]>
"Openness is the foundation and preservative of friendship... Let me
claim from you at all times your undisguised opinions." - William
Wilberforce
_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/