Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8

This commit is contained in:
Bruce Potter 2013-11-19 07:19:31 -05:00
commit 9b4d72de32
13 changed files with 256 additions and 44 deletions

View File

@ -618,7 +618,7 @@ sub getDBtable
{
# need to get info from DB
my $thistable = xCAT::Table->new($table, -create => 1, -autocommit => 0);
my $thistable = xCAT::Table->new($table, -create => 1);
if (!$thistable)
{
return undef;

View File

@ -42,6 +42,7 @@ my $mode;
my $interactive;
my $onlyinitrd;
my $dryrun;
my $ignorekernelchk;
#-----------------------------------------------------------------------------
=head3 print_usage - usage message
@ -88,6 +89,7 @@ if (!GetOptions(
'interactive' => \$interactive,
'onlyinitrd' => \$onlyinitrd,
'dryrun' => \$dryrun,
'ignorekernelchk' => \$ignorekernelchk,
'h|help' => \$help,
'v|version' => \$version,
)) {
@ -404,6 +406,10 @@ if ($dryrun) {
push @arg, "--dryrun";
}
if ($ignorekernelchk) {
push @arg, "--ignorekernelchk";
}
my $cmdref;
push (@{$cmdref->{arg}}, @arg);
$cmdref->{command}->[0] = "genimage";

View File

@ -8,7 +8,7 @@ B<genimage>
B<genimage> B<-o> I<osver> [B<-a> I<arch>] B<-p> I<profile> B<-i> I<nodebootif> B<-n> I<nodenetdrivers> [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>]
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] I<imagename>
B<genimage> [B<-o> I<osver>] [B<-a> I<arch>] [B<-p> I<profile>] [B<-i> I<nodebootif>] [B<-n> I<nodenetdrivers>] [B<--onlyinitrd>] [B<-r> I<otherifaces>] [B<-k> I<kernelver>] [B<-g> I<krpmver>] [B<-m> I<statelite>] [B<-l> I<rootlimitsize>] [B<--permission> I<permission>] [B<--interactive>] [B<--dryrun>] [B<--ignorekernelchk>] I<imagename>
B<genimage> [B<-h> | B<--help> | B<-v> | B<--version>]
@ -151,6 +151,9 @@ This flag shows the underlying call to the os specific genimage function. The us
(Deprecated) This flag allows the user to setup the /tmp and the /var/tmp file system sizes. This flag is no longer supported. You can overwrite any file system size using the .postinstall script where you can create a new /etc/fstab file.
=item B<--ignorekernelchk>
Skip the kernel version checking when injecting drivers from osimage.driverupdatesrc. That means all drivers from osimage.driverupdatesrc will be injected to initrd for the specific target kernel.
=item B<-v|--version>

View File

@ -4,7 +4,7 @@ B<genimage> - Generate an initrd (initial ramfs) which to be used for statefull
=head1 SYNOPSIS
B<geninitrd> <imagename>
B<geninitrd> I<imagename> [B<--ignorekernelchk>]
B<geninitrd> [B<-h> | B<--help>]
@ -66,6 +66,13 @@ B<driverupdatesrc> - comma separated driver rpm packages (full path should be sp
I<imagename> specifies the name of an os image definition to be used. The specification for the image is storted in the I<osimage> table and I<linuximage> table.
=over 12
=item B<--ignorekernelchk>
Skip the kernel version checking when injecting drivers from osimage.driverupdatesrc. That means all drivers from osimage.driverupdatesrc will be injected to initrd for the specific target kernel.
=back
=head1 RETURN VALUE

View File

@ -6,7 +6,7 @@ B<nodeset> - set the boot state for a noderange
B<nodeset> [I<noderange>] [I<boot>|I<install>|I<stat>|I<iscsiboot>|I<netboot>|I<statelite>|I<offline>|I<runcmd=bmcsetup>|I<osimage[=<imagename>>]]
B<nodeset> I<noderange> [I<osimage=<imagename>> I<--noupdateinitrd>]
B<nodeset> I<noderange> I<osimage=<imagename>> [I<--noupdateinitrd>] [I<--ignorekernelchk>]
B<nodeset> [I<-h>|I<--help>|I<-v>|I<--version>]
@ -74,6 +74,10 @@ Prepare server for installing a node using the specified os image. The os image
Skip the rebuilding of initrd when the 'netdrivers', 'drvierupdatesrc' or 'osupdatename' were set for injecting new drviers to initrd. But, the geninitrd command
should be run to rebuild the initrd for new drivers injecting. This is used to improve the performance of nodeset command.
=item B<--ignorekernelchk>
Skip the kernel version checking when injecting drivers from osimage.driverupdatesrc. That means all drivers from osimage.driverupdatesrc will be injected to initrd for the specific target kernel.
=item B<runimage>=<task>>
If you would like to run a task after deployment, you can define that task with this attribute.

View File

@ -175,6 +175,7 @@ sub mknetboot
my @args = @{$req->{arg}} if(exists($req->{arg}));
my @nodes = @{$req->{node}};
my $noupdateinitrd = $req->{'noupdateinitrd'};
my $ignorekernelchk = $req->{'ignorekernelchk'};
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
@ -941,6 +942,7 @@ sub mkinstall
my $doreq = shift;
my @nodes = @{$request->{node}};
my $noupdateinitrd = $request->{'noupdateinitrd'};
my $ignorekernelchk = $request->{'ignorekernelchk'};
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
my $osimagetab;
@ -1353,7 +1355,7 @@ sub mkinstall
unless ($noupdateinitrd) {
copy($kernpath,"$tftppath");
copy($initrdpath,"$tftppath/initrd.img");
&insert_dd($callback, $os, $arch, "$tftppath/initrd.img", "$tftppath/vmlinuz", $driverupdatesrc, $netdrivers, $osupdir);
&insert_dd($callback, $os, $arch, "$tftppath/initrd.img", "$tftppath/vmlinuz", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
}
}
}
@ -2429,6 +2431,7 @@ sub insert_dd {
my $driverupdatesrc = shift;
my $drivers = shift;
my $osupdirlist = shift;
my $ignorekernelchk = shift;
my $install_dir = xCAT::TableUtils->getInstallDir();
@ -2439,6 +2442,7 @@ sub insert_dd {
my @dd_list;
my @rpm_list;
my @vendor_rpm; # the rpms from driverupdatesrc attribute
my @driver_list;
my $Injectalldriver;
my $updatealldriver;
@ -2468,8 +2472,10 @@ sub insert_dd {
push @dd_list, $1;
} elsif ($src =~ /rpm:(.*)/i) {
push @rpm_list, $1;
push @vendor_rpm, $1;
} else {
push @rpm_list, $src;
push @vendor_rpm, $src;
}
}
}
@ -2498,6 +2504,7 @@ sub insert_dd {
chomp(@dd_list);
chomp(@rpm_list);
chomp(@vendor_rpm);
unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
return ();
@ -2606,24 +2613,48 @@ sub insert_dd {
}
}
}
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
# Change it back to xxx.ko here
$driver_name = "\*ko.new";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/*>);
foreach my $file (@all_real_path) {
my $newname = $file;
$newname =~ s/\.new$//;
$cmd = "/bin/mv -f $file $newname";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
}
# Extract files from vendor rpm when $ignorekernelchk is specified
if ($ignorekernelchk) {
mkpath "$dd_dir/vendor_rpm";
foreach my $rpm (@vendor_rpm) {
if (-r $rpm) {
$cmd = "cd $dd_dir/vendor_rpm; rpm2cpio $rpm | cpio -idum";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not extract files from the rpm $rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
} else {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $file.";
push @{$rsp->{data}}, "Handle the driver update failed. Could not read the rpm $rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
# Change it back to xxx.ko here
$driver_name = "\*ko.new";
@all_real_path = ();
my @rpmfiles = <$dd_dir/rpm/*>;
if ($ignorekernelchk) {
push @rpmfiles, <$dd_dir/vendor_rpm/*>;
}
find(\&get_all_path, @rpmfiles);
foreach my $file (@all_real_path) {
my $newname = $file;
$newname =~ s/\.new$//;
$cmd = "/bin/mv -f $file $newname";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $file.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
# The rh6 has different initrd format with old version (rh 5.x)
@ -2684,9 +2715,27 @@ sub insert_dd {
}
foreach my $kernelver (@kernelvers) {
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
if (@driver_list) {
foreach my $driver (@driver_list) {
$driver =~ s/\.gz$//;
@ -2903,9 +2952,27 @@ sub insert_dd {
}
foreach my $kernelver (@kernelvers) {
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
# create path for the new kernel in the modules package
unless (-d "$dd_dir/modules/$kernelver") {
mkpath ("$dd_dir/modules/$kernelver/$arch/");
@ -3156,7 +3223,7 @@ sub insert_dd {
if (@rpm_drivers) {
push @{$rsp->{data}}, "The drivers:".join(',', sort(@rpm_drivers))." from ".join(',', sort(@rpm_list))." have been injected to initrd.";
} elsif ($Injectalldriver) {
push @{$rsp->{data}}, "All the drivers from :".join(',', sort(@rpm_list))." have been injected to initrd.";
push @{$rsp->{data}}, "All the drivers from: ".join(',', sort(@rpm_list))." have been injected to initrd.";
} else {
push @{$rsp->{data}}, "No driver was injected to initrd.";
}

View File

@ -93,7 +93,9 @@ sub setdestiny {
@ARGV = @{$req->{arg}};
my $noupdateinitrd;
GetOptions('noupdateinitrd' => \$noupdateinitrd,);
my $ignorekernelchk;
GetOptions('noupdateinitrd' => \$noupdateinitrd,
'ignorekernelchk' => \$ignorekernelchk,);
my $state = $ARGV[0];
my $reststates;
@ -304,7 +306,8 @@ sub setdestiny {
$errored=0;
$subreq->({command=>["mk$tempstate"],
node=>$samestatenodes,
noupdateinitrd=>$noupdateinitrd}, \&relay_response);
noupdateinitrd=>$noupdateinitrd,
ignorekernelchk=>$ignorekernelchk,}, \&relay_response);
if ($errored) {
$callback->({error=>"Some nodes failed to set up $state resources, aborting"});
return;

View File

@ -69,6 +69,7 @@ sub process_request {
my $onlyinitrd;
my $tempfile;
my $dryrun;
my $ignorekernelchk;
GetOptions(
'a=s' => \$arch,
@ -88,6 +89,7 @@ sub process_request {
'onlyinitrd' => \$onlyinitrd,
'tempfile=s' => \$tempfile,
'dryrun' => \$dryrun,
'ignorekernelchk' => \$ignorekernelchk,
);
my $osimagetab;
@ -298,6 +300,7 @@ sub process_request {
if (!$dryrun) { $cmd .= " --tempfile $tempfile"; }
}
if ($driverupdatesrc) { $cmd .= " --driverupdatesrc $driverupdatesrc"; }
if ($ignorekernelchk) { $cmd .= " --ignorekernelchk $ignorekernelchk"; }
if($osfamily eq "sles") {
my @entries = xCAT::TableUtils->get_site_attribute("timezone");

View File

@ -28,15 +28,20 @@ sub preprocess_request
my $usage = sub {
my $callback = shift;
xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd <imagename> [-h | --help]"]}, $callback);
xCAT::MsgUtils->message("I", {data=>["Usage: geninitrd <imagename> [--ignorekernelchk] [-h | --help]"]}, $callback);
};
my $osimage;
my $ignorekernelchk;
if (defined ($req->{arg})) {
foreach (@{$req->{arg}}) {
if (/^-/) {
$usage->($callback);
return;
if (/--ignorekernelchk/) {
$ignorekernelchk = 1;
} else {
$usage->($callback);
return;
}
}else {
$osimage = $_;
}
@ -51,11 +56,13 @@ sub preprocess_request
return;
}
$req->{'ignorekernelchk'} = [$ignorekernelchk];
#if tftpshared is not set, dispatch this command to all the service nodes
my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp");
my $t_entry = $entries[0];
if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) {
$req->{'_disparatetftp'}=[1];
$req->{'_disparatetftp'} = [1];
return xCAT::Scope->get_broadcast_scope($req,@_);
}
return [$req];
@ -81,6 +88,10 @@ sub geninitrd {
my $doreq = shift;
my $osimage = $req->{arg}->[0];
my $ignorekernelchk;
if (defined ($req->{'ignorekernelchk'}) && $req->{'ignorekernelchk'}->[0]) {
$ignorekernelchk = $req->{'ignorekernelchk'}->[0];
}
my ($osvers, $arch, $pkgdir, $driverupdatesrc, $netdrivers, $osdisupdir);
@ -218,10 +229,10 @@ sub geninitrd {
# 2. Inject the drivers to initrd in /tftpboot base on the new kernel ver
if ($osvers =~ /(^ol[0-9].*)|(centos.*)|(rh.*)|(fedora.*)|(SL.*)/) {
require xCAT_plugin::anaconda;
xCAT_plugin::anaconda->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir);
xCAT_plugin::anaconda->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir, $ignorekernelchk);
} elsif ($osvers =~ /(sles.*)|(suse.*)/) {
require xCAT_plugin::sles;
xCAT_plugin::sles->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir);
xCAT_plugin::sles->insert_dd($callback, $osvers, $arch, $initrdpath, $kernelpath, $driverupdatesrc, $netdrivers, $osdisupdir, $ignorekernelchk);
}
}

View File

@ -58,6 +58,7 @@ sub mknetboot
my $nodes = @{$req->{node}};
my @nodes = @{$req->{node}};
my $noupdateinitrd = $req->{'noupdateinitrd'};
my $ignorekernelchk = $req->{'ignorekernelchk'};
my $ostab = xCAT::Table->new('nodetype');
#my $sitetab = xCAT::Table->new('site');
my $linuximagetab;
@ -711,6 +712,7 @@ sub mkinstall
my $globaltftpdir = xCAT::TableUtils->getTftpDir();
my $noupdateinitrd = $request->{'noupdateinitrd'};
my $ignorekernelchk = $request->{'ignorekernelchk'};
my @nodes = @{$request->{node}};
my $node;
my $ostab = xCAT::Table->new('nodetype');
@ -1039,20 +1041,20 @@ sub mkinstall
unless ($noupdateinitrd) {
copy("$pkgdir/1/boot/$arch/loader/linux", "$tftppath");
copy("$pkgdir/1/boot/$arch/loader/initrd", "$tftppath");
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir);
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
}
} elsif ($arch =~ /x86/) {
unless ($noupdateinitrd) {
copy("$pkgdir/1/boot/i386/loader/linux", "$tftppath");
copy("$pkgdir/1/boot/i386/loader/initrd", "$tftppath");
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir);
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/initrd", "$tftppath/linux", $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
}
}
elsif ($arch =~ /ppc/)
{
unless ($noupdateinitrd) {
copy("$pkgdir/1/suseboot/inst64", "$tftppath");
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/inst64", undef, $driverupdatesrc, $netdrivers, $osupdir);
@dd_drivers = &insert_dd($callback, $os, $arch, "$tftppath/inst64", undef, $driverupdatesrc, $netdrivers, $osupdir, $ignorekernelchk);
}
}
}
@ -1949,6 +1951,7 @@ sub insert_dd () {
my $driverupdatesrc = shift;
my $drivers = shift;
my $osupdirlist = shift;
my $ignorekernelchk = shift;
my $install_dir = xCAT::TableUtils->getInstallDir();
@ -1956,6 +1959,7 @@ sub insert_dd () {
my @dd_list;
my @rpm_list;
my @vendor_rpm; # the rpms from driverupdatesrc attribute
my @driver_list;
my $Injectalldriver;
my $updatealldriver;
@ -1986,8 +1990,10 @@ sub insert_dd () {
push @dd_list, $1;
} elsif ($src =~ /rpm:(.*)/i) {
push @rpm_list, $1;
push @vendor_rpm, $1;
} else {
push @rpm_list, $src;
push @vendor_rpm, $src;
}
}
}
@ -2016,6 +2022,7 @@ sub insert_dd () {
chomp(@dd_list);
chomp(@rpm_list);
chomp(@vendor_rpm);
unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
return ();
@ -2087,26 +2094,50 @@ sub insert_dd () {
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
}
}
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
# Change it back to xxx.ko here
$driver_name = "\*ko.new";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/*>);
foreach my $file (@all_real_path) {
my $newname = $file;
$newname =~ s/\.new$//;
$cmd = "mv -f $file $newname";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
# Extract files from vendor rpm when $ignorekernelchk is specified
if ($ignorekernelchk) {
mkpath "$dd_dir/vendor_rpm";
foreach my $rpm (@vendor_rpm) {
if (-r $rpm) {
$cmd = "cd $dd_dir/vendor_rpm; rpm2cpio $rpm | cpio -idum";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not extract files from the rpm $rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
} else {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not rename $file.";
push @{$rsp->{data}}, "Handle the driver update failed. Could not read the rpm $rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
# Change it back to xxx.ko here
$driver_name = "\*ko.new";
@all_real_path = ();
my @rpmfiles = <$dd_dir/rpm/*>;
if ($ignorekernelchk) {
push @rpmfiles, <$dd_dir/vendor_rpm/*>;
}
find(\&get_all_path, @rpmfiles);
foreach my $file (@all_real_path) {
my $newname = $file;
$newname =~ s/\.new$//;
$cmd = "mv -f $file $newname";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not rename $file.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
# Copy the firmware to the rootimage
if (-d "$dd_dir/rpm/lib/firmware") {
if (! -d "$dd_dir/initrd_img/lib") {
@ -2166,9 +2197,27 @@ sub insert_dd () {
}
foreach my $kernelver (@kernelvers) {
# if $ignorekernelchk is specified, copy all files from vendor_rpm dir to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/vendor_rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
$cmd = "/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy driver $path from vendor rpm.";
xCAT::MsgUtils->message("I", $rsp, $callback);
}
}
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
if (@driver_list) {
# copy the specific drivers to initrd
foreach my $driver (@driver_list) {
@ -2283,6 +2332,25 @@ sub insert_dd () {
copy ("$dd_dir/initrd.gz", "$img");
}
} elsif ($arch =~ /x86/) {
mkpath("$dd_dir/initrd_img/cus_driverdisk");
# insert the driver update disk into the cus_driverdisk dir
foreach my $dd (@dd_list) {
copy($dd, "$dd_dir/initrd_img/cus_driverdisk");
}
# Repack the initrd
# In order to avoid the runcmd add the '2>&1' at end of the cpio
# cmd, the echo cmd is added at the end
$cmd = "cd $dd_dir/initrd_img; find . -print | cpio -H newc -o > $dd_dir/initrd | echo";
xCAT::Utils->runcmd($cmd, -1);
if ($::RUNCMD_RC != 0) {
my $rsp;
push @{$rsp->{data}}, "Handle the driver update disk failed. Could not pack the hacked initrd.";
xCAT::MsgUtils->message("E", $rsp, $callback);
return ();
}
$cmd = "gzip -f $dd_dir/initrd";
xCAT::Utils->runcmd($cmd, -1);
my $rdhandle;
my $ddhandle;
open($rdhandle,">>",$img);

View File

@ -955,7 +955,7 @@ sub updatenode
my $postscripts = "$installdir/postscripts";
if (-e $postscripts)
{
my $cmd = "chmod -R u+x,a+r $postscripts";
my $cmd = "chmod -R a+r $postscripts";
xCAT::Utils->runcmd($cmd, 0);
my $rsp = {};
if ($::RUNCMD_RC != 0)

View File

@ -63,6 +63,7 @@ my $rootimg_dir;
my $permission; # the permission works only for statelite mode currently
my $tempfile;
my $prompt;
my $ignorekernelchk;
sub xdie {
@ -108,6 +109,7 @@ GetOptions(
'driverupdatesrc=s' => \$driverupdatesrc, #internal flag
'interactive' =>\$prompt,
'onlyinitrd' =>\$onlyinitrd,
'ignorekernelchk' => \$ignorekernelchk,
);
if (@ARGV > 0) {
@ -1925,6 +1927,22 @@ sub load_dd ()
if (-d "$dd_dir/rpm/lib/firmware") {
system ("cp -rf $dd_dir/rpm/lib/firmware $rootimg_dir/lib");
}
# if $ignorekernelchk is specified, copy all driver files to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
if ($path eq "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
system ("/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver");
}
}
# Copy the drivers to the rootimage
if (-d "$dd_dir/rpm/lib/modules/$kernelver") {
if (@driver_list) {
@ -1953,6 +1971,8 @@ sub load_dd ()
}
} elsif ($Injectalldriver) {
# copy all the drviers to the rootimage
$driver_name = "\*\.ko";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
my @all_drivers = @all_real_path;
foreach my $new_driver (@all_drivers) {

View File

@ -60,6 +60,7 @@ my $krpmver;
my $tempfile;
my $prompt;
my $timezone; #the TIMEZONE of the stateless and statelite node
my $ignorekernelchk;
sub xdie {
system("rm -rf /tmp/xcatinitrd.$$");
@ -106,6 +107,7 @@ GetOptions(
'driverupdatesrc=s' => \$driverupdatesrc, #internal flag
'interactive' =>\$prompt,
'onlyinitrd' =>\$onlyinitrd,
'ignorekernelchk' => \$ignorekernelchk,
);
if (@ARGV > 0) {
@ -2003,6 +2005,22 @@ sub load_dd()
if (-d "$dd_dir/rpm/lib/firmware") {
system ("cp -rf $dd_dir/rpm/lib/firmware $rootimg_dir/lib");
}
# if $ignorekernelchk is specified, copy all driver files to target kernel dir
if ($ignorekernelchk) {
my @kernelpath4vrpm = <$dd_dir/rpm/lib/modules/*>;
foreach my $path (@kernelpath4vrpm) {
if ($path eq "$dd_dir/rpm/lib/modules/$kernelver") {
next;
}
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
mkpath "$dd_dir/rpm/lib/modules/$kernelver";
}
system ("/bin/cp -rf $path/* $dd_dir/rpm/lib/modules/$kernelver");
}
}
# Copy the drivers to the rootimage
if (-d "$dd_dir/rpm/lib/modules/$kernelver") {
#mkpath "$rootimg_dir/lib/modules/$kernelver/updates/";
@ -2032,6 +2050,8 @@ sub load_dd()
}
} elsif ($Injectalldriver) {
# copy all the drviers to the rootimage
$driver_name = "\*\.ko";
@all_real_path = ();
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
my @all_drivers = @all_real_path;
foreach my $new_driver (@all_drivers) {