refine the code to use installnic and primarynic to generate network boot kernel parameters. All the logic to use installnic/primarynic have been put in NetworkUtils->gen_net_boot_params
This commit is contained in:
parent
d90a770ef2
commit
423f007a7f
@ -584,27 +584,53 @@ sub mknetboot
|
||||
$kcmdline .= "ip=dhcp ";
|
||||
|
||||
# add the kernel-booting parameter: netdev=<eth0>, or BOOTIF=<mac>
|
||||
my $netdev = "";
|
||||
my $mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{mac},$node);
|
||||
#my $netdev = "";
|
||||
#my $mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{mac},$node);
|
||||
|
||||
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and ($reshash->{$node}->[0]->{installnic} ne "mac")) {
|
||||
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
|
||||
} elsif ($nodebootif) {
|
||||
$kcmdline .= "netdev=" . $nodebootif . " ";
|
||||
} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and ($reshash->{$node}->[0]->{primarynic} ne "mac")) {
|
||||
$kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
|
||||
} else {
|
||||
if ($arch =~ /x86/) {
|
||||
#do nothing, we'll let pxe/xnba work their magic
|
||||
} elsif ($mac) {
|
||||
$kcmdline .= "BOOTIF=" . $mac . " ";
|
||||
} else {
|
||||
$callback->({
|
||||
error=>[qq{"cannot get the mac address for $node in mac table"}],
|
||||
errorcode=>[1]
|
||||
});
|
||||
}
|
||||
}
|
||||
#if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic} and ($reshash->{$node}->[0]->{installnic} ne "mac")) {
|
||||
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{installnic} . " ";
|
||||
#} elsif ($nodebootif) {
|
||||
# $kcmdline .= "netdev=" . $nodebootif . " ";
|
||||
#} elsif ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic} and ($reshash->{$node}->[0]->{primarynic} ne "mac")) {
|
||||
# $kcmdline .= "netdev=" . $reshash->{$node}->[0]->{primarynic} . " ";
|
||||
#} else {
|
||||
# if ($arch =~ /x86/) {
|
||||
# #do nothing, we'll let pxe/xnba work their magic
|
||||
# } elsif ($mac) {
|
||||
# $kcmdline .= "BOOTIF=" . $mac . " ";
|
||||
# } else {
|
||||
# $callback->({
|
||||
# error=>[qq{"cannot get the mac address for $node in mac table"}],
|
||||
# errorcode=>[1]
|
||||
# });
|
||||
# }
|
||||
#}
|
||||
|
||||
# add the kernel-booting parameter: netdev=<eth0>, or BOOTIF=<mac>
|
||||
my $mac;
|
||||
my $installnic;
|
||||
my $primarynic;
|
||||
|
||||
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{installnic}){
|
||||
$installnic=$reshash->{$node}->[0]->{installnic};
|
||||
}
|
||||
|
||||
if ($reshash->{$node}->[0] and $reshash->{$node}->[0]->{primarynic}){
|
||||
$primarynic=$reshash->{$node}->[0]->{primarynic};
|
||||
}
|
||||
|
||||
if (defined ($machash->{$node}->[0]) && $machash->{$node}->[0]->{'mac'}) {
|
||||
$mac = xCAT::Utils->parseMacTabEntry($machash->{$node}->[0]->{mac},$node);
|
||||
}
|
||||
|
||||
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($installnic, $primarynic, $mac, $nodebootif);
|
||||
|
||||
if (defined ($net_params->{ifname}) || defined ($net_params->{netdev})) {
|
||||
$kcmdline .= " $net_params->{ifname} $net_params->{netdev} ";
|
||||
} elsif (defined ($net_params->{BOOTIF}) && $arch=~ /ppc/) {
|
||||
$kcmdline .= " $net_params->{BOOTIF} ";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (defined $sent->{serialport}) {
|
||||
@ -1116,49 +1142,74 @@ sub mkinstall
|
||||
. $netserver . ":" . $httpport
|
||||
. "$httpprefix/1";
|
||||
|
||||
my $netdev = "";
|
||||
if ($ent->{installnic})
|
||||
{
|
||||
if ($ent->{installnic} eq "mac")
|
||||
{
|
||||
my $mactab = xCAT::Table->new("mac");
|
||||
my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
$netdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
}
|
||||
else
|
||||
{
|
||||
$netdev = $ent->{installnic};
|
||||
}
|
||||
#my $netdev = "";
|
||||
#if ($ent->{installnic})
|
||||
#{
|
||||
# if ($ent->{installnic} eq "mac")
|
||||
# {
|
||||
# my $mactab = xCAT::Table->new("mac");
|
||||
# my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
# $netdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# $netdev = $ent->{installnic};
|
||||
# }
|
||||
#}
|
||||
#elsif ($ent->{primarynic})
|
||||
#{
|
||||
# if ($ent->{primarynic} eq "mac")
|
||||
# {
|
||||
# my $mactab = xCAT::Table->new("mac");
|
||||
# my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
# $netdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
# }
|
||||
# else
|
||||
# {
|
||||
# $netdev = $ent->{primarynic};
|
||||
# }
|
||||
#}
|
||||
#else
|
||||
#{
|
||||
# $netdev = "bootif";
|
||||
#}
|
||||
#if ($netdev eq "") #why it is blank, no mac defined?
|
||||
#{
|
||||
# $callback->(
|
||||
# {
|
||||
# error => ["No mac.mac for $node defined"],
|
||||
# errorcode => [1]
|
||||
# }
|
||||
# );
|
||||
#}
|
||||
#unless ($netdev eq "bootif") { #if going by bootif, BOOTIF will suffice
|
||||
# $kcmdline .= " netdevice=" . $netdev;
|
||||
#}
|
||||
|
||||
my $installnic;
|
||||
my $primarynic;
|
||||
my $mac;
|
||||
|
||||
if ($ent->{installnic}){
|
||||
$installnic=$ent->{installnic};
|
||||
}
|
||||
|
||||
if($ent->{primarynic}){
|
||||
$primarynic=$ent->{primarynic};
|
||||
}
|
||||
elsif ($ent->{primarynic})
|
||||
{
|
||||
if ($ent->{primarynic} eq "mac")
|
||||
{
|
||||
my $mactab = xCAT::Table->new("mac");
|
||||
my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
$netdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
}
|
||||
else
|
||||
{
|
||||
$netdev = $ent->{primarynic};
|
||||
}
|
||||
|
||||
|
||||
my $mactab = xCAT::Table->new("mac");
|
||||
my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
if($macref->{mac}){
|
||||
$mac=xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
}
|
||||
else
|
||||
{
|
||||
$netdev = "bootif";
|
||||
}
|
||||
if ($netdev eq "") #why it is blank, no mac defined?
|
||||
{
|
||||
$callback->(
|
||||
{
|
||||
error => ["No mac.mac for $node defined"],
|
||||
errorcode => [1]
|
||||
}
|
||||
);
|
||||
}
|
||||
unless ($netdev eq "bootif") { #if going by bootif, BOOTIF will suffice
|
||||
$kcmdline .= " netdevice=" . $netdev;
|
||||
|
||||
my $net_params=xCAT::NetworkUtils->gen_net_boot_params($installnic, $primarynic, $mac);
|
||||
if (defined ($net_params->{netdevice})) {
|
||||
$kcmdline .= " $net_params->{netdevice} ";
|
||||
}
|
||||
|
||||
|
||||
# Add the kernel paramets for driver update disk loading
|
||||
foreach (@dd_drivers) {
|
||||
@ -1467,30 +1518,50 @@ sub mksysclone
|
||||
my $sent = $hents{$node}->[0];
|
||||
|
||||
my $kcmdline = "ramdisk_size=$ramdisk_size";
|
||||
my $ksdev = "";
|
||||
if ($ent->{installnic})
|
||||
{
|
||||
$ksdev = $ent->{installnic};
|
||||
#my $ksdev = "";
|
||||
#if ($ent->{installnic})
|
||||
#{
|
||||
# $ksdev = $ent->{installnic};
|
||||
#}
|
||||
#elsif ($ent->{primarynic})
|
||||
#{
|
||||
# $ksdev = $ent->{primarynic};
|
||||
#}
|
||||
#else
|
||||
#{
|
||||
# $ksdev = "bootif"; #if not specified, fall back to bootif
|
||||
#}
|
||||
|
||||
#if ($ksdev eq "mac")
|
||||
#{
|
||||
# my $mactab = xCAT::Table->new("mac");
|
||||
# my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
# $ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
#}
|
||||
|
||||
#unless ( $ksdev eq "bootif" ) {
|
||||
# $kcmdline .= " netdevice=" . $ksdev;
|
||||
#}
|
||||
|
||||
my $installnic;
|
||||
my $primarynic;
|
||||
my $mac;
|
||||
if ($ent->{installnic}){
|
||||
$installnic= $ent->{installnic};
|
||||
}
|
||||
|
||||
if ($ent->{primarynic}){
|
||||
$primarynic=$ent->{primarynic};
|
||||
}
|
||||
elsif ($ent->{primarynic})
|
||||
{
|
||||
$ksdev = $ent->{primarynic};
|
||||
}
|
||||
else
|
||||
{
|
||||
$ksdev = "bootif"; #if not specified, fall back to bootif
|
||||
|
||||
my $mactab = xCAT::Table->new("mac");
|
||||
my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
if($macref->{mac}){
|
||||
$mac=xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
}
|
||||
|
||||
if ($ksdev eq "mac")
|
||||
{
|
||||
my $mactab = xCAT::Table->new("mac");
|
||||
my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
$ksdev = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
}
|
||||
|
||||
unless ( $ksdev eq "bootif" ) {
|
||||
$kcmdline .= " netdevice=" . $ksdev;
|
||||
}
|
||||
my $net_params = xCAT::NetworkUtils->gen_net_boot_params($installnic,$primarynic,$mac);
|
||||
$kcmdline .= " $net_params->{netdevice} ";
|
||||
|
||||
if ($arch =~ /ppc/) {
|
||||
$kcmdline .= " dhcptimeout=150";
|
||||
@ -1515,17 +1586,17 @@ sub mksysclone
|
||||
}
|
||||
$kcmdline .= " XCAT=$xcatmaster:$xcatdport xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
|
||||
|
||||
my $nodetab = xCAT::Table->new('nodetype');
|
||||
my $archref = $nodetab->getNodeAttribs($node, ['arch']);
|
||||
if ($archref->{arch} eq "ppc64"){
|
||||
my $mactab = xCAT::Table->new('mac');
|
||||
my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
my $formatmac = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
$formatmac =~ s/:/-/g;
|
||||
$formatmac = "01-".$formatmac;
|
||||
$kcmdline .= " BOOTIF=$formatmac ";
|
||||
}
|
||||
|
||||
#my $nodetab = xCAT::Table->new('nodetype');
|
||||
#my $archref = $nodetab->getNodeAttribs($node, ['arch']);
|
||||
#if ($archref->{arch} eq "ppc64"){
|
||||
# my $mactab = xCAT::Table->new('mac');
|
||||
# my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
# my $formatmac = xCAT::Utils->parseMacTabEntry($macref->{mac},$node);
|
||||
# $formatmac =~ s/:/-/g;
|
||||
# $formatmac = "01-".$formatmac;
|
||||
# $kcmdline .= " BOOTIF=$formatmac ";
|
||||
#}
|
||||
$kcmdline .= " $net_params->{BOOTIF} ";
|
||||
|
||||
my $i = "xcat/genesis.fs.$arch.gz";
|
||||
if ( -r "$tftpdir/xcat/genesis.fs.$arch.lzma" ){
|
||||
|
Loading…
Reference in New Issue
Block a user