From 2bf8108af61b7330f2b99daa4285c8bce90c4893 Mon Sep 17 00:00:00 2001 From: cxhong Date: Thu, 21 Jun 2018 01:40:41 -0400 Subject: [PATCH] build xnba config files from boottarget table (#5296) --- xCAT-server/lib/xcat/plugins/xnba.pm | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/xnba.pm b/xCAT-server/lib/xcat/plugins/xnba.pm index 7fdaec0d7..01eb1747c 100644 --- a/xCAT-server/lib/xcat/plugins/xnba.pm +++ b/xCAT-server/lib/xcat/plugins/xnba.pm @@ -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!/) {