From 9f7465c94b4a71a26d9d93723391ca7b781d71e8 Mon Sep 17 00:00:00 2001 From: wanghuaz Date: Mon, 31 Oct 2011 10:20:53 +0000 Subject: [PATCH] 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 --- xCAT/postscripts/configeth | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/xCAT/postscripts/configeth b/xCAT/postscripts/configeth index 41e253d90..7427904e4 100755 --- a/xCAT/postscripts/configeth +++ b/xCAT/postscripts/configeth @@ -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")) {