2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-29 09:13:08 +00:00

build xnba config files from boottarget table (#5296)

This commit is contained in:
cxhong 2018-06-21 01:40:41 -04:00 committed by yangsong
parent c922ad2cf7
commit 2bf8108af6

View File

@ -105,11 +105,20 @@ sub setstate {
my %machash = %{ shift() };
my %iscsihash = %{ shift() };
my $tftpdir = shift;
my %linuximghash = ();
my $linuximghashref = shift;
if (ref $linuximghashref) { %linuximghash = %{$linuximghashref}; }
my $imgaddkcmdline = ($linuximghash{'boottarget'}) ? undef : $linuximghash{'addkcmdline'};
my $kern = $bphash{$node}->[0];
my $imgaddkcmdline = $linuximghashref->{'addkcmdline'};
my $imgboottarget = $linuximghashref->{'boottarget'};
# get kernel and initrd from boottarget table
my $bttab;
my $btentry;
if ($imgboottarget) {
$bttab = xCAT::Table->new('boottarget');
$btentry = $bttab->getAttribs({ 'bprofile' => $imgboottarget }, 'kernel', 'initrd', 'kcmdline');
}
unless ($::XNBA_addkcmdlinehandled->{$node}) { #Tag to let us know the plugin had a special syntax implemented for addkcmdline
if ($kern->{addkcmdline} or ($imgaddkcmdline)) {
@ -171,6 +180,18 @@ sub setstate {
}
}
#fill in kernel, intrd and kcmdline from boottarget table if not available
unless ($kern->{kernel}) {
$kern->{kernel} = $btentry->{kernel};
}
unless ($kern->{initrd}) {
$kern->{initrd} = $btentry->{initrd};
}
unless ($kern->{kcmdline}) {
$kern->{kcmdline} = $btentry->{kcmdline};
}
my $elilokcmdline = $kern->{kcmdline}; #track it separate, since vars differ
my $pxelinuxkcmdline = $kern->{kcmdline}; #track it separate, since vars differ
if ($kern->{kcmdline} =~ /!myipfn!/) {