From 56d592c0607db569787a31fd95c29f77e623d2d5 Mon Sep 17 00:00:00 2001 From: daniceexi Date: Wed, 14 Oct 2009 07:25:05 +0000 Subject: [PATCH] fix the defect that getmacs for js22 blade cannot work on 32bit Operating System git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@4384 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/blade.pm | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/blade.pm b/xCAT-server/lib/xcat/plugins/blade.pm index 4f17e8b93..df84ce8ac 100644 --- a/xCAT-server/lib/xcat/plugins/blade.pm +++ b/xCAT-server/lib/xcat/plugins/blade.pm @@ -1361,9 +1361,21 @@ sub getmacs { my $basemac = $1; $basemac =~ s/mac address \d: //i; $basemac =~ s/://g; - my $macnum = hex($basemac); - $macnum += 1; - my $newmac = sprintf("%012X",$macnum); + # Since 32bit Operating System can only handle 32bit integer, + # split the mac address as high 24bit and low 24bit + $basemac =~ /(......)(......)/; + my ($basemac_h6, $basemac_l6) = ($1, $2); + my $macnum_l6 = hex($basemac_l6); + my $macnum_h6 = hex($basemac_h6); + $macnum_l6 += 1; + if ($macnum_l6 > 0xFFFFFF) { + $macnum_h6 += 1; + } + my $newmac_l6 = sprintf("%06X", $macnum_l6); + $newmac_l6 =~ /(......)$/; + $newmac_l6 = $1; + my $newmac_h6 = sprintf("%06X", $macnum_h6); + my $newmac = $newmac_h6.$newmac_l6; $newmac =~ s/(..)(..)(..)(..)(..)(..)/$1:$2:$3:$4:$5:$6/; my $newidx = scalar(@macs)+1; push @macs,"MAC Address $newidx: ".$newmac;