image import and export work. 5: added support to copy image to another on the same mn with a different profile
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7405 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
c1297e527a
commit
0df1f553e4
@ -702,6 +702,11 @@ sub extract_bundle {
|
||||
$error++;
|
||||
next;
|
||||
}
|
||||
|
||||
#change profile name if needed
|
||||
if ($new_profile) {
|
||||
$data=change_profile($data, $callback, $new_profile, $imgdir);
|
||||
}
|
||||
|
||||
#import manifest.xml into xCAT database
|
||||
unless(set_config($data, $callback)){
|
||||
@ -740,6 +745,55 @@ sub extract_bundle {
|
||||
|
||||
}
|
||||
|
||||
sub change_profile {
|
||||
my $data = shift;
|
||||
my $callback = shift;
|
||||
my $new_profile=shift;
|
||||
my $srcdir=shift;
|
||||
|
||||
$data->{profile}=$new_profile;
|
||||
my $installdir = xCAT::Utils->getInstallDir();
|
||||
unless($installdir){
|
||||
$installdir = '/install';
|
||||
}
|
||||
if ($data->{rootimgdir}) {
|
||||
$data->{rootimgdir}="$installdir/netboot/" . $data->{osvers} . "/" . $data->{osarch} . "/$new_profile";
|
||||
|
||||
for my $a ("kernel", "ramdisk", "rootimg") {
|
||||
if ($data->{$a}) {
|
||||
my $fn=basename($data->{$a});
|
||||
$data->{$a}=$data->{rootimgdir} . "/$fn";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $prov="netboot";
|
||||
if ($data->{provmethod} eq "install") { $prov = "install"; }
|
||||
my $platform;
|
||||
my $os=$data->{osvers};
|
||||
if ($os) {
|
||||
if ($os =~ /rh.*/) { $platform = "rh"; }
|
||||
elsif ($os =~ /centos.*/) { $platform = "centos"; }
|
||||
elsif ($os =~ /fedora.*/) { $platform = "fedora"; }
|
||||
elsif ($os =~ /sles.*/) { $platform = "sles"; }
|
||||
elsif ($os =~ /SL.*/) { $platform = "SL"; }
|
||||
elsif ($os =~ /win/) {$platform = "windows"; }
|
||||
}
|
||||
|
||||
|
||||
for my $a ("template", "pkglist", "synclists", "otherpkglist", "postinstall", "exlist") {
|
||||
if ($data->{$a}) {
|
||||
my $fn=basename($data->{$a});
|
||||
my $oldfn=$fn;
|
||||
$fn =~ s/^([^\.]+)\.(.*)$/$new_profile.$2/;
|
||||
move("$srcdir/$oldfn", "$srcdir/$fn");
|
||||
$data->{$a}= "$installdir/custom/$prov/$platform/$fn";
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
# return 1 for true 0 for false.
|
||||
# need to make sure media is copied before importing image.
|
||||
sub check_media {
|
||||
|
Loading…
Reference in New Issue
Block a user