From 233b67e87ef1513c48e4d351c83466c7cd5ea6eb Mon Sep 17 00:00:00 2001 From: jjhua Date: Wed, 1 Apr 2009 06:52:40 +0000 Subject: [PATCH] add some code to check if the nodes exist in /etc/hosts. bug2689638 git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3060 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/nodestat.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/nodestat.pm b/xCAT-server/lib/xcat/plugins/nodestat.pm index ef70e8652..1f34b19ad 100644 --- a/xCAT-server/lib/xcat/plugins/nodestat.pm +++ b/xCAT-server/lib/xcat/plugins/nodestat.pm @@ -166,7 +166,16 @@ sub process_request { my %unknownnodes; foreach (@nodes) { $unknownnodes{$_}=1; + my $packed_ip = undef; + $packed_ip = gethostbyname($_); + if( !defined $packed_ip) { + my %rsp; + $rsp{name}=[$_]; + $rsp{data} = [ "Please make sure $_ exists in /etc/hosts" ]; + $callback->({node=>[\%rsp]}); + } } + my $node; my $fping; open($fping,"fping ".join(' ',@nodes). " 2> /dev/null|") or die("Can't start fping: $!");