mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-04 05:12:30 +00:00 
			
		
		
		
	check in the code to support the driver injection for stateless: 1. genimage will copy the generated initrd to /tftpboot;2. support nodeset --noupdateinitrd
This commit is contained in:
		@@ -172,6 +172,7 @@ sub mknetboot
 | 
			
		||||
    my $nodes    = @{$req->{node}};
 | 
			
		||||
    my @args     = @{$req->{arg}} if(exists($req->{arg}));
 | 
			
		||||
    my @nodes    = @{$req->{node}};
 | 
			
		||||
    my $noupdateinitrd = $req->{'noupdateinitrd'};
 | 
			
		||||
    my $ostab    = xCAT::Table->new('nodetype');
 | 
			
		||||
    #my $sitetab  = xCAT::Table->new('site');
 | 
			
		||||
    my $linuximagetab;
 | 
			
		||||
@@ -522,7 +523,7 @@ sub mknetboot
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        if ($docopy) {
 | 
			
		||||
        if ($docopy && !$noupdateinitrd) {
 | 
			
		||||
            mkpath("$tftppath");
 | 
			
		||||
            if (-f "$rootimgdir/hypervisor") {
 | 
			
		||||
                copy("$rootimgdir/hypervisor", "$tftppath");
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,7 @@ use xCAT::SvrUtils;
 | 
			
		||||
use xCAT::Table;
 | 
			
		||||
#use Data::Dumper;
 | 
			
		||||
use File::Path;
 | 
			
		||||
use File::Copy;
 | 
			
		||||
use Getopt::Long;
 | 
			
		||||
Getopt::Long::Configure("bundling");
 | 
			
		||||
Getopt::Long::Configure("pass_through");
 | 
			
		||||
@@ -169,6 +170,7 @@ sub process_request {
 | 
			
		||||
       $otherpkglist = $ref_linuximage_tab->{'otherpkglist'};
 | 
			
		||||
       $postinstall_filename = $ref_linuximage_tab->{'postinstall'};
 | 
			
		||||
       $destdir = $ref_linuximage_tab->{'rootimgdir'};
 | 
			
		||||
       $rootimg_dir = $ref_linuximage_tab->{'rootimgdir'};
 | 
			
		||||
       $driverupdatesrc = $ref_linuximage_tab->{'driverupdatesrc'};
 | 
			
		||||
       
 | 
			
		||||
       # TODO: how can we do if the user specifies one wrong value to the following attributes?
 | 
			
		||||
@@ -363,6 +365,31 @@ sub process_request {
 | 
			
		||||
       #   print FILE "\n";
 | 
			
		||||
       #}
 | 
			
		||||
       #close FILE; 
 | 
			
		||||
 | 
			
		||||
       # update the generated initrd to /tftpboot/xcat so that don't need to rerun nodeset to update them
 | 
			
		||||
       if (($::RUNCMD_RC == 0) && $imagename) {
 | 
			
		||||
           my $tftpdir  = "/tftpboot";
 | 
			
		||||
           my @siteents = xCAT::TableUtils->get_site_attribute("tftpdir");
 | 
			
		||||
           if ($#siteents >= 0)
 | 
			
		||||
           {
 | 
			
		||||
               $tftpdir = $siteents[0];
 | 
			
		||||
           }
 | 
			
		||||
           my $tftppath = "$tftpdir/xcat/osimage/$imagename";
 | 
			
		||||
 | 
			
		||||
           my $installdir = "/install";
 | 
			
		||||
           @siteents = xCAT::TableUtils->get_site_attribute("installdir");
 | 
			
		||||
           if ($#siteents >= 0)
 | 
			
		||||
           {
 | 
			
		||||
               $installdir = $siteents[0];
 | 
			
		||||
           }
 | 
			
		||||
 | 
			
		||||
           unless (-d $tftppath) {
 | 
			
		||||
               mkpath $tftppath;
 | 
			
		||||
           }
 | 
			
		||||
           copy("$rootimg_dir/initrd-stateless.gz", "$tftppath");
 | 
			
		||||
           copy("$rootimg_dir/initrd-statelite.gz", "$tftppath");
 | 
			
		||||
           copy("$rootimg_dir/kernel", "$tftppath");
 | 
			
		||||
       }
 | 
			
		||||
       
 | 
			
		||||
       #parse the output and save the image data to osimage and linuximage table
 | 
			
		||||
       save_image_data($callback, $doreq, $tempfile);
 | 
			
		||||
 
 | 
			
		||||
@@ -56,6 +56,7 @@ sub mknetboot
 | 
			
		||||
    my $globaltftpdir  = "/tftpboot";
 | 
			
		||||
    my $nodes    = @{$req->{node}};
 | 
			
		||||
    my @nodes    = @{$req->{node}};
 | 
			
		||||
    my $noupdateinitrd = $req->{'noupdateinitrd'};
 | 
			
		||||
    my $ostab    = xCAT::Table->new('nodetype');
 | 
			
		||||
    #my $sitetab  = xCAT::Table->new('site');
 | 
			
		||||
    my $linuximagetab;
 | 
			
		||||
@@ -405,7 +406,7 @@ sub mknetboot
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($docopy) {
 | 
			
		||||
        if ($docopy && !$noupdateinitrd) {
 | 
			
		||||
            mkpath("$tftppath");
 | 
			
		||||
            copy("$rootimgdir/kernel", "$tftppath");
 | 
			
		||||
            if ($statelite) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user