make sure niminfo is valid for xcatinfo

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10917 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
nott 2011-10-28 20:23:51 +00:00
parent 6bfa91b8d3
commit 99824cb458

View File

@ -107,20 +107,27 @@ if (-f "/etc/xcatinfo") {
if (!$foundxcatinfo) {
# get the name of my service node (NIM master) from the /etc/niminfo file
if (-f "/etc/niminfo") {
$cmd = "cat /etc/niminfo | grep 'NIM_MASTER_HOSTNAME'";
&runcmd($cmd);
my $SNline = $::outref;
my $junk;
($junk, $servnode) = split(/=/, $SNline);
if ($servnode) {
chomp $servnode;
$servnode =~ s/^\s*//;
# save the servnode from niminfo in xcatinfo
my $xcatinfo="/etc/xcatinfo";
open(XCATINFO,">",$xcatinfo);
print XCATINFO "XCATSERVER=$servnode\n";
close(XCATINFO);
$cmd = "cat /etc/niminfo | grep 'NIM_NAME'";
&runcmd($cmd);
my $line = $::outref;
my $junk;
($junk, $myname) = split(/=/, $line);
chomp $myname;
if ($myname ne "master") {
$cmd = "cat /etc/niminfo | grep 'NIM_MASTER_HOSTNAME'";
&runcmd($cmd);
my $SNline = $::outref;
($junk, $servnode) = split(/=/, $SNline);
if ($servnode) {
chomp $servnode;
$servnode =~ s/^\s*//;
# save the servnode from niminfo in xcatinfo
my $xcatinfo="/etc/xcatinfo";
open(XCATINFO,">",$xcatinfo);
print XCATINFO "XCATSERVER=$servnode\n";
close(XCATINFO);
}
}
} else {
print "$::sdate xcataixpost: Could not find /etc/niminfo file.\n";
@ -129,12 +136,14 @@ if (!$foundxcatinfo) {
}
# do ping test on server and use -m value if provides
my $pcmd = "ping -c 2 -w 2 $servnode";
if (&runcmd($pcmd) != 0) {
$servnode = "";
if ($::opt_m) {
chomp $::opt_m;
$servnode = $::opt_m;
if ($servnode) {
my $pcmd = "ping -c 2 -w 2 $servnode";
if (&runcmd($pcmd) != 0) {
$servnode = "";
if ($::opt_m) {
chomp $::opt_m;
$servnode = $::opt_m;
}
}
}