diff --git a/xCAT-server/lib/xcat/plugins/imgport.pm b/xCAT-server/lib/xcat/plugins/imgport.pm index 9e3e2af9a..02aa08acf 100644 --- a/xCAT-server/lib/xcat/plugins/imgport.pm +++ b/xCAT-server/lib/xcat/plugins/imgport.pm @@ -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;