From 139f1c0303e0d9c6683e6862dd37c85def9a464b Mon Sep 17 00:00:00 2001 From: ligc Date: Wed, 3 Mar 2010 03:28:18 +0000 Subject: [PATCH] primarynic and installnic can be set to mac address git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5344 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/anaconda.pm | 35 ++++++++++++++++++++++-- xCAT-server/lib/xcat/plugins/sles.pm | 35 ++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 4cba7141d..c76cb0ff7 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -776,18 +776,47 @@ sub mkinstall if ($maxmem) { $kcmdline.=" mem=$maxmem"; } + my $ksdev = ""; if ($ent->{installnic}) { - $kcmdline .= " ksdevice=" . $ent->{installnic}; + if ($ent->{installnic} eq "mac") + { + my $mactab = xCAT::Table->new("mac"); + my $macref = $mactab->getNodeAttribs($node, ['mac']); + $ksdev = $macref->{mac}; + } + else + { + $ksdev = $ent->{installnic}; + } } elsif ($ent->{primarynic}) { - $kcmdline .= " ksdevice=" . $ent->{primarynic}; + if ($ent->{primarynic} eq "mac") + { + my $mactab = xCAT::Table->new("mac"); + my $macref = $mactab->getNodeAttribs($node, ['mac']); + $ksdev = $macref->{mac}; + } + else + { + $ksdev = $ent->{primarynic}; + } } else { - $kcmdline .= " ksdevice=eth0"; + $ksdev = "eth0"; } + if ($ksdev eq "") + { + $callback->( + { + error => ["No MAC address defined for " . $node], + errorcode => [1] + } + ); + } + $kcmdline .= " ksdevice=" . $ksdev; #TODO: dd= for driver disks if (defined($sent->{serialport})) diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 5dfc26344..f27aaae07 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -653,18 +653,47 @@ sub mkinstall } else { + my $netdev = ""; if ($ent->{installnic}) { - $kcmdline .= " netdevice=" . $ent->{installnic}; + if ($ent->{installnic} eq "mac") + { + my $mactab = xCAT::Table->new("mac"); + my $macref = $mactab->getNodeAttribs($node, ['mac']); + $netdev = $macref->{mac}; + } + else + { + $netdev = $ent->{installnic}; + } } elsif ($ent->{primarynic}) { - $kcmdline .= " netdevice=" . $ent->{primarynic}; + if ($ent->{primarynic} eq "mac") + { + my $mactab = xCAT::Table->new("mac"); + my $macref = $mactab->getNodeAttribs($node, ['mac']); + $netdev = $macref->{mac}; + } + else + { + $netdev = $ent->{primarynic}; + } } else { - $kcmdline .= " netdevice=eth0"; + $netdev = "eth0"; } + if ($netdev eq "") #why it is blank, no mac defined? + { + $callback->( + { + error => ["No mac.mac for $node defined"], + errorcode => [1] + } + ); + } + $kcmdline .= " netdevice=" . $netdev; } #TODO: driver disk handling should in SLES case be a mod of the install source, nothing to see here