fix defect #3813 imgexport 2.7 will not imgimport 2.8

This commit is contained in:
immarvin 2013-10-31 01:42:57 -07:00
parent b5589691a9
commit 6f1ff7a924

View File

@ -1061,6 +1061,9 @@ sub extract_bundle {
}
#print Dumper($data);
#push @{$datas}, $data;
#support imgimport osimage exported by xCAT 2.7
manifest_adapter($data);
# now we need to import the files...
unless(verify_manifest($data, $callback)){
@ -1362,6 +1365,36 @@ sub set_config {
return 1;
}
#an adapter to convert the manifest structure from 2.7 to 2.8
sub manifest_adapter {
my $data = shift;
if(exists($data->{osimage}) or exists($data->{linuximage})){
return 0;
}
my %colstodel;
foreach my $col (@{$xCAT::Schema::tabspec{osimage}->{cols}}){
if(defined($data->{$col})){
$colstodel{$col}=1;
$data->{osimage}->{$col}=$data->{$col};
}
}
foreach my $col (@{$xCAT::Schema::tabspec{linuximage}->{cols}}){
if(defined($data->{$col})){
$colstodel{$col}=1;
$data->{linuximage}->{$col}=$data->{$col};
}
}
foreach my $col(keys %colstodel){
delete($data->{$col});
}
return 1;
}
sub verify_manifest {
my $data = shift;