Fixed the issue that configeth doesn't configure ethernet in power 775 clusters

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@10928 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
wanghuaz 2011-10-31 10:20:53 +00:00
parent 298d3cf213
commit 9f7465c94b

View File

@ -9,8 +9,9 @@ use Socket;
# Take primary node name, add "-eth1" for linux and "-en1" for AIX and
# then reverse resolve to get what ip should be
my $nic;
my $nic_num = 0;
if ($^O =~ /^aix/i) {
$nic = 'en1';
$nic = 'en$nic_num';
} else {
$nic = 'eth1';
}
@ -42,21 +43,23 @@ sub getipaddr()
}
}
my $hostname = "$ENV{NODE}-$nic";
my $host = `echo $ENV{NODE} |sed "s/-hf[0-9]//g"`;
chomp($host);
my $hostname = "$host-$nic";
my $ip = &getipaddr($hostname);
if (!$ip) { system("logger -t xcat 'configeth: cannot resolve $hostname.'"); exit 1; }
#TODO: should contact xcatd on the service node to get the netmask and gateway from the networks table
my $netmask = "255.255.0.0";
my $netmask = "255.0.0.0";
#my ($first, $second, $rest) = split(/\./, $ip);
#my $gateway = "$first.$second.255.254";
if ($^O =~ /^aix/i) {
if ($ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/) {
runcmd("chdev -l 'en1' -a netaddr=$ip -a netmask=$netmask -a state='up'");
runcmd("chdev -l 'en$nic_num' -a netaddr=$ip -a netmask=$netmask -a state='up'");
} else { #ipv6
runcmd("autoconf6 -6i en1");
runcmd("autoconf6 -6i en$nic_num");
}
}
elsif (($ENV{OSVER} && ($ENV{OSVER} =~ /sles|suse/i)) || (-f "/etc/SuSE-release")) {