From e1e99c548948b9766be4229ab9a46c3cdb76a223 Mon Sep 17 00:00:00 2001 From: phamt Date: Wed, 4 Jan 2012 02:29:36 +0000 Subject: [PATCH] Check network layer before setting MAC address. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11327 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/zvm.pm | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/zvm.pm b/xCAT-server/lib/xcat/plugins/zvm.pm index 215b1911e..cdc0bc3d6 100644 --- a/xCAT-server/lib/xcat/plugins/zvm.pm +++ b/xCAT-server/lib/xcat/plugins/zvm.pm @@ -2910,6 +2910,9 @@ EOM"`; $out = `ssh $hcp sed --in-place -e "s/$sourceNode/$tgtNode/g" \ -e "s/$sourceIp/$targetIp/i" $cloneMntPt/etc/hosts`; $out = `ssh $hcp sed --in-place -e "s/$sourceIp/$targetIp/i" \ -e "s/$sourceNode/$tgtNode/g" $ifcfgPath`; + # Get network layer + my $layer = xCAT::zvmCPUtils->getNetworkLayer( $hcp, $hcpNetName ); + # Set MAC address my $networkFile = $tgtNode . "NetworkConfig"; if ( $srcOs =~ m/Red Hat/i ) { @@ -2922,16 +2925,19 @@ EOM"`; # SUSE only $out = `ssh $hcp "cat $ifcfgPath" | grep -v "LLADDR" | grep -v "UNIQUE" > /tmp/$networkFile`; - $out = `echo "LLADDR='$targetMac'" >> /tmp/$networkFile`; - $out = `echo "UNIQUE=''" >> /tmp/$networkFile`; + + # Set to MAC address (only for layer 2) + if ( $layer == 2 ) { + $out = `echo "LLADDR='$targetMac'" >> /tmp/$networkFile`; + $out = `echo "UNIQUE=''" >> /tmp/$networkFile`; + } } xCAT::zvmUtils->sendFile( $hcp, "/tmp/$networkFile", $ifcfgPath ); # Remove network file from /tmp $out = `rm /tmp/$networkFile`; - # Set to hardware configuration (Only for layer 2) - my $layer = xCAT::zvmCPUtils->getNetworkLayer( $hcp, $hcpNetName ); + # Set to hardware configuration (only for layer 2) if ( $layer == 2 ) { #*** Red Hat ***