add rootimgdir attr for sysclone osimage definition
This commit is contained in:
parent
97538d1494
commit
e252efee1e
@ -1989,12 +1989,41 @@ sub mksysclone
|
||||
}
|
||||
|
||||
my $cmd =qq{echo "$node:compute:$imagename:" >> $clusterfile};
|
||||
my $out = xCAT::Utils->runcmd($cmd, -1);
|
||||
my $rc = xCAT::Utils->runcmd($cmd, -1);
|
||||
|
||||
my $imagedir;
|
||||
my $osimagetab = xCAT::Table->new('linuximage');
|
||||
my $osimageentry = $osimagetab->getAttribs({imagename => $imagename}, 'rootimgdir');
|
||||
if($osimageentry){
|
||||
$imagedir = $osimageentry->{rootimgdir};
|
||||
$imagedir =~ s/^(\/.*)\/.+\/?$/$1/;
|
||||
}else{
|
||||
$imagedir = "$installroot/sysclone/images";
|
||||
$cmd = "chdef -t osimage $imagename rootimgdir=$imagedir/$imagename";
|
||||
$rc = `$cmd`;
|
||||
}
|
||||
|
||||
my $cfgimagedir = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`;
|
||||
chomp($cfgimagedir);
|
||||
$cfgimagedir =~ s/^\s+path=(\/.*)\/.+$/$1/g;
|
||||
|
||||
if($imagedir ne $cfgimagedir){
|
||||
my $oldstr = `cat /etc/systemimager/rsync_stubs/40$imagename|grep path`;
|
||||
chomp($oldstr);
|
||||
$oldstr =~ s/\//\\\\\//g;
|
||||
|
||||
unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost")
|
||||
my $targetstr="\tpath=".$imagedir."/".$imagename;
|
||||
$targetstr =~ s/\//\\\\\//g;
|
||||
$cmd= "sed -i \"s/$oldstr/$targetstr/\" /etc/systemimager/rsync_stubs/40$imagename";
|
||||
$rc = `$cmd`;
|
||||
}
|
||||
|
||||
$rc = `export PERL5LIB=/usr/lib/perl5/site_perl/;LANG=C si_mkrsyncd_conf`;
|
||||
|
||||
unless (-r "$imagedir/$imagename/opt/xcat/xcatdsklspost")
|
||||
{
|
||||
mkpath("$installroot/sysclone/images/$imagename/opt/xcat/");
|
||||
copy("$installroot/postscripts/xcatdsklspost","$installroot/sysclone/images/$imagename/opt/xcat/");
|
||||
mkpath("$imagedir/$imagename/opt/xcat/");
|
||||
copy("$installroot/postscripts/xcatdsklspost","$imagedir/$imagename/opt/xcat/");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user