add -o|--noosimage option to avoid creating osimages after copycds

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14273 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
immarvin 2012-11-08 07:02:56 +00:00
parent 2311314a80
commit 6842acc9a8
5 changed files with 63 additions and 41 deletions

View File

@ -4,7 +4,7 @@ B<copycds> - Copies Linux distributions and service levels from DVDs/ISOs to the
=head1 SYNOPSIS
B<copycds> [{B<-n|--name|--osver>}=I<distroname>] [{B<-a|--arch>}=I<architecture>] [{B<-p|--path>}=I<ospkgpath>] {I<iso>|I<device-path>} ...
B<copycds> [{B<-n|--name|--osver>}=I<distroname>] [{B<-a|--arch>}=I<architecture>] [{B<-p|--path>}=I<ospkgpath>] [B<-o>|B<--noosimage>] {I<iso>|I<device-path>} ...
B<copycds> [B<-i>|B<--inspection>] {I<iso>|I<device-path>}
@ -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

View File

@ -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]});
#}
}
}

View File

@ -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="";

View File

@ -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]});
}
}
}

View File

@ -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]});
}
}
}
}