From b94dcb02e44a33b49a990f2c47d830a6745b3d4e Mon Sep 17 00:00:00 2001 From: immarvin Date: Wed, 29 Oct 2014 00:54:58 -0700 Subject: [PATCH] fix defect #4326 [fvt]2.9:load config file failed if more than one mac during vm install --- perl-xCAT/xCAT/Utils.pm | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/perl-xCAT/xCAT/Utils.pm b/perl-xCAT/xCAT/Utils.pm index f8efb5dd0..5f37479b4 100755 --- a/perl-xCAT/xCAT/Utils.pm +++ b/perl-xCAT/xCAT/Utils.pm @@ -4295,5 +4295,43 @@ sub cleanup_for_powerLE_hardware_discovery { } +#The parseMacTabEntry parses the mac table entry and return the mac address of nic in management network +#Arguments: +#macString : the string of mac table entry +#HostName : the hostname of the node +#The mac address is taken as installnic when: +#1. the mac addr does not have a suffix "!xxxx" +#2. the mac addr has a fuffix "!" +#The schema description of mac table is: +# mac: The mac address or addresses for which xCAT will manage static bindings for this node. +#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/) + { + $macString=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{ + $mac_ret=$mac_t; + } + } + + + return $mac_ret; +} + 1;