fix defect #3813 imgexport 2.7 will not imgimport 2.8

This commit is contained in:
immarvin 2013-10-31 01:30:57 -07:00
parent 1a48279d68
commit 72a4379087

View File

@ -990,7 +990,10 @@ 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)){
$error++;
@ -1286,6 +1289,35 @@ 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;