From 3bede8df02629a1a507acd2c6a8968596cf0c2fb Mon Sep 17 00:00:00 2001 From: immarvin Date: Fri, 29 May 2015 23:51:52 -0400 Subject: [PATCH] fix defect #4682 [DEV]Sles12 diskfull compute install failed with multiple mac address --- perl-xCAT/xCAT/Utils.pm | 20 +++++++++---------- xCAT-server/lib/perl/xCAT/Template.pm | 1 + .../share/xcat/install/scripts/chroot.sles | 2 +- .../share/xcat/install/scripts/post.debian | 2 +- .../share/xcat/install/scripts/post.rh.common | 2 +- .../share/xcat/install/scripts/post.ubuntu | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index a737fe30d..bc8a1d50b 100644 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4476,24 +4476,23 @@ sub cleanup_for_powerLE_hardware_discovery { #This may be simply a mac address, which would be bound to the node name (such as "01:02:03:04:05:0E"). #This may also be a "|" delimited string of "mac address!hostname" format (such as "01:02:03:04:05:0E!node5|01:02:03:05:0F!node6-eth1"). sub parseMacTabEntry{ - my $macString=shift; - if( $macString =~ /xCAT::Utils/) { + if( $macString =~ /xCAT::Utils/){ $macString=shift; } - my $HostName=shift; + my $HostName=shift; my $mac_ret; my @macEntry=split(/\|/,$macString); - foreach my $mac_t (@macEntry){ - if($mac_t =~ /!/){ - if($mac_t =~ /(.+)!$HostName$/){ - $mac_ret=$1; - } - }else{ + unless($mac_t =~ /!/){ $mac_ret=$mac_t; } + + if($HostName and $mac_t =~ /(.+)\!$HostName$/){ + $mac_ret=$1; + last; + } } if ($mac_ret) { @@ -4501,10 +4500,11 @@ sub parseMacTabEntry{ $mac_ret =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/; } } - + return $mac_ret; } + #The splitkcmdline subroutine is used to split the "persistent kernel options" #and "provision-time kernel options" out of the kernel cmdline string #Arguments: diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 88d47a65e..fff570b7e 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -335,6 +335,7 @@ sub subvars { $inc =~ s/#HOSTNAME#/$node/g; $inc =~ s/#SHORTNAME#/$shortname/g; $inc =~ s/#GETNODEDOMAIN:([^#]+)#/get_node_domain($1)/eg; + $inc =~ s/#GETPRINICMAC:([^#]+)#/xCAT::Utils::parseMacTabEntry(tabdb("mac",$1,"mac"),$1)/eg; my $nrtab = xCAT::Table->new("noderes"); my $tftpserver = $nrtab->getNodeAttribs($node, ['tftpserver']); diff --git a/xCAT-server/share/xcat/install/scripts/chroot.sles b/xCAT-server/share/xcat/install/scripts/chroot.sles index cf22e985a..f82f0113e 100644 --- a/xCAT-server/share/xcat/install/scripts/chroot.sles +++ b/xCAT-server/share/xcat/install/scripts/chroot.sles @@ -40,7 +40,7 @@ chmod 755 /tmp/updateflag.awk export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# if [ "$PRINIC" == "mac" ] then - export PRINIC='#TABLE:mac:THISNODE:mac#' + export PRINIC='#GETPRINICMAC:THISNODE#' fi if [ -z "$PRINIC" ] then diff --git a/xCAT-server/share/xcat/install/scripts/post.debian b/xCAT-server/share/xcat/install/scripts/post.debian index 5d54bc7d6..38dc53027 100644 --- a/xCAT-server/share/xcat/install/scripts/post.debian +++ b/xCAT-server/share/xcat/install/scripts/post.debian @@ -6,7 +6,7 @@ echo "post scripts" >/root/post.log export PRINIC=#TABLE:noderes:THISNODE:primarynic# if [ "$PRINIC" == "mac" ] then - export PRINIC='#TABLE:mac:THISNODE:mac#' + export PRINIC='#GETPRINICMAC:THISNODE#' fi if [ -z "$PRINIC" ] then diff --git a/xCAT-server/share/xcat/install/scripts/post.rh.common b/xCAT-server/share/xcat/install/scripts/post.rh.common index f7a177061..cadc45d08 100644 --- a/xCAT-server/share/xcat/install/scripts/post.rh.common +++ b/xCAT-server/share/xcat/install/scripts/post.rh.common @@ -7,7 +7,7 @@ echo "post scripts" >/root/post.log export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# if [ "$PRINIC" == "mac" ] then - export PRINIC='#TABLE:mac:THISNODE:mac#' + export PRINIC='#GETPRINICMAC:THISNODE#' fi if [ -z "$PRINIC" ] then diff --git a/xCAT-server/share/xcat/install/scripts/post.ubuntu b/xCAT-server/share/xcat/install/scripts/post.ubuntu index 80a6ea669..a8f86af22 100755 --- a/xCAT-server/share/xcat/install/scripts/post.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/post.ubuntu @@ -6,7 +6,7 @@ echo "post scripts" >/root/post.log export PRINIC=#TABLEBLANKOKAY:noderes:THISNODE:primarynic# if [ "$PRINIC" == "mac" ] then - export PRINIC='#TABLE:mac:THISNODE:mac#' + export PRINIC='#GETPRINICMAC:THISNODE#' fi if [ -z "$PRINIC" ] then