From fa4a8e6e2833d53fe25a405644d3758ecc33602e Mon Sep 17 00:00:00 2001 From: xq2005 Date: Wed, 3 Jul 2013 07:59:12 +0000 Subject: [PATCH] use 'mac' by default if installnic and primarynic are not defined git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16867 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/confignics | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/xCAT/postscripts/confignics b/xCAT/postscripts/confignics index e8790966b..764a85b8a 100755 --- a/xCAT/postscripts/confignics +++ b/xCAT/postscripts/confignics @@ -402,23 +402,14 @@ sub get_install_nic { $i_p_nic = $primarynic; } - if ($i_p_nic eq "mac") { - # determine nic from mac. Get all NICs and their mac addresses from ifconfig - # and compare that with MACADDR. - my @ifcfg_info = split(/\n/,`ifconfig -a | grep HWaddr | awk '{print \$1,\$5;}'`); - foreach my $nic_mac (@ifcfg_info) { - my @nicmac = split(/ /,$nic_mac); - if (uc($nicmac[1]) eq uc($MAC)) { - $inst_nic = $nicmac[0]; - last; - } - } - } else { # INSTALLNIC not set or is not known - + if (!$i_p_nic) { + system("logger -t xcat -p local4.info 'confignics $thisnode: installnic and primarynic are not defined', use 'mac' by default."); + $i_p_nic = "mac"; } - if ($installnic =~ /(e(n|th)\d+)$/ ) { + + if ($i_p_nic =~ /(e(n|th)\d+)$/ ) { $inst_nic = $1; - } elsif ($installnic eq "mac") { + } elsif ($i_p_nic eq "mac") { # determine nic from mac. Get all NICs and their mac addresses from ifconfig # and compare that with MACADDR. my @ifcfg_info = split(/\n/,`ifconfig -a | grep HWaddr | awk '{print \$1,\$5;}'`);