Author: arkurth
Date: Fri Apr 24 16:09:37 2015
New Revision: 1675892
URL: http://svn.apache.org/r1675892
Log:
VCL-868
Updated utils.pm::_pingnode to use determine_remote_connection_target to
determine the IP address if a hostname argument is provided.
Modified:
vcl/trunk/managementnode/lib/VCL/utils.pm
Modified: vcl/trunk/managementnode/lib/VCL/utils.pm
URL:
http://svn.apache.org/viewvc/vcl/trunk/managementnode/lib/VCL/utils.pm?rev=1675892&r1=1675891&r2=1675892&view=diff
==============================================================================
--- vcl/trunk/managementnode/lib/VCL/utils.pm (original)
+++ vcl/trunk/managementnode/lib/VCL/utils.pm Fri Apr 24 16:09:37 2015
@@ -2183,29 +2183,44 @@ sub nmap_port {
=head2 _pingnode
- Parameters : $hostname
- Returns : 1 pingable 0 not-pingable
- Description : using Net::Ping to check if node is pingable
- assumes icmp echo is allowed
+ Parameters : $node
+ Returns : boolean
+ Description : Uses Net::Ping to check if a node is responding to ICMP echo
+ ping.
=cut
sub _pingnode {
- my ($hostname) = $_[0];
- if (!$hostname) {
- notify($ERRORS{'WARNING'}, 0, "hostname argument was not
supplied");
+ my ($node) = @_;
+ if (!$node) {
+ notify($ERRORS{'WARNING'}, 0, "node argument was not supplied");
return;
}
-
+
+ my $node_string = $node;
+ my $remote_connection_target;
+ if (is_valid_ip_address($node, 0)) {
+ $remote_connection_target = $node;
+ }
+ else {
+ $remote_connection_target =
determine_remote_connection_target($node);
+ if ($remote_connection_target) {
+ $node_string .= " ($remote_connection_target)";
+ $node = $remote_connection_target;
+ }
+ }
+
my $p = Net::Ping->new("icmp");
- my $result = $p->ping($hostname, 1);
+ my $result = $p->ping($remote_connection_target, 1);
$p->close();
- if (!$result) {
- return 0;
+ if ($result) {
+ #notify($ERRORS{'DEBUG'}, 0, "$node_string is responding to
ping");
+ return 1;
}
else {
- return 1;
+ #notify($ERRORS{'DEBUG'}, 0, "$node_string is NOT responding to
ping");
+ return 0;
}
} ## end sub _pingnode