2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-25 12:40:21 +00:00

Merge branch '2.8' of ssh://git.code.sf.net/p/xcat/xcat-core into 2.8

This commit is contained in:
Bruce Potter
2013-11-21 07:22:25 -05:00
6 changed files with 83 additions and 23 deletions

View File

@@ -368,7 +368,6 @@ sub set_FPC_network_parms {
command => ["rspconfig"],
node => ["$defnode"],
arg => [ "netmask=$netmask" ],
sequential=>["1"],
},
$request, 0,1);
if ($::RUNCMD_RC != 0) {
@@ -389,7 +388,6 @@ sub set_FPC_network_parms {
command => ["rspconfig"],
node => ["$defnode"],
arg => [ "gateway=$gateway" ],
sequential=>["1"],
},
$request, 0,1);
if ($::RUNCMD_RC != 0) {
@@ -410,7 +408,6 @@ sub set_FPC_network_parms {
command => ["rspconfig"],
node => ["$defnode"],
arg => [ "ip=$newfpcip" ],
sequential=>["1"],
},
$request, 0,1);
if ($::RUNCMD_RC != 0) {

View File

@@ -412,6 +412,8 @@ sub copytar {
# creae the default dirs in the mpss image dir
mkpath ("$destdir/common");
mkpath ("$destdir/overlay/rootimg");
mkpath ("$destdir/overlay/simple");
mkpath ("$destdir/overlay/package");
mkpath ("$destdir/overlay/rpm");
`/bin/touch "$destdir/common.filelist"`;
@@ -477,12 +479,13 @@ sub copytar {
}
my $otherpkgdir = "$installroot/post/otherpkgs/mic$mpssver/x86_64";
my $rootimgdir = "$destdir/overlay";
# set a default package list
my $pkglist = "$::XCATROOT/share/xcat/netboot/mic/compute.pkglist";
$litab->setAttribs({'imagename' => $imagename}, {'pkgdir' => $destdir, 'pkglist' => $pkglist, 'otherpkgdir' => $otherpkgdir});
$litab->setAttribs({'imagename' => $imagename}, {'pkgdir' => $destdir, 'pkglist' => $pkglist, 'otherpkgdir' => $otherpkgdir, 'rootimgdir' => $rootimgdir});
xCAT::MsgUtils->message("I", {data=>["The image $imagename has been created."]}, $callback);
xCAT::MsgUtils->message("I", {data=>["The image $imagename is created."]}, $callback);
#rmtree ($tmpdir);
}
@@ -830,7 +833,7 @@ sub nodeset {
# | `--rpm
# | `--simple
# | |--simple.cfg (the file must be multiple lines of 'a->b' format; 'a' is dir name in simple/, 'b' is the path on mic for 'a'
# | `--package
# | `--package (2.8.3) / rootimg (2.8.4 and later)
# | |--the base file for fs
# | `--opt/mic
# | |--yy.filelist
@@ -839,10 +842,10 @@ sub nodeset {
# | `--xx
#the system dir (system dir includes the files
# which generated by genimage command, and will be copied to mic osimage separated)
if (! -d "$osimage{$osimg}/system") {
xCAT::MsgUtils->message("E", {error=>["Missed system directory in $osimage{$osimg}. Did you miss to run genimage command?"], errorcode=>["1"]}, $callback);
return;
}
if (! -d "$osimage{$osimg}/system") {
xCAT::MsgUtils->message("E", {error=>["Missed system directory in $osimage{$osimg}. Did you miss to run genimage command?"], errorcode=>["1"]}, $callback);
return;
}
if (defined ($imghash{$osimg}{'ollist'})) {
push @cfgfile, "overlay=$imghash{$osimg}{'ollist'}";
} else {
@@ -862,12 +865,13 @@ sub nodeset {
}
}
}
} elsif ($objname eq "package") {
my @pfl = <$osimage{$osimg}/overlay/package/opt/mic/*.filelist>;
} elsif ($objname eq "package" || $objname eq "rootimg") {
my @pfl = <$osimage{$osimg}/overlay/$objname/opt/mic/*.filelist>;
foreach my $filelist (@pfl) {
$filelist = basename($filelist);
if ($filelist =~ /(.+)\.filelist/) {
$ollist .= ",pfilelist:$1";
$ollist .= ",pfilelist:$1" if ($objname eq "package");
$ollist .= ",ofilelist:$1" if ($objname eq "rootimg");
}
}
}

View File

@@ -164,7 +164,7 @@ if ($rc) {
# | `--rpm
# | `--simple
# | |--simple.cfg (the file must be multiple lines of 'a->b' format; 'a' is dir name in simple/, 'b' is the path on mic for 'a'
# | `--package
# | `--package (2.8.3) / rootimg (2.8.4 and later)
# | |--the base file for fs
# | `--opt/mic
# | |--yy.filelist
@@ -225,7 +225,9 @@ my @ols = split (/,/, $overlay);
foreach (@ols) {
if (/^filelist:(.+)/) {
$cmd = "micctrl --overlay=Filelist --source=$micmnt/overlay/$1/ --target=$micmnt/overlay/$1.filelist --state=on $miclist";
} elsif (/^pfilelist:(.+)/) {
} elsif (/^ofilelist:(.+)/) { # for 2.8.4 and later
$cmd = "micctrl --overlay=Filelist --source=$micmnt/overlay/rootimg/ --target=$micmnt/overlay/rootimg/opt/mic/$1.filelist --state=on $miclist";
} elsif (/^pfilelist:(.+)/) { # only for 2.8.3
$cmd = "micctrl --overlay=Filelist --source=$micmnt/overlay/package/ --target=$micmnt/overlay/package/opt/mic/$1.filelist --state=on $miclist";
} elsif (/^rpm:(.+)/) {
$cmd = "micctrl --overlay=RPM --source=$micmnt/overlay/rpm/ --state=on $miclist";

View File

@@ -1384,6 +1384,7 @@ sub plugin_command {
}
$parent_fd = $old_parent_fd;
} else {
my $req_back = undef;
# executing plugins parallel
foreach (keys %handler_hash) {
my $modname = $_;
@@ -1409,6 +1410,11 @@ sub plugin_command {
binmode($pfd,':utf8');
$child = xCAT::Utils->xfork;
} else {
if ($req_back) {
$req = dclone($req_back);
} else {
$req_back = dclone($req);
}
$child = 0;
}
unless (defined $child) {

View File

@@ -34,6 +34,12 @@ my $otherpkglist;
my $rootimg_dir;
my $srcdir_otherpkgs;
my $tempfile;
my $postinstall;
my $rootimgdir;
my $prompt;
my $imagename;
GetOptions(
'a=s' => \$arch,
'p=s' => \$profile,
@@ -42,13 +48,21 @@ GetOptions(
'srcdir=s' => \$srcdir,
'otherpkglist=s' => \$otherpkglist,
'otherpkgdir=s' => \$srcdir_otherpkgs,
'tempfile=s' =>\$tempfile,
'tempfile=s' => \$tempfile,
'postinstall=s' => \$postinstall,
'rootimgdir=s' => \$rootimgdir,
'imagename=s' => \$imagename,
'interactive' =>\$prompt,
);
$rootimg_dir = "$srcdir/overlay/package/";
if ($rootimgdir) {
$rootimg_dir = $rootimgdir."/rootimg"; # for 2.8.4 and later
} else {
$rootimg_dir = "$srcdir/overlay/package"; # for 2.8.3 that rootimgdir was not set by default
}
my @yumdirs;
my $imagename;
if (@ARGV > 0) {
if (!$imagename && @ARGV > 0) {
$imagename=$ARGV[0];
}
unless ($imagename) {
@@ -64,6 +78,13 @@ sub isyumdir {
}
}
# creae default paths
mkpath "$srcdir/common";
mkpath "$srcdir/overlay/rootimg";
mkpath "$srcdir/overlay/simple";
mkpath "$srcdir/overlay/package";
mkpath "$srcdir/overlay/rpm";
if ($otherpkglist) {
# get the distroname
@@ -120,10 +141,9 @@ if ($otherpkglist) {
my $pass;
foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) {
foreach (keys(%{$extra_hash{$pass}})) {
if($_ eq "INCLUDEBAD") {
print "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}});
exit 1;
print "Unable to open the following pkglist files:\n".join("\n",@{$extra_hash{$pass}{INCLUDEBAD}});
exit 1;
}
if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;}
@@ -202,7 +222,18 @@ if ($otherpkglist) {
}
}
# run postinstall scripts
foreach my $post ( split /,/, $postinstall) {
if ( !-x $post) {
print "postinstall script $post is not executable\n";
exit 1;
}
my $rc = system($postinstall, $rootimg_dir, $osver, $arch, $profile);
if($rc) {
print "postinstall script $post failed\n";
exit 1;
}
}
my $fsdir = "$srcdir/";

View File

@@ -101,6 +101,26 @@ ONBOOT=yes
" >/etc/sysconfig/network-scripts/ifcfg-bond0
fi
if [[ $NTYPE != service ]]
then
if echo $MASTER | egrep '^([0-9]+.){3}[0-9]+$'
then
XCATMASTER=`grep "$MASTER " /etc/hosts | grep -v "^#" | awk '{print $2}' | awk -F '.' '{print $1}' | sed 's/-hf.*//g'`
GATEWAY_IP=`ping -c 3 $XCATMASTER-bond0 -I hf0 2>/dev/null | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
elif [ -n "$MASTER" ]
then
XCATMASTER=`echo $MASTER | awk -F-hf '{print $1}'`
GATEWAY_IP=`ping -c 3 $XCATMASTER-bond0 -I hf0 2>/dev/null | grep "data" | sed 's/.* (\([0-9.]*\)).*/\1/' | uniq 2>&1`
fi
if [ -n "$GATEWAY_IP" ]
then
sed -i "/GATEWAY.*/d" /etc/sysconfig/network
echo "GATEWAY=$GATEWAY_IP" >> /etc/sysconfig/network
fi
fi
x=0
while [ $x -le $i ]; do
ip link set dev hf${x} down