diff --git a/xCAT-client/pods/man8/copycds.8.pod b/xCAT-client/pods/man8/copycds.8.pod index aabc2561f..265f1a288 100644 --- a/xCAT-client/pods/man8/copycds.8.pod +++ b/xCAT-client/pods/man8/copycds.8.pod @@ -4,7 +4,7 @@ B - Copies Linux distributions and service levels from DVDs/ISOs to the =head1 SYNOPSIS -B [{B<-n|--name|--osver>}=I] [{B<-a|--arch>}=I] [{B<-p|--path>}=I] {I|I} ... +B [{B<-n|--name|--osver>}=I] [{B<-a|--arch>}=I] [{B<-p|--path>}=I] [B<-o>|B<--noosimage>] {I|I} ... B [B<-i>|B<--inspection>] {I|I} @@ -37,6 +37,10 @@ The destination directory to which the contents of ISO/DVD will be copied. When Check whether xCAT can recognize the DVDs/ISOs in the argument list, but do not copy the disc. Displays the os distribution name, architecture and disc no of each recognized DVD/ISO. This option only supported for distributions of sles,redhat and windows. +=item {B<-o|--noosimage>} + +Do not create the default osimages based on the osdistro copied in. By default, copycds will create a set of osimages based on the osdistro. + =back =head1 RETURN VALUE diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index 1790bda27..2890def8e 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -1334,6 +1334,7 @@ sub copycd my $path; my $mntpath=undef; my $inspection=undef; + my $noosimage=undef; @ARGV = @{$request->{arg}}; GetOptions( @@ -1341,7 +1342,8 @@ sub copycd 'a=s' => \$arch, 'p=s' => \$path, 'm=s' => \$mntpath, - 'i' => \$inspection + 'i' => \$inspection, + 'o' => \$noosimage, ); unless ($mntpath) { @@ -1582,23 +1584,24 @@ sub copycd if ($ret[0] != 0) { $callback->({data => "Error when updating the osdistro tables: " . $ret[1]}); } + + unless($noosimage){ + my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path,$osdistroname); + if ($ret[0] != 0) { + $callback->({data => "Error when updating the osimage tables: " . $ret[1]}); + } -# my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path,$osdistroname); - my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path); - if ($ret[0] != 0) { - $callback->({data => "Error when updating the osimage tables: " . $ret[1]}); + #hiding the messages about this not being found, since it may be intentional + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot",$path,$osdistroname); + #if ($ret[0] != 0) { + #$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]}); + #} + + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path,$osdistroname); + #if ($ret[0] != 0) { + #$callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]}); + #} } - #hiding the messages about this not being found, since it may be intentional -# my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot",$path,$osdistroname); - my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot",$path); - #if ($ret[0] != 0) { - #$callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]}); - #} -# my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path,$osdistroname); - my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path); - #if ($ret[0] != 0) { - #$callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]}); - #} } } diff --git a/xCAT-server/lib/xcat/plugins/copycds.pm b/xCAT-server/lib/xcat/plugins/copycds.pm index 9db9fab82..25e691987 100644 --- a/xCAT-server/lib/xcat/plugins/copycds.pm +++ b/xCAT-server/lib/xcat/plugins/copycds.pm @@ -40,7 +40,8 @@ sub process_request { my $arch = undef; my $help = undef; my $inspection=undef; - my $path=undef; + my $path=undef; + my $noosimage=undef; $identified=0; $::CDMOUNTPATH="/mnt/xcat"; @@ -54,10 +55,11 @@ sub process_request { 'a|arch=s' => \$arch, 'h|help' => \$help, 'i|inspection' => \$inspection, - 'p|path=s' => \$path + 'p|path=s' => \$path, + 'o|noosimage' => \$noosimage, ); if ($help) { - $callback->({info=>"copycds [{-p|--path}=path] [{-n|--name|--osver}=distroname] [{-a|--arch}=architecture] [-i|--inspection] 1st.iso [2nd.iso ...]."}); + $callback->({info=>"copycds [{-p|--path}=path] [{-n|--name|--osver}=distroname] [{-a|--arch}=architecture] [-i|--inspection] [{-o|--noosimage}] 1st.iso [2nd.iso ...]."}); return; } if ($arch and $arch =~ /i.86/) { @@ -146,10 +148,16 @@ sub process_request { push @{$newreq->{arg}},("-a",$arch); } } + if (! -l $file) { push @{$newreq->{arg}},("-f",$file); } + + if ($noosimage) { + push @{$newreq->{arg}},("-o"); + } + $doreq->($newreq,\&take_answer); #$::CDMOUNTPATH=""; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index 31367c0b0..9141e8fee 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -1037,6 +1037,7 @@ sub copycd my $path; my $mntpath=undef; my $inspection=undef; + my $noosimage=undef; $installroot = "/install"; @@ -1058,7 +1059,8 @@ sub copycd 'a=s' => \$arch, 'm=s' => \$mntpath, 'i' => \$inspection, - 'p=s' => \$path + 'p=s' => \$path, + 'o' => \$noosimage, ); unless ($mntpath) { @@ -1342,23 +1344,24 @@ sub copycd my @ret=xCAT::SvrUtils->update_osdistro_table($distname,$arch,$path,$osdistroname); if ($ret[0] != 0) { $callback->({data => "Error when updating the osdistro tables: " . $ret[1]}); - } + } + + unless($noosimage){ + my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path,$osdistroname); + if ($ret[0] != 0) { + $callback->({data => "Error when updating the osimage tables: " . $ret[1]}); + } + + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot",$path,$osdistroname); + if ($ret[0] != 0) { + $callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]}); + } -# my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path,$osdistroname); - my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path); - if ($ret[0] != 0) { - $callback->({data => "Error when updating the osimage tables: " . $ret[1]}); + my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path,$osdistroname); + if ($ret[0] != 0) { + $callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]}); + } } -# my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot",$path,$osdistroname); - my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "netboot",$path); - if ($ret[0] != 0) { - $callback->({data => "Error when updating the osimage tables for stateless: " . $ret[1]}); - } -# my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path,$osdistroname); - my @ret=xCAT::SvrUtils->update_tables_with_diskless_image($distname, $arch, undef, "statelite",$path); - if ($ret[0] != 0) { - $callback->({data => "Error when updating the osimage tables for statelite: " . $ret[1]}); - } } } diff --git a/xCAT-server/lib/xcat/plugins/windows.pm b/xCAT-server/lib/xcat/plugins/windows.pm index dc0186a95..f5c70c2fc 100644 --- a/xCAT-server/lib/xcat/plugins/windows.pm +++ b/xCAT-server/lib/xcat/plugins/windows.pm @@ -475,6 +475,7 @@ sub copycd my $path; my $mntpath=undef; my $inspection=undef; + my $noosimage=undef; my $installroot; $installroot = "/install"; @@ -496,7 +497,8 @@ sub copycd 'a=s' => \$arch, 'p=s' => \$path, 'm=s' => \$mntpath, - 'i' => \$inspection + 'i' => \$inspection, + 'o' => \$noosimage, ); unless ($mntpath) { @@ -662,10 +664,12 @@ sub copycd if ($ret[0] != 0) { $callback->({data => "Error when updating the osdistro tables: " . $ret[1]}); } - - my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path); - if ($ret[0] != 0) { - $callback->({data => "Error when updating the osimage tables: " . $ret[1]}); + + unless($noosimage){ + my @ret=xCAT::SvrUtils->update_tables_with_templates($distname, $arch,$path,$osdistroname); + if ($ret[0] != 0) { + $callback->({data => "Error when updating the osimage tables: " . $ret[1]}); + } } } }