From 9a672c732980214c64578d6f3917b1b549c01cfe Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 1 May 2013 17:16:28 +0000 Subject: [PATCH] Fixed how MAC address prefix is obtained by using VMCP Q VMLAN instead of using VMCP Q V NIC. VMCP Q VMLAN is more accurate for z/VM 6.2 SSI clusters. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@16149 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/zvmUtils.pm | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/perl-xCAT/xCAT/zvmUtils.pm b/perl-xCAT/xCAT/zvmUtils.pm index 4719630a2..f28e4b3b7 100644 --- a/perl-xCAT/xCAT/zvmUtils.pm +++ b/perl-xCAT/xCAT/zvmUtils.pm @@ -1090,16 +1090,23 @@ sub createMacAddr { return -1; } - # Get HCP MAC address - # Get the first MAC address found - my $out = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmcp q v nic" | grep "MAC:"`; - my @lines = split( "\n", $out ); - my @vars = split( " ", $lines[0] ); - - # Extract MAC prefix - my $prefix = $vars[1]; - $prefix = xCAT::zvmUtils->replaceStr( $prefix, "-", "" ); - $prefix = substr( $prefix, 0, 6 ); + # Get USER Prefix + my $prefix = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmcp q vmlan" | egrep -i "USER Prefix:"`; + $prefix =~ s/(.*?)USER Prefix:(.*)/$2/; + $prefix =~ s/^\s+//; + $prefix =~ s/\s+$//; + + # Get MACADDR Prefix instead if USER Prefix is not defined + if (!$prefix) { + $prefix = `ssh -o ConnectTimeout=5 $user\@$hcp "$sudo /sbin/vmcp q vmlan" | egrep -i "MACADDR Prefix:"`; + $prefix =~ s/(.*?)MACADDR Prefix:(.*)/$2/; + $prefix =~ s/^\s+//; + $prefix =~ s/\s+$//; + + if (!$prefix) { + return -1; + } + } # Generate MAC address of source node my $mac = $prefix . $suffix;