Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
This commit is contained in:
commit
0b874a4bd5
@ -43,6 +43,10 @@ printusage()
|
||||
|
||||
# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
|
||||
for i in $*; do
|
||||
echo $i | grep '='
|
||||
if [ $? != 0 ];then
|
||||
continue
|
||||
fi
|
||||
# upper case the variable name
|
||||
varstring=`echo "$i"|cut -d '=' -f 1|tr '[a-z]' '[A-Z]'`=`echo "$i"|cut -d '=' -f 2`
|
||||
export $varstring
|
||||
@ -167,6 +171,7 @@ then
|
||||
short_ver=`cat Version|cut -d. -f 1,2`
|
||||
short_short_ver=`cat Version|cut -d. -f 1`
|
||||
|
||||
package_dir_name=debs$REL
|
||||
#TODO: define the core path and tarball name
|
||||
tarball_name="core-debs-snap.tar.bz2"
|
||||
|
||||
@ -186,8 +191,8 @@ then
|
||||
cur_date=`date +%Y%m%d`
|
||||
pkg_version="${short_ver}-${pkg_type}${cur_date}"
|
||||
|
||||
if [ ! -d ../../debs ];then
|
||||
mkdir -p "../../debs"
|
||||
if [ ! -d ../../$package_dir_name ];then
|
||||
mkdir -p "../../$package_dir_name"
|
||||
fi
|
||||
packages="xCAT-client xCAT-genesis-scripts perl-xCAT xCAT-server xCAT-UI xCAT xCATsn xCAT-test xCAT-OpenStack"
|
||||
|
||||
@ -195,9 +200,9 @@ then
|
||||
do
|
||||
file_low=`echo $file | tr '[A-Z]' '[a-z]'`
|
||||
if grep -q $file $update_log || [ "$BUILDALL" == 1 -o "$file" = "perl-xCAT" ]; then
|
||||
rm -f ../../debs/${file_low}_*.deb
|
||||
rm -f ../../$package_dir_name/${file_low}_*.deb
|
||||
#only for genesis package
|
||||
rm -f ../../debs/${file_low}-amd64_*.deb
|
||||
rm -f ../../$package_dir_name/${file_low}-amd64_*.deb
|
||||
cd $file
|
||||
dch -v $pkg_version -b -c debian/changelog $build_string
|
||||
dpkg-buildpackage -uc -us
|
||||
@ -208,11 +213,11 @@ then
|
||||
cd -
|
||||
find $file -maxdepth 3 -type d -name "${file_low}*" | grep debian | xargs rm -rf
|
||||
find $file -maxdepth 3 -type f -name "files" | grep debian | xargs rm -rf
|
||||
mv ${file_low}* ../../debs/
|
||||
mv ${file_low}* ../../$package_dir_name/
|
||||
fi
|
||||
done
|
||||
|
||||
find ../../debs/* ! -name *.deb | xargs rm -f
|
||||
find ../../$package_dir_name/* ! -name *.deb | xargs rm -f
|
||||
fi
|
||||
|
||||
if [ "$PROMOTE" = 1 ]; then
|
||||
@ -256,7 +261,7 @@ __EOF__
|
||||
|
||||
#import the deb packages into the repo
|
||||
for dist in $dists; do
|
||||
for file in `ls ../debs/*.deb`; do
|
||||
for file in `ls ../$package_dir_name/*.deb`; do
|
||||
reprepro -b ./ includedeb $dist $file;
|
||||
done
|
||||
done
|
||||
|
@ -13,6 +13,7 @@ use xCAT::GlobalDef;
|
||||
use xCAT::Usage;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::FSPUtils;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
#use Data::Dumper;
|
||||
|
||||
##############################################
|
||||
@ -391,6 +392,7 @@ sub format_stanza {
|
||||
#################################
|
||||
# Add each attribute
|
||||
#################################
|
||||
my $mtm = undef;
|
||||
foreach ( @attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@ -401,7 +403,8 @@ sub format_stanza {
|
||||
} elsif ( /^hwtype$/ ) {
|
||||
$d = $globalhwtype{$type};
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
next;
|
||||
#$d = "$type,all";
|
||||
} elsif ( /^mgt$/ ) {
|
||||
$d = $hwtype;
|
||||
} elsif ( /^cons$/ ) {
|
||||
@ -414,7 +417,9 @@ sub format_stanza {
|
||||
} elsif ( /^(mtm|serial)$/ ) {
|
||||
if ( $type eq "lpar" ) {
|
||||
$d = undef;
|
||||
}
|
||||
} elsif (/^mtm$/) {
|
||||
$mtm = $d;
|
||||
}
|
||||
} elsif (/^side$/) {
|
||||
unless ( $type =~ /^fsp|bpa$/ ) {
|
||||
next;
|
||||
@ -422,6 +427,15 @@ sub format_stanza {
|
||||
}
|
||||
$result .= "\t$_=$d\n";
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$result .= "\tgroups=$tmp_groups\n";
|
||||
|
||||
}
|
||||
return( $result );
|
||||
}
|
||||
@ -464,6 +478,7 @@ sub format_xml {
|
||||
#################################
|
||||
# Add each attribute
|
||||
#################################
|
||||
my $mtm = undef;
|
||||
foreach ( @attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@ -472,7 +487,8 @@ sub format_xml {
|
||||
} elsif ( /^hwtype$/ ) {
|
||||
$d = $globalhwtype{$type};
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
next;
|
||||
#$d = "$type,all";
|
||||
} elsif ( /^mgt$/ ) {
|
||||
$d = $hwtype;
|
||||
} elsif ( /^cons$/ ) {
|
||||
@ -484,6 +500,8 @@ sub format_xml {
|
||||
} elsif ( /^(mtm|serial)$/ ) {
|
||||
if ( $type eq "lpar" ) {
|
||||
$d = undef;
|
||||
} elsif (/^mtm$/) {
|
||||
$mtm = $d;
|
||||
}
|
||||
} elsif (/^side$/) {
|
||||
unless ( $type =~ /^fsp|bpa$/ ) {
|
||||
@ -492,6 +510,15 @@ sub format_xml {
|
||||
}
|
||||
$href->{Node}->{$_} = $d;
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$href->{Node}->{groups}=$tmp_groups;
|
||||
|
||||
#print Dumper($href);
|
||||
#################################
|
||||
# XML encoding
|
||||
|
@ -602,28 +602,16 @@ sub noderange {
|
||||
my $op = ",";
|
||||
if ($start =~ m/-$/) { #subtract the parenthetical
|
||||
$op .= "-"
|
||||
} elsif ($start =~ m/@$/) {
|
||||
} elsif ($start =~ m/\@$/) {
|
||||
$op = "@"
|
||||
}
|
||||
$start =~ s/,-$//;
|
||||
$start =~ s/,$//;
|
||||
$start =~ s/@$//;
|
||||
$start =~ s/\@$//;
|
||||
%nodes = map { $_ => 1 } noderange($start,$verify,$exsitenode,%options);
|
||||
my %innernodes = map { $_ => 1 } noderange($middle,$verify,$exsitenode,%options);
|
||||
set_arith(\%nodes,$op,\%innernodes);
|
||||
$op=",";
|
||||
if ($end =~ m/^,-/) {
|
||||
$op = ",-";
|
||||
$end =~ s/^,-//;
|
||||
} elsif ($end =~ m/^@/) {
|
||||
$op = "@";
|
||||
$end =~ s/^@//;
|
||||
} else {
|
||||
$end =~ s/^,//;
|
||||
}
|
||||
my %endnodes = map { $_ => 1 } noderange($end,$verify,$exsitenode,%options);
|
||||
set_arith(\%nodes,$op,\%endnodes);
|
||||
return sort(keys %nodes)
|
||||
$range = $end;
|
||||
}
|
||||
|
||||
my $op = ",";
|
||||
@ -632,14 +620,19 @@ sub noderange {
|
||||
@elems = split(/(@(?![^\(]*?\)))/,$range); # only split on @ when no , are present (inner recursion)
|
||||
}
|
||||
|
||||
while (my $atom = shift @elems) {
|
||||
while (defined(my $atom = shift @elems)) {
|
||||
if ($atom eq '') { next; }
|
||||
if ($atom eq ',') {
|
||||
next;
|
||||
}
|
||||
if ($atom =~ /^-/) { # if this is an exclusion, strip off the minus, but remember it
|
||||
$atom = substr($atom,1);
|
||||
$op = $op."-";
|
||||
} elsif ($atom =~ /^\@/) { # if this is an exclusion, strip off the minus, but remember it
|
||||
$atom = substr($atom,1);
|
||||
$op = "@";
|
||||
}
|
||||
if ($atom eq '') { next; }
|
||||
|
||||
if ($atom =~ /^\^(.*)$/) { # get a list of nodes from a file
|
||||
open(NRF,$1);
|
||||
|
@ -7,6 +7,7 @@ use xCAT::GlobalDef;
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use xCAT::NetworkUtils;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
###########################################
|
||||
# Factory defaults
|
||||
@ -168,6 +169,10 @@ sub add_ppc {
|
||||
# Update nodelist table
|
||||
###########################
|
||||
updategroups( $name, $db{nodelist}, $type );
|
||||
my $tmp_group = xCAT::data::ibmhwtypes::parse_group($model);
|
||||
if (defined($tmp_group)) {
|
||||
updategroups($name, $db{nodelist}, $tmp_group);
|
||||
}
|
||||
if ( $type =~ /^(fsp|bpa)$/ ) {
|
||||
$db{nodelist}->setNodeAttribs( $name, {hidden => '1'});
|
||||
} else {
|
||||
@ -525,6 +530,10 @@ sub update_node_attribs
|
||||
if ( $namediff)
|
||||
{
|
||||
updategroups( $name, $db->{nodelist}, $type );
|
||||
my $tmp_group = xCAT::data::ibmhwtypes::parse_group($model);
|
||||
if (defined($tmp_group)) {
|
||||
updategroups($name, $db->{nodelist}, $tmp_group);
|
||||
}
|
||||
$db->{nodelist}->setNodeAttribs( $name, {status=>$nodelisthash->{status},
|
||||
appstatus=>$nodelisthash->{appstatus},
|
||||
primarysn=>$nodelisthash->{primarysn},
|
||||
|
@ -5,6 +5,8 @@ use strict;
|
||||
use Getopt::Long;
|
||||
use xCAT::PPCcli qw(SUCCESS EXPECT_ERROR RC_ERROR NR_ERROR);
|
||||
use xCAT::Usage;
|
||||
use xCAT::TableUtils;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
|
||||
##########################################
|
||||
@ -59,7 +61,7 @@ sub parse_args {
|
||||
$Getopt::Long::ignorecase = 0;
|
||||
Getopt::Long::Configure( "bundling" );
|
||||
|
||||
if ( !GetOptions( \%opt, qw(V|verbose) )) {
|
||||
if ( !GetOptions( \%opt, qw(V|verbose t) )) {
|
||||
return( usage() );
|
||||
}
|
||||
####################################
|
||||
@ -75,6 +77,9 @@ sub parse_args {
|
||||
if ( !defined( $cmd )) {
|
||||
return(usage( "Invalid command: $ARGV[0]" ));
|
||||
}
|
||||
if (exists($opt{t}) and $cmd ne "model") {
|
||||
return(["Option 't' can only work with 'model'."]);
|
||||
}
|
||||
####################################
|
||||
# Check for an extra argument
|
||||
####################################
|
||||
@ -411,6 +416,12 @@ sub vpd {
|
||||
#############################
|
||||
# Output value
|
||||
#############################
|
||||
if ($_ eq 'model' and exists($request->{opt}->{t})) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_args($data->{$_});
|
||||
if (defined($tmp_pre)) {
|
||||
xCAT::TableUtils->updatenodegroups($name, $tmp_pre);
|
||||
}
|
||||
}
|
||||
my $value = "@{$prefix{$_}}[0]: $data->{$_}";
|
||||
push @result, [$name,$value,$Rc];
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use xCAT::PPCdb;
|
||||
use xCAT::GlobalDef;
|
||||
use xCAT::Usage;
|
||||
use xCAT::NetworkUtils;
|
||||
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
##############################################
|
||||
# Globals
|
||||
@ -545,6 +545,7 @@ sub format_stanza {
|
||||
#################################
|
||||
# Add each attribute
|
||||
#################################
|
||||
my $mtm = undef;
|
||||
foreach ( @attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@ -555,7 +556,8 @@ sub format_stanza {
|
||||
} elsif ( /^hwtype$/ ) {
|
||||
$d = $globalhwtype{$type};
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
next;
|
||||
#$d = "$type,all";
|
||||
} elsif ( /^mgt$/ ) {
|
||||
$d = $hwtype;
|
||||
} elsif ( /^cons$/ ) {
|
||||
@ -568,7 +570,9 @@ sub format_stanza {
|
||||
} elsif ( /^(mtm|serial)$/ ) {
|
||||
if ( $type eq "lpar" ) {
|
||||
$d = undef;
|
||||
}
|
||||
} elsif (/^mtm$/) {
|
||||
$mtm = $d;
|
||||
}
|
||||
} elsif (/^side$/) {
|
||||
unless ( $type =~ /^fsp|bpa$/ ) {
|
||||
next;
|
||||
@ -576,6 +580,14 @@ sub format_stanza {
|
||||
}
|
||||
$result .= "\t$_=$d\n";
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$result .= "\tgroups=$tmp_groups\n";
|
||||
}
|
||||
return( $result );
|
||||
}
|
||||
@ -623,6 +635,7 @@ sub format_xml {
|
||||
#################################
|
||||
# Add each attribute
|
||||
#################################
|
||||
my $mtm = undef;
|
||||
foreach ( @attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@ -631,7 +644,8 @@ sub format_xml {
|
||||
} elsif ( /^hwtype$/ ) {
|
||||
$d = $globalhwtype{$type};
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
next;
|
||||
#$d = "$type,all";
|
||||
} elsif ( /^mgt$/ ) {
|
||||
$d = $hwtype;
|
||||
} elsif ( /^cons$/ ) {
|
||||
@ -643,6 +657,8 @@ sub format_xml {
|
||||
} elsif ( /^(mtm|serial)$/ ) {
|
||||
if ( $type eq "lpar" ) {
|
||||
$d = undef;
|
||||
} elsif (/^mtm$/){
|
||||
$mtm = $d;
|
||||
}
|
||||
} elsif (/^side$/) {
|
||||
unless ( $type =~ /^fsp|bpa$/ ) {
|
||||
@ -651,6 +667,14 @@ sub format_xml {
|
||||
}
|
||||
$href->{Node}->{$_} = $d;
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$href->{Node}->{groups}=$tmp_groups;
|
||||
#################################
|
||||
# XML encoding
|
||||
#################################
|
||||
|
@ -202,9 +202,11 @@ sub parse_and_run_sinv
|
||||
#
|
||||
my @nodelist = ();
|
||||
my @cmdparts = ();
|
||||
my $devicecommand =0;
|
||||
if ($options{'devicetype'}) {
|
||||
# must split different because devices have commands with spaces
|
||||
@cmdparts = split(' ', $cmd,3);
|
||||
$devicecommand =1;
|
||||
} else {
|
||||
@cmdparts = split(' ', $cmd);
|
||||
}
|
||||
@ -503,7 +505,7 @@ sub parse_and_run_sinv
|
||||
);
|
||||
|
||||
# write the results to the tempfile after running through xdshcoll
|
||||
$rc = &storeresults($callback);
|
||||
$rc = &storeresults($callback,$devicecommand);
|
||||
|
||||
}
|
||||
$processflg = "node";
|
||||
@ -534,7 +536,7 @@ sub parse_and_run_sinv
|
||||
|
||||
|
||||
# write the results to the tempfile after running through xdshcoll
|
||||
$rc = &storeresults($callback);
|
||||
$rc = &storeresults($callback,$devicecommand);
|
||||
|
||||
# Build report and write to output file
|
||||
# if file exist and has something in it
|
||||
@ -1451,12 +1453,11 @@ sub rinvoutput
|
||||
sub storeresults
|
||||
{
|
||||
my $callback = shift;
|
||||
|
||||
my $devicecommand= shift;
|
||||
# open file to write results of xdsh or rinv command
|
||||
my $newtempfile = $tempfile;
|
||||
$newtempfile .= "temp";
|
||||
open(FILE, ">$newtempfile");
|
||||
if ($? > 0)
|
||||
unless (open(NEWTMPFILE, ">$newtempfile"))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Could not open $newtempfile\n";
|
||||
@ -1465,9 +1466,9 @@ sub storeresults
|
||||
}
|
||||
foreach my $line (@cmdresult)
|
||||
{
|
||||
print FILE $line;
|
||||
print NEWTMPFILE $line;
|
||||
}
|
||||
close FILE;
|
||||
close NEWTMPFILE;
|
||||
my $outputfile;
|
||||
if ($processflg eq "seednode")
|
||||
{ # cmd to seednode
|
||||
@ -1479,8 +1480,7 @@ sub storeresults
|
||||
}
|
||||
|
||||
# open file to put results of xdshcoll
|
||||
open(FILE, ">$outputfile");
|
||||
if ($? > 0)
|
||||
unless (open(NEWOUTFILE, ">$outputfile"))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Could not open $outputfile\n";
|
||||
@ -1489,8 +1489,7 @@ sub storeresults
|
||||
}
|
||||
my $cmd = " $::XCATROOT/sbin/xdshcoll <$newtempfile |";
|
||||
|
||||
open(XCOLL, "$cmd");
|
||||
if ($? > 0)
|
||||
unless (open(XCOLL, "$cmd"))
|
||||
{
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = "Could not call xdshcoll \n";
|
||||
@ -1503,18 +1502,37 @@ sub storeresults
|
||||
while (<XCOLL>)
|
||||
{
|
||||
$line = $_;
|
||||
print FILE $line
|
||||
print NEWOUTFILE $line
|
||||
|
||||
}
|
||||
|
||||
close(XCOLL);
|
||||
close FILE;
|
||||
close NEWOUTFILE;
|
||||
|
||||
system("/bin/rm $newtempfile");
|
||||
# is device command, we get false errors from the Switch, check for
|
||||
# blank error output lines and remove them. If there is nothing left
|
||||
# then there really were no errors
|
||||
my @newerrresult=();
|
||||
my $processerrors =1;
|
||||
if ($devicecommand==1) {
|
||||
foreach my $line (@errresult)
|
||||
{
|
||||
my @newline = (split(/:/, $line));
|
||||
if ($newline[1] !~ /^\s*$/) { # Not blank, then save it
|
||||
push @newerrresult,$line;
|
||||
}
|
||||
|
||||
}
|
||||
my $arraysize=@newerrresult;
|
||||
if ($arraysize < 1) {
|
||||
$processerrors =0;
|
||||
}
|
||||
}
|
||||
|
||||
# capture errors
|
||||
#
|
||||
if (@errresult)
|
||||
if ((@errresult) && ($processerrors ==1))
|
||||
{ # if errors
|
||||
my $rsp = {};
|
||||
my $i = 0;
|
||||
|
@ -3231,7 +3231,7 @@ push(@{$defspec{group}->{'attrs'}}, @nodeattrs);
|
||||
access_tabentry => 'firmware.file=attr:cfgfile',
|
||||
},
|
||||
{attr_name => 'disable',
|
||||
tabentry => 'auditlog.disable',
|
||||
tabentry => 'firmware.disable',
|
||||
access_tabentry => 'firmware.file=attr:cfgfile',
|
||||
},
|
||||
);
|
||||
|
@ -355,7 +355,7 @@ sub getSNList
|
||||
$servicenodetab->close;
|
||||
foreach my $node (@nodes)
|
||||
{
|
||||
if ($service eq "") # want all the service nodes
|
||||
if (! defined ($service) || ($service eq "")) # want all the service nodes
|
||||
{
|
||||
push @servicenodes, $node->{node};
|
||||
}
|
||||
|
@ -1735,4 +1735,51 @@ sub getimagenames()
|
||||
$nodetab->close;
|
||||
return @imagenames;
|
||||
}
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
=head3 updatenodegroups
|
||||
Update groups attribute for the specified node
|
||||
|
||||
Arguments:
|
||||
node
|
||||
tabhd: the handler of 'nodelist' table,
|
||||
groups: the groups attribute need to be merged.
|
||||
Can be an array or string.
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
Example:
|
||||
xCAT::TableUtils->updatenodegroups($node, $tab, $groups);
|
||||
|
||||
=cut
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
sub updatenodegroups {
|
||||
my ($class, $node, $tabhd, $groups) = @_;
|
||||
if (!$groups) {
|
||||
$groups = $tabhd;
|
||||
$tabhd = xCAT::Table->new('nodelist');
|
||||
unless ($tabhd) {
|
||||
xCAT::MsgUtils->message("E", " Could not read the nodelist table\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
my ($ent) = $tabhd->getNodeAttribs($node, ['groups']);
|
||||
my @list = qw(all);
|
||||
if (defined($ent) and $ent->{groups}) {
|
||||
push @list, split(/,/,$ent->{groups});
|
||||
}
|
||||
if (ref($groups) eq 'ARRAY') {
|
||||
push @list, @$groups;
|
||||
} else {
|
||||
push @list, split(/,/,$groups);
|
||||
}
|
||||
my %saw;
|
||||
@saw{@list} = ();
|
||||
@list = keys %saw;
|
||||
$tabhd->setNodeAttribs($node, {groups=>join(",",@list)});
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -72,16 +72,16 @@ my %usage = (
|
||||
rinv <noderange> [all|model|serial] [-V|--verbose]
|
||||
rinv [-h|--help|-v|--version]
|
||||
BMC specific:
|
||||
rinv <noderange> [vpd|mprom|deviceid|uuid|guid]
|
||||
rinv <noderange> [mprom|deviceid|uuid|guid|vpd [-t]|all [-t]]
|
||||
MPA specific:
|
||||
rinv <noderange> [firm|bios|diag|mprom|sprom|mparom|mac|mtm]
|
||||
rinv <noderange> [firm|bios|diag|mprom|sprom|mparom|mac|mtm [-t]]
|
||||
PPC specific(with HMC):
|
||||
rinv <noderange> [bus|config|serial|model|firm|all]
|
||||
rinv <noderange> [all|bus|config|serial|model|firm [-t]]
|
||||
PPC specific(using Direct FSP Management):
|
||||
rinv <noderange> [firm]
|
||||
rinv <noderange> [deconfig [-x]]
|
||||
Blade specific:
|
||||
rinv <noderange> [mtm|serial|mac|bios|diag|mprom|mparom|firm|all]
|
||||
rinv <noderange> [all|serial|mac|bios|diag|mprom|mparom|firm|mtm [-t]]
|
||||
IBM Flex System Compute Node specific:
|
||||
rinv <noderange> [firm]
|
||||
VMware specific:
|
||||
|
@ -3330,4 +3330,61 @@ sub filter_nodes{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 filter_nostatusupdate()
|
||||
|
||||
filter out the nodes which support provision status feedback from the status-nodes hash
|
||||
Returns:
|
||||
returns the filtered status-nodes hash
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Input:
|
||||
the ref of status-nodes hash to filter
|
||||
Example:
|
||||
my $mn=xCAT::Utils->filter_nostatusupdate(\%statusnodehash);
|
||||
Comments:
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub filter_nostatusupdate{
|
||||
|
||||
my ($class,$inref)=@_;
|
||||
my $nttabdata;
|
||||
my @allnodes=();
|
||||
#read "nodetype" table to get the "os" attribs for all the nodes with status "installing" or "netbooting"
|
||||
if(exists $inref->{$::STATUS_INSTALLING}){
|
||||
push @allnodes, @{$inref->{$::STATUS_INSTALLING}};
|
||||
}
|
||||
if(exists $inref->{$::STATUS_NETBOOTING}){
|
||||
push @allnodes, @{$inref->{$::STATUS_NETBOOTING}};
|
||||
}
|
||||
|
||||
my $nodetypetab = xCAT::Table->new('nodetype');
|
||||
if ($nodetypetab) {
|
||||
$nttabdata = $nodetypetab->getNodesAttribs(\@allnodes, ['node', 'os']);
|
||||
$nodetypetab->close();
|
||||
}
|
||||
|
||||
#filter out the nodes which support the node provision status feedback
|
||||
my @nodesfiltered=();
|
||||
if(exists $inref->{$::STATUS_INSTALLING}){
|
||||
map{ if($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|sles|ubuntu)/) {push @nodesfiltered,$_;} } @{$inref->{$::STATUS_INSTALLING}};
|
||||
delete $inref->{$::STATUS_INSTALLING};
|
||||
if(@nodesfiltered){
|
||||
@{$inref->{$::STATUS_INSTALLING}}=@nodesfiltered;
|
||||
}
|
||||
}
|
||||
|
||||
@nodesfiltered=();
|
||||
if(exists $inref->{$::STATUS_NETBOOTING}){
|
||||
map{ if($nttabdata->{$_}->[0]->{os} !~ /(fedora|rh|centos|sles|ubuntu)/) {push @nodesfiltered,$_;} } @{$inref->{$::STATUS_NETBOOTING}};
|
||||
delete $inref->{$::STATUS_NETBOOTING};
|
||||
if(@nodesfiltered){
|
||||
@{$inref->{$::STATUS_NETBOOTING}}=@nodesfiltered;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
1;
|
||||
|
43
perl-xCAT/xCAT/data/ibmhwtypes.pm
Executable file
43
perl-xCAT/xCAT/data/ibmhwtypes.pm
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env perl
|
||||
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
|
||||
package xCAT::data::ibmhwtypes;
|
||||
require Exporter;
|
||||
@EXPORT_OK=qw(parse_group mt2group);
|
||||
use Data::Dumper;
|
||||
my %groups2mtm = (
|
||||
"x3250" => ["2583","4251","4252"],
|
||||
"x3550" => ["7914","7944","7946"],
|
||||
"x3650" => ["7915","7945"],
|
||||
"dx360" => [],
|
||||
"x220" => ["7906"],
|
||||
"x240" => ["8737","7863"],
|
||||
"x440" => ["7917"],
|
||||
"p260" => ["7895"], #789522X, 789523X
|
||||
"p460" => [], #789542X
|
||||
"p470" => ["7954"],
|
||||
);
|
||||
|
||||
%mt2group = ();
|
||||
foreach my $group (keys %groups2mtm) {
|
||||
foreach my $mtm (@{$groups2mtm{$group}}) {
|
||||
$mt2group{$mtm} = $group;
|
||||
}
|
||||
}
|
||||
|
||||
sub parse_group {
|
||||
my $mtm = shift;
|
||||
if ($mtm =~ /xCAT::data/) {
|
||||
$mtm = shift;
|
||||
}
|
||||
if ($mtm =~ /^(\w{4})/) {
|
||||
$mt = $1;
|
||||
if ($mt eq "7895" and $mtm =~ /789542X/i) {
|
||||
return "p460";
|
||||
}
|
||||
return $mt2group{$mt};
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
1;
|
@ -386,7 +386,7 @@ sub getdefaultcredentials {
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (!defined($user) || !defined($pw)) { die "Did not find the ipmi username and password in the xCAT passwd table.\n"; }
|
||||
if (!defined($user) || !defined($pw)) { $user = "USERID"; $pw = "PASSW0RD"; }
|
||||
return ($user, $pw);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if (!GetOptions(
|
||||
"nonodecheck" => \$::NONODECHECK, #does not check the noderange, in this case, noderange need to be a list of nodes.
|
||||
'h|help' => \$help,
|
||||
) || $help || scalar(@ARGV)<2 ) {
|
||||
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] <noderange> <command>\n";
|
||||
print "Usage: psh [-i <interface>] [-l <user>] [-f <fanout>] [--nonodecheck] <noderange> <command>\n";
|
||||
exit;
|
||||
}
|
||||
my %nodehdl;
|
||||
|
@ -43,6 +43,12 @@ rently executing remote shell processes.
|
||||
Log into the nodes as the specified username. The default is to use the same username as you
|
||||
are running the psh command as.
|
||||
|
||||
=item B<-n|--nonodecheck>
|
||||
|
||||
Do not send the noderange to xcatd to expand it into a list of nodes. Instead, use the noderange exactly as it is specified.
|
||||
In this case, the noderange must be a simple list of comma-separated hostnames of the nodes.
|
||||
This allows you to run B<psh> even when xcatd is not running.
|
||||
|
||||
=item B<noderange>
|
||||
|
||||
See L<noderange(3)|noderange.3>.
|
||||
|
@ -192,7 +192,7 @@ cappingperc
|
||||
|
||||
=back
|
||||
|
||||
B<9125-F2C>
|
||||
B<9125-F2C>, B<9119-FHB>
|
||||
|
||||
=over 4
|
||||
|
||||
@ -208,6 +208,22 @@ cappingperc,fsavingstatus,ffovalue
|
||||
|
||||
=back
|
||||
|
||||
B<Non of Above>
|
||||
|
||||
=over 4
|
||||
|
||||
For the machine type which is not in the above list, the following
|
||||
attributes can be tried but not guaranteed:
|
||||
|
||||
B<Query>: savingstatus,dsavingstatus,cappingstatus,cappingmin,
|
||||
cappingmax,,cappingvalue,cappingsoftmin,averageAC,averageDC,
|
||||
ambienttemp,exhausttemp,CPUspeed,syssbpower,sysIPLtime
|
||||
|
||||
B<Set>: savingstatus,dsavingstatus,cappingstatus,cappingwatt,
|
||||
cappingperc
|
||||
|
||||
=back
|
||||
|
||||
=back
|
||||
|
||||
Note:
|
||||
|
@ -565,7 +565,7 @@ To define a BNT Ethernet switch as a node and run a command to create a new vlan
|
||||
|
||||
B<chdef> I<myswitch groups=all>
|
||||
|
||||
B<tabch> I<switch=myswitch switches.sshusername=admin switches.sshpassword=passw0rd>
|
||||
B<tabch> I<switch=myswitch switches.sshusername=admin switches.sshpassword=passw0rd switches.protocol=[ssh|telnet]>
|
||||
where I<admin> and I<passw0rd> are the SSH user name and password for the switch. If it is for Telnet, add I<tn:> in front of the user name: I<tn:admin>.
|
||||
|
||||
<xdsh> I<myswitch --devicetype EthSwitch::BNT 'enable;configure terminal;vlan 3;end;show vlan'>
|
||||
|
@ -74,7 +74,6 @@ Redistribute credentials and ssh keys to the service nodes and ssh keys to the n
|
||||
|
||||
This option will add the Management Node to the database with the correct attributes set to be recognized by xCAT. This should be run after the hostname of the Management Node is set to the name that will resolve to the cluster-facing NIC.
|
||||
|
||||
|
||||
=item B<-t|--tunables>
|
||||
|
||||
This option will set tunable parameters on the Management and Service nodes recommended for your Linux cluster. It will only set them during initial install, if you run xcatconfig -f or xcatconfig -t.
|
||||
|
@ -623,4 +623,4 @@ dracut_install /lib64/rsyslog/lmnet.so
|
||||
dracut_install /lib64/rsyslog/lmstrmsrv.so
|
||||
dracut_install /lib64/rsyslog/imuxsock.so
|
||||
dracut_install /usr/lib64/libnfsidmap/nsswitch.so
|
||||
dracut_install killall logger nc nslookup bc chown chroot dd expr kill mkdosfs parted rsync shutdown sort ssh-keygen tr blockdev findfs insmod kexec lvm mdadm mke2fs pivot_root sshd swapon tune2fs # for sysclone
|
||||
dracut_install killall logger nc nslookup bc chown chroot dd expr kill mkdosfs parted rsync shutdown sort ssh-keygen tr blockdev findfs insmod kexec lvm mdadm mke2fs pivot_root sshd swapon tune2fs mkreiserfs reiserfstune # for sysclone
|
||||
|
@ -4,3 +4,4 @@ instmods e1000 e1000e virtio_net igb ines sfc mlx4_en cxgb3 cxgb4 tg3 bnx2 bnx2x
|
||||
instmods macvlan macvtap 8021q bridge bonding vmxnet3 cpufreq_ondemand acpi-cpufreq powernow-k8 cdc_ether
|
||||
instmods mptctl #LSI firmware management requires this
|
||||
instmods mlx4_ib ib_umad #make the mellanox ib available enough to examine /sys
|
||||
instmods reiserfs #reiserfs on sysclone
|
||||
|
@ -54,6 +54,11 @@ if [ "$IPMIMFG" == 2 ]; then #IBM
|
||||
for p in $BMCPORT; do
|
||||
ipmitool -d $idev raw 0xc 1 1 0xc0 $p > /dev/null
|
||||
ipmitool -d $idev raw 0x04 0x12 0x09 0x01 0x18 0x${p}1 0x00 > /dev/null
|
||||
CURBMCPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0 | awk '{print $2}'`
|
||||
while [ "$CURBMCPORT" -ne "$BMCPORT" ]; do
|
||||
sleep 1
|
||||
CURBMCPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0 | awk '{print $2}'`
|
||||
done
|
||||
let idev=idev+1
|
||||
done
|
||||
fi
|
||||
@ -67,7 +72,12 @@ if [ "$IPMIMFG" == 2 ]; then #IBM
|
||||
let idev=0
|
||||
for p in $BMCPORT; do
|
||||
ipmitool -d $idev raw 0xc 1 1 0xc0 $p > /dev/null
|
||||
let idev=idev+1
|
||||
CURBMCPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0 | awk '{print $2}'`
|
||||
while [ "$CURBMCPORT" -ne "$BMCPORT" ]; do
|
||||
sleep 1
|
||||
CURBMCPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0 | awk '{print $2}'`
|
||||
done
|
||||
let idev=idev+1
|
||||
done
|
||||
fi
|
||||
fi
|
||||
@ -84,8 +94,17 @@ elif [ "$IPMIMFG" == 20301 ] ; then
|
||||
let idev=0
|
||||
for p in $BMCPORT; do
|
||||
ipmitool -d $idev raw 0xc 1 1 0xc0 $p > /dev/null
|
||||
NEWPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0|awk '{print $2}'`
|
||||
sleep 10
|
||||
# after this change, we need to watch and wait to see that it
|
||||
# actually takes effect. On port change, the service processor
|
||||
# does not migrate the network configuration over
|
||||
# so we might be halfway through setting up when the net config
|
||||
# reverts to dhcp then static, which setting a static ip for is
|
||||
# considered invalid
|
||||
CURBMCPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0 | awk '{print $2}'`
|
||||
while [ -z "$CURBMCPORT" -o 0"$CURBMCPORT" -ne "$BMCPORT" ]; do
|
||||
sleep 1
|
||||
CURBMCPORT=`ipmitool -d $idev raw 0xc 2 1 0xc0 0 0 | awk '{print $2}'`
|
||||
done
|
||||
|
||||
let idev=idev+1
|
||||
done
|
||||
|
@ -269,6 +269,8 @@ sub process_command {
|
||||
}
|
||||
}
|
||||
}
|
||||
#donot update node provision status (installing or netbooting) here
|
||||
xCAT::Utils->filter_nostatusupdate(\%newnodestatus);
|
||||
#print "newstatus" . Dumper(\%newnodestatus);
|
||||
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1);
|
||||
}
|
||||
|
@ -180,6 +180,8 @@ sub mknetboot
|
||||
my $installroot;
|
||||
$installroot = "/install";
|
||||
my $xcatdport = "3001";
|
||||
my $xcatiport = "3002";
|
||||
my $nodestatus = "y";
|
||||
|
||||
#if ($sitetab)
|
||||
#{
|
||||
@ -190,6 +192,12 @@ sub mknetboot
|
||||
{
|
||||
$installroot = $site_ent;
|
||||
}
|
||||
@ents = xCAT::TableUtils->get_site_attribute("nodestatus");
|
||||
$site_ent = $ents[0];
|
||||
if ( defined($site_ent) )
|
||||
{
|
||||
$nodestatus = $site_ent;
|
||||
}
|
||||
# ($ref) = $sitetab->getAttribs({key => 'xcatdport'}, 'value');
|
||||
@ents = xCAT::TableUtils->get_site_attribute("xcatdport");
|
||||
$site_ent = $ents[0];
|
||||
@ -197,6 +205,12 @@ sub mknetboot
|
||||
{
|
||||
$xcatdport = $site_ent;
|
||||
}
|
||||
@ents = xCAT::TableUtils->get_site_attribute("xcatiport");
|
||||
$site_ent = $ents[0];
|
||||
if ( defined($site_ent) )
|
||||
{
|
||||
$xcatiport = $site_ent;
|
||||
}
|
||||
# ($ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value');
|
||||
@ents = xCAT::TableUtils->get_site_attribute("tftpdir");
|
||||
$site_ent = $ents[0];
|
||||
@ -679,8 +693,10 @@ sub mknetboot
|
||||
} else {
|
||||
$xcatmasterip = $xcatmaster;
|
||||
}
|
||||
$kcmdline .=
|
||||
"XCAT=$xcatmasterip:$xcatdport ";
|
||||
|
||||
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
|
||||
|
||||
|
||||
if ($rootfstype ne "ramdisk") {
|
||||
# BEGIN service node
|
||||
my $isSV = xCAT::Utils->isServiceNode();
|
||||
@ -701,9 +717,14 @@ sub mknetboot
|
||||
else {
|
||||
$kcmdline =
|
||||
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix ";
|
||||
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
|
||||
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
|
||||
$kcmdline .= "NODE=$node ";
|
||||
}
|
||||
#inform statelite/stateless node not to update the nodestatus during provision
|
||||
if(($nodestatus eq "n") or ($nodestatus eq "N") or ($nodestatus eq "0")){
|
||||
$kcmdline .= " nonodestatus ";
|
||||
}
|
||||
|
||||
|
||||
# add one parameter: ifname=<eth0>:<mac address>
|
||||
# which is used for dracut
|
||||
@ -913,7 +934,6 @@ sub mkinstall
|
||||
my $doreq = shift;
|
||||
my @nodes = @{$request->{node}};
|
||||
my $noupdateinitrd = $request->{'noupdateinitrd'};
|
||||
|
||||
#my $sitetab = xCAT::Table->new('site');
|
||||
my $linuximagetab;
|
||||
my $osimagetab;
|
||||
@ -2409,6 +2429,7 @@ sub insert_dd {
|
||||
my @rpm_list;
|
||||
my @driver_list;
|
||||
my $Injectalldriver;
|
||||
my $updatealldriver;
|
||||
|
||||
my @rpm_drivers;
|
||||
|
||||
@ -2453,6 +2474,9 @@ sub insert_dd {
|
||||
if (/^allupdate$/) {
|
||||
$Injectalldriver = 1;
|
||||
next;
|
||||
} elsif (/^updateonly$/) {
|
||||
$updatealldriver = 1;
|
||||
next;
|
||||
}
|
||||
unless (/\.ko$/) {
|
||||
s/$/.ko/;
|
||||
@ -2463,7 +2487,7 @@ sub insert_dd {
|
||||
chomp(@dd_list);
|
||||
chomp(@rpm_list);
|
||||
|
||||
unless (@dd_list || (@rpm_list && ($Injectalldriver || @driver_list))) {
|
||||
unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
|
||||
return ();
|
||||
}
|
||||
|
||||
@ -2474,7 +2498,7 @@ sub insert_dd {
|
||||
# dracut + drvier rpm
|
||||
# !dracut + driver rpm
|
||||
# !dracut + driver disk
|
||||
if (!<$install_dir/$os/$arch/Packages/dracut*> || (@rpm_list && ($Injectalldriver || @driver_list))) {
|
||||
if (!<$install_dir/$os/$arch/Packages/dracut*> || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
|
||||
mkpath "$dd_dir/initrd_img"; # The dir for the new initrd
|
||||
|
||||
# unzip the initrd image
|
||||
@ -2537,13 +2561,12 @@ sub insert_dd {
|
||||
}
|
||||
|
||||
my $new_kernel_ver;
|
||||
if (@rpm_list && ($Injectalldriver || @driver_list)) {
|
||||
if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) {
|
||||
# Extract the files from rpm to the tmp dir
|
||||
mkpath "$dd_dir/rpm";
|
||||
foreach my $rpm (@rpm_list) {
|
||||
if (-r $rpm) {
|
||||
$cmd = "cd $dd_dir/rpm; rpm2cpio $rpm | cpio -idum";
|
||||
#$cmd = "rpm -i --quiet --nodeps --force --ignorearch --ignoreos --nosignature --root $dd_dir/rpm $rpm";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
@ -2560,17 +2583,17 @@ sub insert_dd {
|
||||
# and copy it to the /tftpboot
|
||||
my @new_kernels = <$dd_dir/rpm/boot/vmlinuz*>;
|
||||
foreach my $new_kernel (@new_kernels) {
|
||||
if (-r $new_kernel && $new_kernel =~ /\/vmlinuz-(.*(x86_64|ppc64))$/) {
|
||||
$new_kernel_ver = $1;
|
||||
$cmd = "/bin/mv -f $new_kernel $kernelpath";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $kernelpath.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
if (-r $new_kernel && $new_kernel =~ /\/vmlinuz-(.*(x86_64|ppc64|el\d+))$/) {
|
||||
$new_kernel_ver = $1;
|
||||
$cmd = "/bin/mv -f $new_kernel $kernelpath";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $kernelpath.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
|
||||
# Change it back to xxx.ko here
|
||||
@ -2601,7 +2624,7 @@ sub insert_dd {
|
||||
# For dracut mode, only copy the drivers from rpm packages to the /lib/modules/<kernel>
|
||||
# The driver disk will be handled that append the whole disk to the orignial initrd
|
||||
|
||||
if (@rpm_list && ($Injectalldriver || @driver_list)) {
|
||||
if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) {
|
||||
# Copy the firmware to the rootimage
|
||||
if (-d "$dd_dir/rpm/lib/firmware") {
|
||||
if (! -d "$dd_dir/initrd_img/lib/firmware") {
|
||||
@ -2616,14 +2639,15 @@ sub insert_dd {
|
||||
}
|
||||
}
|
||||
|
||||
# if the new kernel from update distro is not existed in initrd, copy all the modules for the new kernel to initrd
|
||||
if ((! -r "$dd_dir/initrd_img/lib/modules/$new_kernel_ver") && (-r "$dd_dir/rpm/lib/modules/$new_kernel_ver")) {
|
||||
$cmd = "/bin/cp -rf $dd_dir/rpm/lib/modules/$new_kernel_ver $dd_dir/initrd_img/lib/modules/";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not copy $dd_dir/rpm/lib/modules/$new_kernel_ver to $dd_dir/initrd_img/lib/modules.";
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
# get the name list for all drivers in the original initrd if 'netdrivers=updateonly'
|
||||
# then only the drivers in this list will be updated from the drvier rpms
|
||||
if ($updatealldriver) {
|
||||
$driver_name = "\*\.ko";
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/initrd_img/lib/modules/*>);
|
||||
foreach my $real_path (@all_real_path) {
|
||||
my $driver = basename($real_path);
|
||||
push @driver_list, $driver;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2631,9 +2655,19 @@ sub insert_dd {
|
||||
# Figure out the kernel version
|
||||
my @kernelpaths = <$dd_dir/initrd_img/lib/modules/*>;
|
||||
my @kernelvers;
|
||||
if ($new_kernel_ver) {
|
||||
push @kernelvers, $new_kernel_ver;
|
||||
}
|
||||
|
||||
# if new kernel is used, remove all the original kernel directories
|
||||
foreach (@kernelpaths) {
|
||||
if (basename($_) =~ /^[\d\.]+/) {
|
||||
push @kernelvers, basename($_);
|
||||
my $kernelv = basename($_);
|
||||
if ($kernelv =~ /^[\d\.]+/) {
|
||||
if ($new_kernel_ver) {
|
||||
rmtree ("$dd_dir/initrd_img/lib/modules/$kernelv");
|
||||
} else {
|
||||
push @kernelvers, $kernelv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2643,6 +2677,7 @@ sub insert_dd {
|
||||
}
|
||||
if (@driver_list) {
|
||||
foreach my $driver (@driver_list) {
|
||||
$driver =~ s/\.gz$//;
|
||||
$driver_name = $driver;
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
|
||||
@ -2805,7 +2840,7 @@ sub insert_dd {
|
||||
}
|
||||
|
||||
# Merge the drviers from rpm packages to the initrd
|
||||
if (@rpm_list && ($Injectalldriver || @driver_list)) {
|
||||
if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) {
|
||||
# Copy the firmware to the rootimage
|
||||
if (-d "$dd_dir/rpm/lib/firmware") {
|
||||
if (! -d "$dd_dir/initrd_img/lib") {
|
||||
@ -2825,18 +2860,44 @@ sub insert_dd {
|
||||
mkpath ("$dd_dir/modules/$new_kernel_ver/$arch/");
|
||||
}
|
||||
|
||||
# get the name list for all drivers in the original initrd if 'netdrivers=updateonly'
|
||||
# then only the drivers in this list will be updated from the drvier rpms
|
||||
if ($updatealldriver) {
|
||||
$driver_name = "\*\.ko";
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/modules/*>);
|
||||
foreach my $real_path (@all_real_path) {
|
||||
my $driver = basename($real_path);
|
||||
push @driver_list, $driver;
|
||||
}
|
||||
}
|
||||
|
||||
# Copy the drivers to the initrd
|
||||
# Figure out the kernel version
|
||||
my @kernelpaths = <$dd_dir/modules/*>;
|
||||
my @kernelvers;
|
||||
if ($new_kernel_ver) {
|
||||
push @kernelvers, $new_kernel_ver;
|
||||
}
|
||||
foreach (@kernelpaths) {
|
||||
push @kernelvers, basename($_);
|
||||
my $kernelv = basename($_);
|
||||
if ($kernelv =~ /^[\d\.]+/) {
|
||||
if ($new_kernel_ver) {
|
||||
rmtree ("$dd_dir/modules/$kernelv");
|
||||
} else {
|
||||
push @kernelvers, $kernelv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $kernelver (@kernelvers) {
|
||||
unless (-d "$dd_dir/rpm/lib/modules/$kernelver") {
|
||||
next;
|
||||
}
|
||||
# create path for the new kernel in the modules package
|
||||
unless (-d "$dd_dir/modules/$kernelver") {
|
||||
mkpath ("$dd_dir/modules/$kernelver/$arch/");
|
||||
}
|
||||
# find the $kernelver/$arch dir in the $dd_dir/modules
|
||||
my $arch4modules;
|
||||
foreach (<$dd_dir/modules/$kernelver/*>) {
|
||||
@ -2912,13 +2973,23 @@ sub insert_dd {
|
||||
if (-d $ma) {
|
||||
mkpath "$dd_dir/depmod/lib/modules/$mk";
|
||||
xCAT::Utils->runcmd("/bin/cp -rf $ma/* $dd_dir/depmod/lib/modules/$mk", -1);
|
||||
$cmd = "depmod -b $dd_dir/depmod/";
|
||||
$cmd = "depmod -b $dd_dir/depmod/ $mk";
|
||||
#$cmd = "depmod -b $dd_dir/depmod/";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the depdency for the drivers in the initrd.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
# remove the .ko postfix from the driver name for rh5
|
||||
$cmd = "/bin/sed ".'s/\.ko//g'." $dd_dir/depmod/lib/modules/$mk/modules.dep > $dd_dir/depmod/lib/modules/$mk/modules.dep1; mv -f $dd_dir/depmod/lib/modules/$mk/modules.dep1 $dd_dir/depmod/lib/modules/$mk/modules.dep";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not generate the depdency for the drivers in the initrd.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
|
||||
if (-f "$dd_dir/depmod/lib/modules/$mk/modules.dep") {
|
||||
copy ("$dd_dir/depmod/lib/modules/$mk/modules.dep", "$dd_dir/initrd_img/modules/modules.dep");
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ use xCAT::GlobalDef;
|
||||
use xCAT_monitoring::monitorctrl;
|
||||
use strict;
|
||||
use LWP;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
#use warnings;
|
||||
my %mm_comm_pids;
|
||||
@ -1773,6 +1774,7 @@ sub rscan_xml {
|
||||
my $href = {
|
||||
Node => { }
|
||||
};
|
||||
my $mtm = undef;
|
||||
foreach ( @rscan_attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@ -1789,6 +1791,7 @@ sub rscan_xml {
|
||||
}
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
$ignore = 1;
|
||||
} elsif ( /^mgt$/ ) {
|
||||
if ($origtype eq "ppcblade") {
|
||||
$d = "fsp";
|
||||
@ -1831,13 +1834,23 @@ sub rscan_xml {
|
||||
} else {
|
||||
$ignore = 1;
|
||||
}
|
||||
} elsif (/^mtm$/) {
|
||||
$d =~ /^(\w{4})/;
|
||||
$mtm = $1;
|
||||
}
|
||||
|
||||
if (!$ignore) {
|
||||
$href->{Node}->{$_} = $d;
|
||||
}
|
||||
}
|
||||
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$href->{Node}->{groups} = $tmp_groups;
|
||||
$xml.= XMLout($href,NoAttr=>1,KeyAttr=>[],RootName=>undef);
|
||||
}
|
||||
return( $xml );
|
||||
@ -1872,7 +1885,7 @@ sub rscan_stanza {
|
||||
$objname = $data[1];
|
||||
}
|
||||
$result .= "$objname:\n\tobjtype=node\n";
|
||||
|
||||
my $mtm = undef;
|
||||
foreach ( @rscan_attribs ) {
|
||||
my $d = $data[$i++];
|
||||
|
||||
@ -1889,6 +1902,7 @@ sub rscan_stanza {
|
||||
}
|
||||
} elsif ( /^groups$/ ) {
|
||||
$d = "$type,all";
|
||||
$ignore = 1;
|
||||
} elsif ( /^mgt$/ ) {
|
||||
if ($origtype eq "ppcblade") {
|
||||
$d = "fsp";
|
||||
@ -1931,12 +1945,23 @@ sub rscan_stanza {
|
||||
} else {
|
||||
$ignore = 1;
|
||||
}
|
||||
} elsif (/^mtm$/) {
|
||||
$d =~ /^(\w{4})/;
|
||||
$mtm = $1;
|
||||
}
|
||||
|
||||
if (!$ignore) {
|
||||
$result .= "\t$_=$d\n";
|
||||
}
|
||||
}
|
||||
my $tmp_groups = "$type,all";
|
||||
if (defined ($mtm)) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($mtm);
|
||||
if (defined ($tmp_pre)) {
|
||||
$tmp_groups .= ",$tmp_pre";
|
||||
}
|
||||
}
|
||||
$result .= "\tgroups=$tmp_groups\n";
|
||||
}
|
||||
return( $result );
|
||||
}
|
||||
@ -2246,6 +2271,13 @@ sub inv {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($updatetable and $updatehash{mtm}) {
|
||||
#updatenodegroups
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($updatehash{mtm}) ;
|
||||
if (defined($tmp_pre)) {
|
||||
xCAT::TableUtils->updatenodegroups($currnode, $tmp_pre);
|
||||
}
|
||||
}
|
||||
if ($updatetable and keys %updatehash) {
|
||||
my $vpdtab = xCAT::Table->new('vpd');
|
||||
$vpdtab->setNodeAttribs($currnode,\%updatehash);
|
||||
@ -4388,6 +4420,12 @@ sub process_request {
|
||||
unless ($node) {
|
||||
return 1; #failure
|
||||
}
|
||||
if ($request->{mtm} and $request->{mtm} =~ /^(\w{4})/) {
|
||||
my $group = xCAT::data::ibmhwtypes::parse_group($request->{mtm});
|
||||
if (defined($group)) {
|
||||
xCAT::TableUtils->updatenodegroups($node, $group);
|
||||
}
|
||||
}
|
||||
if ($mac) {
|
||||
my $mactab = xCAT::Table->new('mac',-create=>1);
|
||||
$mactab->setNodeAttribs($macmap{$mac},{mac=>$mac});
|
||||
@ -5901,6 +5939,10 @@ sub dompa {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#donot update node provision status (installing or netbooting) here
|
||||
xCAT::Utils->filter_nostatusupdate(\%newnodestatus);
|
||||
#print "newstatus" . Dumper(\%newnodestatus);
|
||||
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1);
|
||||
}
|
||||
|
@ -897,6 +897,8 @@ sub mknetboot
|
||||
my $installroot;
|
||||
$installroot = "/install";
|
||||
my $xcatdport = "3001";
|
||||
my $xcatiport = "3002";
|
||||
my $nodestatus = "y";
|
||||
|
||||
if ($sitetab)
|
||||
{
|
||||
@ -910,11 +912,21 @@ sub mknetboot
|
||||
{
|
||||
$xcatdport = $ref->{value};
|
||||
}
|
||||
($ref) = $sitetab->getAttribs({key => 'xcatiport'}, 'value');
|
||||
if ($ref and $ref->{value})
|
||||
{
|
||||
$xcatiport = $ref->{value};
|
||||
}
|
||||
($ref) = $sitetab->getAttribs({key => 'tftpdir'}, 'value');
|
||||
if ($ref and $ref->{value})
|
||||
{
|
||||
$globaltftpdir = $ref->{value};
|
||||
}
|
||||
($ref) = $sitetab->getAttribs({key => 'nodestatus'}, 'value');
|
||||
if ($ref and $ref->{value})
|
||||
{
|
||||
$nodestatus = $ref->{value};
|
||||
}
|
||||
}
|
||||
my %donetftp=();
|
||||
my %oents = %{$ostab->getNodesAttribs(\@nodes,[qw(os arch profile provmethod)])};
|
||||
@ -1317,6 +1329,7 @@ sub mknetboot
|
||||
|
||||
|
||||
|
||||
|
||||
# add support for subVars in the value of "statemnt"
|
||||
my $statemnt = "";
|
||||
if (exists($stateHash->{$node})) {
|
||||
@ -1366,6 +1379,10 @@ sub mknetboot
|
||||
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
|
||||
}
|
||||
|
||||
# if site.nodestatus='n', add "nonodestatus" to kcmdline to inform the node not to update nodestatus during provision
|
||||
if(($nodestatus eq "n") or ($nodestatus eq "N") or ($nodestatus eq "0")){
|
||||
$kcmdline .= " nonodestatus ";
|
||||
}
|
||||
# add one parameter: ifname=<eth0>:<mac address>
|
||||
# which is used for dracut
|
||||
# the redhat5.x os will ignore it
|
||||
|
@ -116,7 +116,7 @@ sub geninitrd {
|
||||
$netdrivers = $lient->{'netdrivers'};
|
||||
|
||||
# if the provmethod equals 'netboot', call the genimage --onlyinitrd directly
|
||||
if ($oient->{'provmethod'} && $oient->{'provmethod'} eq "netboot") {
|
||||
if ($oient->{'provmethod'} && ($oient->{'provmethod'} eq "netboot" || $oient->{'provmethod'} eq "statelite")) {
|
||||
if ($lient->{'rootimgdir'}) {
|
||||
unless (-d $lient->{'rootimgdir'}."/rootimg/lib/modules") {
|
||||
xCAT::MsgUtils->message("E", {error=>["The genimage should be run before running geninitrd."], errorcode=>["1"]}, $callback);
|
||||
@ -132,7 +132,7 @@ sub geninitrd {
|
||||
# arg => [$osimage, '--onlyinitrd'] }, $callback);
|
||||
return;
|
||||
} elsif (!$oient->{'provmethod'} || $oient->{'provmethod'} ne "install") {
|
||||
xCAT::MsgUtils->message("E", {error=>["The attribute [provmethod] for osimage [$osimage] must be set to install or netboot."], errorcode=>["1"]}, $callback);
|
||||
xCAT::MsgUtils->message("E", {error=>["The attribute [provmethod] for osimage [$osimage] must be set to install, netboot or statelite."], errorcode=>["1"]}, $callback);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ my $iem_support;
|
||||
my $vpdhash;
|
||||
my %allerrornodes=();
|
||||
my $global_sessdata;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
eval {
|
||||
require IBM::EnergyManager;
|
||||
@ -1591,6 +1592,11 @@ sub inv {
|
||||
sub fru_initted {
|
||||
my $sessdata = shift;
|
||||
my $key;
|
||||
my @args = @{$sessdata->{extraargs}};
|
||||
my $up_group = undef;
|
||||
if (grep /-t/, @args) {
|
||||
$up_group = '1';
|
||||
}
|
||||
my @types = @{$sessdata->{invtypes}};
|
||||
my $format = "%-20s %s";
|
||||
|
||||
@ -1599,11 +1605,17 @@ sub fru_initted {
|
||||
my $type;
|
||||
foreach $type (split /,/,$fru->rec_type) {
|
||||
if(grep {$_ eq $type} @types) {
|
||||
my $bmcifo="";
|
||||
if ($sessdata->{bmcnum} != 1) {
|
||||
$bmcifo=" on BMC ".$sessdata->{bmcnum};
|
||||
}
|
||||
xCAT::SvrUtils::sendmsg(sprintf($format.$bmcifo,$sessdata->{fru_hash}->{$key}->desc . ":",$sessdata->{fru_hash}->{$key}->value),$callback,$sessdata->{node},%allerrornodes);
|
||||
my $bmcifo="";
|
||||
if ($sessdata->{bmcnum} != 1) {
|
||||
$bmcifo=" on BMC ".$sessdata->{bmcnum};
|
||||
}
|
||||
xCAT::SvrUtils::sendmsg(sprintf($format.$bmcifo,$sessdata->{fru_hash}->{$key}->desc . ":",$sessdata->{fru_hash}->{$key}->value),$callback,$sessdata->{node},%allerrornodes);
|
||||
if ($up_group and $type eq "model" and $fru->desc =~ /MTM/) {
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($fru->value);
|
||||
if (defined($tmp_pre)) {
|
||||
xCAT::TableUtils->updatenodegroups($sessdata->{node}, $tmp_pre);
|
||||
}
|
||||
}
|
||||
last;
|
||||
}
|
||||
}
|
||||
@ -6124,6 +6136,14 @@ sub preprocess_request {
|
||||
my (@bmcnodes, @nohandle);
|
||||
xCAT::Utils->filter_nodes($request, undef, undef, \@bmcnodes, \@nohandle);
|
||||
$realnoderange = \@bmcnodes;
|
||||
} elsif ($command eq "rinv") {
|
||||
if ($exargs[0] eq "-t" and $#exargs == 0) {
|
||||
unshift @{$request->{arg}}, 'all';
|
||||
} elsif ((grep /-t/, @exargs) and !(grep /(all|vpd)/, @exargs) ) {
|
||||
$callback->({errorcode=>[1],error=>["option '-t' can only work with 'all' or 'vpd'"]});
|
||||
$request = {};
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$realnoderange) {
|
||||
@ -6497,6 +6517,9 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#donot update node provision status (installing or netbooting) here
|
||||
xCAT::Utils->filter_nostatusupdate(\%newnodestatus);
|
||||
#print "newstatus" . Dumper(\%newnodestatus);
|
||||
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1);
|
||||
}
|
||||
|
@ -6203,6 +6203,8 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
}
|
||||
#donot update node provision status (installing or netbooting) here
|
||||
xCAT::Utils->filter_nostatusupdate(\%newnodestatus);
|
||||
#print "newstatus" . Dumper(\%newnodestatus);
|
||||
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1);
|
||||
}
|
||||
|
@ -2427,7 +2427,6 @@ sub rmkitcomp
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "kitcomponent $kitcompdep basename does not exist";
|
||||
xCAT::MsgUtils->message( "E", \%rsp, $callback );
|
||||
return 1;
|
||||
}
|
||||
|
||||
my $kitcompdepname = get_highest_version('kitcompname', 'version', 'release', @entries);
|
||||
@ -2486,7 +2485,7 @@ sub rmkitcomp
|
||||
foreach my $kitcomponent (keys %kitcomps) {
|
||||
my @kitcompscripts = split( ',', $kitcomps{$kitcomponent}{postbootscripts} );
|
||||
foreach my $kitcompscript ( @kitcompscripts ) {
|
||||
if ( $osimagescript =~ /^$kitcompscript$/ ) {
|
||||
if ( $osimagescript =~ /^$kitcompscript/ ) {
|
||||
$match = 1;
|
||||
last;
|
||||
}
|
||||
|
@ -2813,6 +2813,8 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
}
|
||||
#donot update node provision status (installing or netbooting) here
|
||||
xCAT::Utils->filter_nostatusupdate(\%newnodestatus);
|
||||
#print "newstatus" . Dumper(\%newnodestatus);
|
||||
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1);
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ use xCAT::MacMap;
|
||||
use xCAT::IMMUtils;
|
||||
use xCAT_plugin::blade;
|
||||
use xCAT::SLP;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
|
||||
my $mpahash;
|
||||
@ -1418,11 +1419,18 @@ sub xCATdB {
|
||||
|
||||
my $id = ($type =~ /bpa|frame/) ? $frameid:$cageid;
|
||||
my $hidden = ($type =~ /bpa|fsp/)? 1:0;
|
||||
my $groups = lc($type).",all";
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group($model);
|
||||
|
||||
if (defined($tmp_pre)) {
|
||||
$groups .= ",$tmp_pre";
|
||||
}
|
||||
########################################
|
||||
# Write result to every tables,
|
||||
########################################
|
||||
if ( $type =~ /^bpa|fsp|cec|frame$/ ) {
|
||||
$nodelisthash{$hostname} = {groups=>"$type,all", hidden=>$hidden};
|
||||
#$nodelisthash{$hostname} = {groups=>"$type,all", hidden=>$hidden};
|
||||
$nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden};
|
||||
$ppchash{$hostname} = {id=>$id, parent=>$parent, hcp=>$hostname, nodetype=>$globalhwtype{$type}};
|
||||
$vpdhash{$hostname} = {mtm=>$model, serial=>$serial, side=>$side};
|
||||
$nodehmhash{$hostname} = {mgt=>$globalmgt{$type}};
|
||||
@ -1433,7 +1441,7 @@ sub xCATdB {
|
||||
my @data = ($type, $model, $serial, $side, $ip, $frameid, $cageid, $parent, $mac);
|
||||
xCAT::PPCdb::add_systemX( $type, $hostname, \@data );
|
||||
} elsif ( $type =~ /^(hmc|ivm)$/ ) {
|
||||
$nodelisthash{$hostname} = {groups=>"$type,all", hidden=>$hidden};
|
||||
$nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden};
|
||||
$ppchash{$hostname} = {nodetype=>$globalhwtype{$type}};
|
||||
$vpdhash{$hostname} = {mtm=>$model, serial=>$serial};
|
||||
$nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}};
|
||||
@ -1441,7 +1449,7 @@ sub xCATdB {
|
||||
$hostshash{$hostname} = {ip=>$ip};
|
||||
$machash{$hostname} = {mac=>$mac};
|
||||
}elsif ($type =~ /^cmm$/){
|
||||
$nodelisthash{$hostname} = {groups=>"cmm,all", hidden=>$hidden};
|
||||
$nodelisthash{$hostname} = {groups=>$groups, hidden=>$hidden};
|
||||
$vpdhash{$hostname} = {mtm=>$model, serial=>$serial};
|
||||
$nodetypehash{$hostname} = {nodetype=>$globalnodetype{$type}};
|
||||
$nodehmhash{$hostname} = {mgt=>"blade"};
|
||||
@ -1491,6 +1499,12 @@ sub format_stanza {
|
||||
$ip = $2;
|
||||
}
|
||||
my $type = ${$outhash->{$name}}{type};
|
||||
my $groups = "$type,all";
|
||||
my $tmp_pre = xCAT::data::ibmhwtypes::parse_group(${$outhash->{$name}}{mtm});
|
||||
if (defined($tmp_pre)) {
|
||||
$groups .= ",$tmp_pre";
|
||||
}
|
||||
|
||||
|
||||
#################################
|
||||
# Node attributes
|
||||
@ -1507,7 +1521,8 @@ sub format_stanza {
|
||||
if ($type =~ /^fsp|bpa|cmm$/) {
|
||||
$result .= "\tside=${$outhash->{$name}}{side}\n";
|
||||
}
|
||||
$result .= "\tgroups=$type,all\n";
|
||||
#$result .= "\tgroups=$type,all\n";
|
||||
$result .= "\tgroups=$groups\n";
|
||||
$result .= "\tmgt=$globalmgt{$type}\n";
|
||||
if ($type =~ /^fsp|bpa|frame|cec$/) {
|
||||
$result .= "\tid=${$outhash->{$name}}{$globalid{$type}}\n";
|
||||
|
@ -27,6 +27,7 @@ use xCAT::NetworkUtils;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::DiscoveryUtils;
|
||||
use xCAT::NodeRange qw/noderange/;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
|
||||
use Time::HiRes qw(gettimeofday sleep);
|
||||
|
||||
@ -272,7 +273,14 @@ sub findme {
|
||||
$nltab->setNodeAttribs($node, {groups=>"all"});
|
||||
}
|
||||
}
|
||||
|
||||
# update node groups with pre-defined groups
|
||||
if (defined($param{'mtm'})){
|
||||
my @list = ();
|
||||
my $tmp_group = xCAT::data::ibmhwtypes::parse_group($param{'mtm'});
|
||||
if (defined($tmp_group)) {
|
||||
xCAT::TableUtils->updatenodegroups($node, $nltab, $tmp_group);
|
||||
}
|
||||
}
|
||||
# set the mgt for the node
|
||||
my $hmtab = xCAT::Table->new('nodehm');
|
||||
unless ($hmtab) {
|
||||
|
@ -37,7 +37,8 @@ sub handled_commands
|
||||
copycd => "sles",
|
||||
mknetboot => "nodetype:os=(sles.*)|(suse.*)",
|
||||
mkinstall => "nodetype:os=(sles.*)|(suse.*)",
|
||||
mkstatelite => "nodetype:os=(sles.*)"
|
||||
mkstatelite => "nodetype:os=(sles.*)",
|
||||
mksysclone => "nodetype:os=(sles.*)|(suse.*)"
|
||||
};
|
||||
}
|
||||
|
||||
@ -64,7 +65,8 @@ sub mknetboot
|
||||
$installroot = "/install";
|
||||
|
||||
my $xcatdport = "3001";
|
||||
|
||||
my $xcatiport = "3002";
|
||||
my $nodestatus = "y";
|
||||
#if ($sitetab)
|
||||
#{
|
||||
#(my $ref) = $sitetab->getAttribs({key => 'installdir'}, 'value');
|
||||
@ -79,6 +81,17 @@ sub mknetboot
|
||||
if ( defined($t_entry) ) {
|
||||
$xcatdport = $t_entry;
|
||||
}
|
||||
@entries = xCAT::TableUtils->get_site_attribute("xcatiport");
|
||||
$t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$xcatiport = $t_entry;
|
||||
}
|
||||
@entries = xCAT::TableUtils->get_site_attribute("nodestatus");
|
||||
$t_entry = $entries[0];
|
||||
if ( defined($t_entry) ) {
|
||||
$nodestatus = $t_entry;
|
||||
}
|
||||
|
||||
#}
|
||||
|
||||
my $ntents = $ostab->getNodesAttribs($req->{node}, ['os', 'arch', 'profile', 'provmethod']);
|
||||
@ -553,6 +566,13 @@ sub mknetboot
|
||||
"imgurl=$httpmethod://$imgsrv/$rootimgdir/rootimg.$suffix ";
|
||||
}
|
||||
$kcmdline .= "XCAT=$xcatmaster:$xcatdport quiet ";
|
||||
|
||||
#if site.nodestatus="n", append "nonodestatus" to kcmdline
|
||||
#to inform the statelite/stateless node not to update the nodestatus during provision
|
||||
if(($nodestatus eq "n") or ($nodestatus eq "N") or ($nodestatus eq "0")){
|
||||
$kcmdline .= " nonodestatus ";
|
||||
}
|
||||
|
||||
$kcmdline .= "NODE=$node ";
|
||||
|
||||
# add the kernel-booting parameter: netdev=<eth0>, or BOOTIF=<mac>
|
||||
@ -671,6 +691,10 @@ sub process_request
|
||||
{
|
||||
return mknetboot($request, $callback, $doreq);
|
||||
}
|
||||
elsif ($request->{command}->[0] eq 'mksysclone')
|
||||
{
|
||||
return mksysclone($request, $callback, $doreq);
|
||||
}
|
||||
}
|
||||
|
||||
sub mkinstall
|
||||
@ -1185,6 +1209,250 @@ sub mkinstall
|
||||
#}
|
||||
}
|
||||
|
||||
sub mksysclone
|
||||
{
|
||||
my $request = shift;
|
||||
my $callback = shift;
|
||||
my $doreq = shift;
|
||||
my @nodes = @{$request->{node}};
|
||||
my $osimagetab;
|
||||
my %img_hash=();
|
||||
|
||||
my $installroot;
|
||||
my $globaltftpdir;
|
||||
$installroot = "/install";
|
||||
$globaltftpdir = "/tftpboot";
|
||||
|
||||
my @ents = xCAT::TableUtils->get_site_attribute("installdir");
|
||||
my $site_ent = $ents[0];
|
||||
if( defined($site_ent) )
|
||||
{
|
||||
$installroot = $site_ent;
|
||||
}
|
||||
@ents = xCAT::TableUtils->get_site_attribute("tftpdir");
|
||||
$site_ent = $ents[0];
|
||||
if( defined($site_ent) )
|
||||
{
|
||||
$globaltftpdir = $site_ent;
|
||||
}
|
||||
|
||||
my $node;
|
||||
my $ostab = xCAT::Table->new('nodetype');
|
||||
my $restab = xCAT::Table->new('noderes');
|
||||
my $bptab = xCAT::Table->new('bootparams',-create=>1);
|
||||
my $hmtab = xCAT::Table->new('nodehm');
|
||||
my %osents = %{$ostab->getNodesAttribs(\@nodes, ['os', 'arch', 'provmethod'])};
|
||||
my %rents =
|
||||
%{$restab->getNodesAttribs(\@nodes,
|
||||
['xcatmaster', 'nfsserver', 'tftpdir', 'primarynic', 'installnic'])};
|
||||
my %hents =
|
||||
%{$hmtab->getNodesAttribs(\@nodes,
|
||||
['serialport', 'serialspeed', 'serialflow'])};
|
||||
my $xcatdport="3001";
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("xcatdport");
|
||||
if ( defined($entries[0])) {
|
||||
$xcatdport = $entries[0];
|
||||
}
|
||||
|
||||
my @entries = xCAT::TableUtils->get_site_attribute("master");
|
||||
my $master_entry = $entries[0];
|
||||
|
||||
require xCAT::Template;
|
||||
|
||||
my $flag_return = 0;
|
||||
# Warning message for nodeset <noderange> install/netboot/statelite
|
||||
foreach my $knode (keys %osents)
|
||||
{
|
||||
my $ent = $osents{$knode}->[0];
|
||||
if ($ent && $ent->{provmethod} && ($ent->{provmethod} eq 'sysclone')){
|
||||
$callback->( { error => ["$knode: The provmethod \"sysclone\" have been deprecated. use \"nodeset <noderange> osimage=<osimage_name>\" instead."],
|
||||
errorcode => [1]});
|
||||
# Do not print this warning message multiple times
|
||||
$flag_return = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if ( $flag_return == 1 ){
|
||||
return;
|
||||
}
|
||||
|
||||
# copy postscripts
|
||||
my $pspath = "$installroot/sysclone/scripts/post-install/";
|
||||
my $clusterfile = "$installroot/sysclone/scripts/cluster.txt";
|
||||
|
||||
mkpath("$pspath");
|
||||
copy("$installroot/postscripts/configefi","$pspath/15all.configefi");
|
||||
copy("$installroot/postscripts/updatenetwork","$pspath/16all.updatenetwork");
|
||||
copy("$installroot/postscripts/runxcatpost","$pspath/17all.runxcatpost");
|
||||
copy("$installroot/postscripts/killsyslog","$pspath/17all.killsyslog");
|
||||
|
||||
unless (-r "$pspath/10all.fix_swap_uuids")
|
||||
{
|
||||
mkpath("$pspath");
|
||||
copy("/var/lib/systemimager/scripts/post-install/10all.fix_swap_uuids","$pspath");
|
||||
}
|
||||
|
||||
unless (-r "$pspath/95all.monitord_rebooted")
|
||||
{
|
||||
mkpath("$pspath");
|
||||
copy("/var/lib/systemimager/scripts/post-install/95all.monitord_rebooted","$pspath");
|
||||
}
|
||||
|
||||
# copy hosts
|
||||
copy("/etc/hosts","$installroot/sysclone/scripts/");
|
||||
|
||||
foreach $node (@nodes)
|
||||
{
|
||||
my $os;
|
||||
my $tftpdir;
|
||||
my $arch;
|
||||
my $imagename; # set it if running of 'nodeset osimage=xxx'
|
||||
my $xcatmaster;
|
||||
my $instserver;
|
||||
|
||||
my $ient = $rents{$node}->[0];
|
||||
if ($ient and $ient->{xcatmaster})
|
||||
{
|
||||
$xcatmaster = $ient->{xcatmaster};
|
||||
} else {
|
||||
$xcatmaster = $master_entry;
|
||||
}
|
||||
|
||||
my $osinst;
|
||||
if ($rents{$node}->[0] and $rents{$node}->[0]->{tftpdir}) {
|
||||
$tftpdir = $rents{$node}->[0]->{tftpdir};
|
||||
} else {
|
||||
$tftpdir = $globaltftpdir;
|
||||
}
|
||||
my $ent = $osents{$node}->[0];
|
||||
if ($ent and $ent->{provmethod} and ($ent->{provmethod} ne 'install') and ($ent->{provmethod} ne 'netboot') and ($ent->{provmethod} ne 'statelite') and ($ent->{provmethod} ne 'sysclone')) {
|
||||
$imagename=$ent->{provmethod};
|
||||
#print "imagename=$imagename\n";
|
||||
if (!exists($img_hash{$imagename})) {
|
||||
if (!$osimagetab) {
|
||||
$osimagetab=xCAT::Table->new('osimage', -create=>1);
|
||||
}
|
||||
(my $ref) = $osimagetab->getAttribs({imagename => $imagename}, 'osvers', 'osarch', 'profile', 'provmethod');
|
||||
if ($ref) {
|
||||
$img_hash{$imagename}->{osarch}=$ref->{'osarch'};
|
||||
} else {
|
||||
$callback->(
|
||||
{error => ["The os image $imagename does not exists on the osimage table for $node"],
|
||||
errorcode => [1]});
|
||||
next;
|
||||
}
|
||||
}
|
||||
my $ph=$img_hash{$imagename};
|
||||
$arch = $ph->{osarch};
|
||||
}
|
||||
|
||||
# copy kernel and initrd from image dir to /tftpboot
|
||||
my $ramdisk_size = 200000;
|
||||
|
||||
if (
|
||||
-r "$tftpdir/xcat/genesis.kernel.$arch"
|
||||
and -r "$tftpdir/xcat/genesis.fs.$arch.gz"
|
||||
)
|
||||
{
|
||||
#We have a shot...
|
||||
my $ent = $rents{$node}->[0];
|
||||
my $sent = $hents{$node}->[0];
|
||||
|
||||
my $kcmdline = "ramdisk_size=$ramdisk_size";
|
||||
my $ksdev = "";
|
||||
if ($ent->{installnic})
|
||||
{
|
||||
$ksdev = $ent->{installnic};
|
||||
}
|
||||
elsif ($ent->{primarynic})
|
||||
{
|
||||
$ksdev = $ent->{primarynic};
|
||||
}
|
||||
else
|
||||
{
|
||||
$ksdev = "bootif"; #if not specified, fall back to bootif
|
||||
}
|
||||
|
||||
if ($ksdev eq "mac")
|
||||
{
|
||||
my $mactab = xCAT::Table->new("mac");
|
||||
my $macref = $mactab->getNodeAttribs($node, ['mac']);
|
||||
$ksdev = $macref->{mac};
|
||||
}
|
||||
|
||||
unless ( $ksdev eq "bootif" ) {
|
||||
$kcmdline .= " netdevice=" . $ksdev;
|
||||
}
|
||||
|
||||
if ($arch =~ /ppc/) {
|
||||
$kcmdline .= " dhcptimeout=150";
|
||||
}
|
||||
|
||||
if (defined($sent->{serialport}))
|
||||
{
|
||||
unless ($sent->{serialspeed})
|
||||
{
|
||||
$callback->( { error => [ "serialport defined, but no serialspeed for $node in nodehm table" ],
|
||||
errorcode => [1] } );
|
||||
}
|
||||
else {
|
||||
#go cmdline if serial console is requested, the shiny ansi is just impractical
|
||||
$kcmdline .= " cmdline console=tty0 console=ttyS"
|
||||
. $sent->{serialport} . ","
|
||||
. $sent->{serialspeed};
|
||||
if ($sent->{serialflow} =~ /(hard|cts|ctsrts)/) {
|
||||
$kcmdline .= "n8r";
|
||||
}
|
||||
}
|
||||
}
|
||||
$kcmdline .= " xcatd=$xcatmaster:$xcatdport SCRIPTNAME=$imagename";
|
||||
|
||||
$bptab->setNodeAttribs(
|
||||
$node,
|
||||
{
|
||||
kernel => "xcat/genesis.kernel.$arch",
|
||||
initrd => "xcat/genesis.fs.$arch.gz",
|
||||
kcmdline => $kcmdline
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$callback->( { error => ["Kernel and initrd not found in $tftpdir/xcat"],
|
||||
errorcode => [1] } );
|
||||
}
|
||||
|
||||
# assign nodes to an image
|
||||
if (-r "$clusterfile")
|
||||
{
|
||||
my $cmd = qq{cat $clusterfile | grep "$node"};
|
||||
my $out = xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC == 0)
|
||||
{
|
||||
my $out = `sed -i /$node./d $clusterfile`;
|
||||
}
|
||||
}
|
||||
|
||||
my $cmd =qq{echo "$node:compute:$imagename:" >> $clusterfile};
|
||||
my $out = xCAT::Utils->runcmd($cmd, -1);
|
||||
|
||||
unless (-r "$installroot/sysclone/images/$imagename/opt/xcat/xcatdsklspost")
|
||||
{
|
||||
mkpath("$installroot/sysclone/images/$imagename/opt/xcat/");
|
||||
copy("$installroot/postscripts/xcatdsklspost","$installroot/sysclone/images/$imagename/opt/xcat/");
|
||||
}
|
||||
}
|
||||
|
||||
# check systemimager-server-rsyncd to make sure it's running.
|
||||
my $out = xCAT::Utils->runcmd("service systemimager-server-rsyncd status", -1);
|
||||
if ($::RUNCMD_RC != 0) { # not running
|
||||
my $rc = xCAT::Utils->startService("systemimager-server-rsyncd");
|
||||
if ($rc != 0) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub copycd
|
||||
{
|
||||
my $request = shift;
|
||||
@ -1670,6 +1938,7 @@ sub insert_dd () {
|
||||
my @rpm_list;
|
||||
my @driver_list;
|
||||
my $Injectalldriver;
|
||||
my $updatealldriver;
|
||||
|
||||
my @rpm_drivers;
|
||||
|
||||
@ -1715,6 +1984,9 @@ sub insert_dd () {
|
||||
if (/^allupdate$/) {
|
||||
$Injectalldriver = 1;
|
||||
next;
|
||||
} elsif (/^updateonly$/) {
|
||||
$updatealldriver = 1;
|
||||
next;
|
||||
}
|
||||
unless (/\.ko$/) {
|
||||
s/$/.ko/;
|
||||
@ -1725,7 +1997,7 @@ sub insert_dd () {
|
||||
chomp(@dd_list);
|
||||
chomp(@rpm_list);
|
||||
|
||||
unless (@dd_list || (@rpm_list && ($Injectalldriver || @driver_list))) {
|
||||
unless (@dd_list || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
|
||||
return ();
|
||||
}
|
||||
|
||||
@ -1738,7 +2010,7 @@ sub insert_dd () {
|
||||
# Unzip the original initrd
|
||||
# This only needs to be done for ppc or handling the driver rpm
|
||||
# For the driver disk against x86, append the driver disk to initrd directly
|
||||
if ($arch =~/ppc/ || (@rpm_list && ($Injectalldriver || @driver_list))) {
|
||||
if ($arch =~/ppc/ || (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list))) {
|
||||
if ($arch =~ /ppc/) {
|
||||
$cmd = "gunzip --quiet -c $pkgdir/1/suseboot/initrd64 > $dd_dir/initrd";
|
||||
} elsif ($arch =~ /x86/) {
|
||||
@ -1763,7 +2035,7 @@ sub insert_dd () {
|
||||
}
|
||||
|
||||
# Start to load the drivers from rpm packages
|
||||
if (@rpm_list && ($Injectalldriver || @driver_list)) {
|
||||
if (@rpm_list && ($Injectalldriver || $updatealldriver || @driver_list)) {
|
||||
# Extract the files from rpm to the tmp dir
|
||||
mkpath "$dd_dir/rpm";
|
||||
my $new_kernel_ver;
|
||||
@ -1785,17 +2057,17 @@ sub insert_dd () {
|
||||
# get the new kernel if it exists in the update distro
|
||||
my @new_kernels = <$dd_dir/rpm/boot/vmlinu*>;
|
||||
foreach my $new_kernel (@new_kernels) {
|
||||
if (-r $new_kernel && $new_kernel =~ /\/vmlinu[zx]-(.*(x86_64|ppc64|default))$/) {
|
||||
$new_kernel_ver = $1;
|
||||
$cmd = "/bin/mv -f $new_kernel $dd_dir/rpm/newkernel";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $dd_dir/rpm/newkernel.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
if (-r $new_kernel && $new_kernel =~ /\/vmlinu[zx]-(.*(x86_64|ppc64|default))$/) {
|
||||
$new_kernel_ver = $1;
|
||||
$cmd = "/bin/mv -f $new_kernel $dd_dir/rpm/newkernel";
|
||||
xCAT::Utils->runcmd($cmd, -1);
|
||||
if ($::RUNCMD_RC != 0) {
|
||||
my $rsp;
|
||||
push @{$rsp->{data}}, "Handle the driver update failed. Could not move $new_kernel to $dd_dir/rpm/newkernel.";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# To skip the conflict of files that some rpm uses the xxx.ko.new as the name of the driver
|
||||
# Change it back to xxx.ko here
|
||||
@ -1842,13 +2114,35 @@ sub insert_dd () {
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
}
|
||||
|
||||
# get the name list for all drivers in the original initrd if 'netdrivers=updateonly'
|
||||
# then only the drivers in this list will be updated from the drvier rpms
|
||||
if ($updatealldriver) {
|
||||
$driver_name = "\*\.ko";
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/initrd_img/lib/modules/*>);
|
||||
foreach my $real_path (@all_real_path) {
|
||||
my $driver = basename($real_path);
|
||||
push @driver_list, $driver;
|
||||
}
|
||||
}
|
||||
|
||||
# Copy the drivers to the rootimage
|
||||
# Figure out the kernel version
|
||||
my @kernelpaths = <$dd_dir/initrd_img/lib/modules/*>;
|
||||
my @kernelvers;
|
||||
if ($new_kernel_ver) {
|
||||
push @kernelvers, $new_kernel_ver;
|
||||
}
|
||||
foreach (@kernelpaths) {
|
||||
push @kernelvers, basename($_);
|
||||
my $kernelv = basename($_);
|
||||
if ($kernelv =~ /^[\d\.]+/) {
|
||||
if ($new_kernel_ver) {
|
||||
rmtree ("$dd_dir/initrd_img/lib/modules/$kernelv");
|
||||
} else {
|
||||
push @kernelvers, $kernelv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach my $kernelver (@kernelvers) {
|
||||
@ -1861,7 +2155,6 @@ sub insert_dd () {
|
||||
$driver_name = $driver;
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
|
||||
#if ($real_path && $real_path =~ m!$dd_dir/rpm(/lib/modules/$kernelver/.*?)[^\/]*$!) {
|
||||
# NOTE: for the initrd of sles that the drivers are put in the /lib/modules/$kernelver/initrd/
|
||||
foreach my $real_path (@all_real_path) {
|
||||
if ($real_path && $real_path =~ m!$dd_dir/rpm/lib/modules/$kernelver/!) {
|
||||
@ -1885,8 +2178,7 @@ sub insert_dd () {
|
||||
$driver_name = "\*\.ko";
|
||||
@all_real_path = ();
|
||||
find(\&get_all_path, <$dd_dir/rpm/lib/modules/$kernelver/*>);
|
||||
foreach $real_path (@all_real_path) {
|
||||
#if ($real_path && $real_path =~ m!$dd_dir/rpm(/lib/modules/$kernelver/.*?)[^\/]*$!) {
|
||||
foreach my $real_path (@all_real_path) {
|
||||
# NOTE: for the initrd of sles that the drivers are put in the /lib/modules/$kernelver/initrd/
|
||||
if ($real_path && $real_path =~ m!$dd_dir/rpm/lib/modules/$kernelver/!) {
|
||||
if (! -d "$dd_dir/initrd_img/lib/modules/$kernelver/initrd") {
|
||||
|
@ -871,6 +871,8 @@ sub process_request {
|
||||
}
|
||||
}
|
||||
}
|
||||
#donot update node provision status (installing or netbooting) here
|
||||
xCAT::Utils->filter_nostatusupdate(\%newnodestatus);
|
||||
#print "newstatus" . Dumper(\%newnodestatus);
|
||||
xCAT_monitoring::monitorctrl::setNodeStatusAttributes(\%newnodestatus, 1);
|
||||
}
|
||||
|
@ -13,6 +13,24 @@ if [ -r /tmp/updates/etc/pki/tls/certs/ca-bundle.crt ]; then
|
||||
cp -f /tmp/updates/etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/
|
||||
fi
|
||||
|
||||
cat >/tmp/baz.py <<EOF
|
||||
#!/usr/bin/python
|
||||
import socket
|
||||
import sys
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.connect(('#XCATVAR:XCATMASTER#',#TABLE:site:key=xcatiport:value#))
|
||||
|
||||
print sys.argv[1]
|
||||
response = sock.recv(100)
|
||||
if(response == "ready\n"):
|
||||
sock.send(sys.argv[1]+"\n")
|
||||
response = sock.recv(100)
|
||||
|
||||
sock.close()
|
||||
EOF
|
||||
|
||||
|
||||
|
||||
cat >/tmp/foo.py <<EOF
|
||||
#!/usr/bin/python
|
||||
@ -123,6 +141,14 @@ finally:
|
||||
EOF
|
||||
|
||||
chmod 755 /tmp/foo.py
|
||||
chmod 755 /tmp/baz.py
|
||||
|
||||
NODESTATUS=#TABLEBLANKOKAY:site:key=nodestatus:value#
|
||||
|
||||
if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then
|
||||
/tmp/baz.py "installstatus installing" &
|
||||
fi
|
||||
|
||||
|
||||
/tmp/foo.py >/foo.log 2>&1 &
|
||||
#time to ascertain fstype and PReP/UEFI/legacy
|
||||
|
@ -14,28 +14,30 @@ cat >/tmp/bar.awk <<EOF
|
||||
#!$AWK -f
|
||||
|
||||
BEGIN {
|
||||
xcatdport = "#TABLE:site:key=xcatiport:value#"
|
||||
xcatdhost = "#XCATVAR:XCATMASTER#"
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
xcatiport = "#TABLE:site:key=xcatiport:value#"
|
||||
xcatdhost = "#XCATVAR:XCATMASTER#"
|
||||
|
||||
print "xCAT_xcatd" |& ns
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
print ARGV[1]
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if(\$0 == "ready")
|
||||
print "installmonitor" |& ns
|
||||
if(\$0 == "done")
|
||||
break
|
||||
}
|
||||
if(\$0 == "ready")
|
||||
print ARGV[1] |& ns
|
||||
if(\$0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
}
|
||||
EOF
|
||||
|
||||
|
||||
if [ ! -c /dev/vcs ]; then
|
||||
mknod /dev/vcs c 7 0
|
||||
fi
|
||||
@ -111,8 +113,17 @@ EOF
|
||||
chmod 755 /tmp/foo.awk
|
||||
chmod 755 /tmp/bar.awk
|
||||
|
||||
/tmp/bar.awk &
|
||||
|
||||
/tmp/bar.awk "installmonitor" &
|
||||
|
||||
NODESTATUS=#TABLEBLANKOKAY:site:key=nodestatus:value#
|
||||
|
||||
if [ -z "$NODESTATUS" ] || [ "$NODESTATUS" != "0" -a "$NODESTATUS" != "N" -a "$NODESTATUS" != "n" ]; then
|
||||
/tmp/bar.awk "installstatus installing" &
|
||||
fi
|
||||
|
||||
/tmp/foo.awk >/tmp/foo.log 2>&1 &
|
||||
|
||||
shopt -s nullglob
|
||||
for disk in /dev/vd*[^0-9];do
|
||||
if [ -z "$firstdirectdisk" ]; then firstdirectdisk=$disk; fi #remember first disk as a guess of medium resort
|
||||
|
@ -63,9 +63,18 @@ cat >/tmp/foo.sh <<EOF
|
||||
if [ \$# -eq 0 ]; then
|
||||
xcatdhost="#XCATVAR:XCATMASTER#"
|
||||
xcatdport="#TABLE:site:key=xcatiport:value#"
|
||||
NODESTATUS="#TABLEBLANKOKAY:site:key=nodestatus:value#"
|
||||
|
||||
|
||||
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh install_monitor &
|
||||
|
||||
if [ -z "\$NODESTATUS" ] || [ "\$NODESTATUS" != "0" -a "\$NODESTATUS" != "N" -a "\$NODESTATUS" != "n" ];
|
||||
then
|
||||
|
||||
/usr/bin/nc "\$xcatdhost" "\$xcatdport" -e /tmp/foo.sh installstatus installing &
|
||||
|
||||
fi
|
||||
|
||||
while true; do
|
||||
/usr/bin/nc -l -p 3001 -e /tmp/foo.sh serve_client
|
||||
done
|
||||
@ -92,6 +101,26 @@ if [ "\$1" = "install_monitor" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#
|
||||
# If the script was called with the "installstatus" argument, stdin and stdout are
|
||||
# connected to an xCAT daemon on the master.
|
||||
# Write the "installstatus xx" request to the daemon to update thenode installation status.
|
||||
if [ "\$1" = "installstatus" ]; then
|
||||
cmd=""
|
||||
while [ "\$cmd" != "done" ]; do
|
||||
read cmd remainder
|
||||
|
||||
if [ "\$cmd" == "ready" ]; then
|
||||
echo "installstatus \$2"
|
||||
fi
|
||||
done
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
#
|
||||
# When execution reaches here, script called with "serve_client" argument, which means
|
||||
# stdin and stdout are connected to a client. Read the request from the client, provide
|
||||
|
10
xCAT-server/share/xcat/install/ubuntu/kvm.pkglist
Normal file
10
xCAT-server/share/xcat/install/ubuntu/kvm.pkglist
Normal file
@ -0,0 +1,10 @@
|
||||
openssh-server
|
||||
ntp
|
||||
gawk
|
||||
nfs-common
|
||||
snmpd
|
||||
qemu-kvm
|
||||
libvirt-bin
|
||||
bridge-utils
|
||||
libcap2-bin
|
||||
vlan
|
114
xCAT-server/share/xcat/install/ubuntu/kvm.tmpl
Normal file
114
xCAT-server/share/xcat/install/ubuntu/kvm.tmpl
Normal file
@ -0,0 +1,114 @@
|
||||
|
||||
### Localization
|
||||
d-i debian-installer/locale string en_US
|
||||
d-i localechooser/supported-locales multiselect en_US.UTF-8
|
||||
|
||||
# Keyboard Selection
|
||||
d-i console-setup/ask_detect boolean false
|
||||
d-i console-setup/layoutcode string en
|
||||
|
||||
### Network Configuration
|
||||
|
||||
d-i netcfg/get_hostname string unassigned-hostname
|
||||
d-i netcfg/get_domain string unassigned-domain
|
||||
d-i netcfg/wireless_wep string
|
||||
|
||||
### Mirror settings
|
||||
# If you select ftp, the mirror/country string does not need to be set.
|
||||
|
||||
d-i mirror/country string manual
|
||||
d-i mirror/protocol string http
|
||||
d-i mirror/http/directory string /install/#TABLE:nodetype:$NODE:os#/#TABLE:nodetype:$NODE:arch#
|
||||
d-i mirror/http/proxy string
|
||||
|
||||
# Suite to install.
|
||||
#d-i mirror/suite string testing
|
||||
# Suite to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/suite string testing
|
||||
|
||||
|
||||
### Partitioning
|
||||
# This creates a small /boot partition, suitable
|
||||
# swap, and uses the rest of the space for the root partition:
|
||||
|
||||
d-i partman-auto/method string regular
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
|
||||
#create the /tmp/partitioning based on the uefi or legacy bios
|
||||
d-i partman-auto/expert_recipe_file string /tmp/partitioning
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
|
||||
d-i partman/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
|
||||
### Account setup
|
||||
|
||||
d-i passwd/root-login boolean true
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
d-i passwd/root-password-crypted password #CRYPT:passwd:key=system,username=root:password#
|
||||
|
||||
### Clock and time zone setup
|
||||
|
||||
d-i clock-setup/ntp boolean true
|
||||
d-i clock-setup/ntp-server string #TABLE:site:key=master:value#
|
||||
d-i clock-setup/utc boolean true
|
||||
d-i time/zone string #TABLE:site:key=timezone:value#
|
||||
|
||||
### Apt setup
|
||||
|
||||
d-i apt-setup/multiverse boolean false
|
||||
d-i apt-setup/universe boolean false
|
||||
d-i apt-setup/backports boolean false
|
||||
d-i apt-setup/updates boolean false
|
||||
|
||||
|
||||
### Boot loader installation
|
||||
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
### Package selection
|
||||
|
||||
tasksel tasksel/first multiselect standard
|
||||
|
||||
# gawk required for the xCAT scripts to work
|
||||
# Otherwise it installs mawk, which doesn't work
|
||||
|
||||
d-i pkgsel/include string #INCLUDE_DEFAULT_PKGLIST_PRESEED#
|
||||
|
||||
d-i debian-installer/allow_unauthenticated string true
|
||||
d-i pkgsel/update-policy select none
|
||||
d-i pkgsel/updatedb boolean false
|
||||
|
||||
### Finishing up the installation
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
### X configuration
|
||||
xserver-xorg xserver-xorg/autodetect_monitor boolean true
|
||||
|
||||
xserver-xorg xserver-xorg/config/monitor/selection-method \
|
||||
select medium
|
||||
|
||||
xserver-xorg xserver-xorg/config/monitor/mode-list \
|
||||
select 1024x768 @ 60 Hz
|
||||
|
||||
|
||||
d-i preseed/early_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.pre; \
|
||||
chmod u+x #HOSTNAME#.pre; \
|
||||
./#HOSTNAME#.pre
|
||||
|
||||
d-i preseed/late_command string wget http://`cat /tmp/xcatserver`/install/autoinst/#HOSTNAME#.post; \
|
||||
chmod u+x #HOSTNAME#.post; \
|
||||
cp ./#HOSTNAME#.post /target/root/post.script; \
|
||||
mount -o bind /proc /target/proc -t proc; \
|
||||
mount -o bind /dev /target/dev; \
|
||||
mount -o bind /dev/pts /target/dev/pts -t devpts; \
|
||||
mount -o bind /sys /target/sys; \
|
||||
chroot /target /root/post.script
|
||||
|
1
xCAT-server/share/xcat/netboot/fedora/dracut/xcat-premount.sh
Symbolic link
1
xCAT-server/share/xcat/netboot/fedora/dracut/xcat-premount.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../../rh/dracut/xcat-premount.sh
|
1
xCAT-server/share/xcat/netboot/fedora/dracut/xcat-updateflag
Symbolic link
1
xCAT-server/share/xcat/netboot/fedora/dracut/xcat-updateflag
Symbolic link
@ -0,0 +1 @@
|
||||
../../rh/dracut/xcat-updateflag
|
@ -0,0 +1 @@
|
||||
../../rh/dracut/xcat-premount.sh
|
@ -68,6 +68,8 @@ if [ ! -z $SNAPSHOTSERVER ]; then
|
||||
fi
|
||||
|
||||
# TODO: handle the dhclient/resolv.conf/ntp, etc
|
||||
echo "Get to enable localdisk"
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
$NEWROOT/etc/init.d/statelite
|
||||
READONLY=yes
|
||||
export READONLY
|
||||
|
1
xCAT-server/share/xcat/netboot/fedora/dracut_009/xcat-updateflag
Symbolic link
1
xCAT-server/share/xcat/netboot/fedora/dracut_009/xcat-updateflag
Symbolic link
@ -0,0 +1 @@
|
||||
../../rh/dracut/xcat-updateflag
|
@ -3,6 +3,24 @@ NEWROOT=$3
|
||||
RWDIR=.statelite
|
||||
XCATMASTER=$XCAT
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
rootlimit="$(getarg rootlimit=)"
|
||||
|
||||
|
||||
getarg nonodestatus
|
||||
NODESTATUS=$?
|
||||
|
||||
MASTER=`echo $XCATMASTER |awk -F: '{print $1}'`
|
||||
XCATIPORT="$(getarg XCATIPORT=)"
|
||||
if [ $? -ne 0 ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
|
||||
if [ $NODESTATUS -ne 0 ];then
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
if [ ! -z "$imgurl" ]; then
|
||||
if [ xhttp = x${imgurl%%:*} ]; then
|
||||
NFS=0
|
||||
@ -41,7 +59,12 @@ if [ -r /rootimg.sfs ]; then
|
||||
mount --move /rw $NEWROOT/rw
|
||||
elif [ -r /rootimg.gz ]; then
|
||||
echo Setting up RAM-root tmpfs.
|
||||
mount -t tmpfs rootfs $NEWROOT
|
||||
if [ -z $rootlimit ];then
|
||||
mount -t tmpfs -o mode=755 rootfs $NEWROOT
|
||||
else
|
||||
mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT
|
||||
fi
|
||||
|
||||
cd $NEWROOT
|
||||
echo -n "Extracting root filesystem:"
|
||||
if [ -x /bin/cpio ]; then
|
||||
@ -49,10 +72,17 @@ elif [ -r /rootimg.gz ]; then
|
||||
else
|
||||
gzip -cd /rootimg.gz |cpio -idum
|
||||
fi
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
echo Done
|
||||
elif [ -r /rootimg-statelite.gz ]; then
|
||||
echo Setting up RAM-root tmpfs for statelite mode.
|
||||
mount -t tmpfs rootfs $NEWROOT
|
||||
|
||||
if [ -z $rootlimit];then
|
||||
mount -t tmpfs -o mode=755 rootfs $NEWROOT
|
||||
else
|
||||
mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT
|
||||
fi
|
||||
|
||||
cd $NEWROOT
|
||||
echo -n "Extracting root filesystem:"
|
||||
if [ -x /bin/cpio ]; then
|
||||
@ -99,7 +129,8 @@ elif [ -r /rootimg-statelite.gz ]; then
|
||||
MAXTRIES=5
|
||||
ITER=0
|
||||
if [ -z $MNTOPTS ]; then
|
||||
MNT_OPTIONS="nolock,rsize=32768,tcp,timeo=14"
|
||||
MNT_OPTIONS="nolock,rsize=32768,tcp,timeo=14"
|
||||
|
||||
else
|
||||
MNT_OPTIONS=$MNTOPTS
|
||||
fi
|
||||
@ -119,6 +150,7 @@ elif [ -r /rootimg-statelite.gz ]; then
|
||||
done
|
||||
fi
|
||||
|
||||
$NEWROOT/etc/init.d/localdisk
|
||||
$NEWROOT/etc/init.d/statelite
|
||||
fastboot=yes
|
||||
export fastboot
|
||||
|
@ -4,5 +4,6 @@ dracut_install wget cpio gzip dash modprobe touch echo cut wc
|
||||
dracut_install grep ifconfig hostname awk egrep grep dirname expr
|
||||
dracut_install mount.nfs
|
||||
dracut_install parted mke2fs bc mkswap swapon chmod
|
||||
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
|
||||
inst "$moddir/xcatroot" "/sbin/xcatroot"
|
||||
inst_hook cmdline 10 "$moddir/xcat-cmdline.sh"
|
||||
|
@ -3,4 +3,6 @@ echo $drivers
|
||||
dracut_install wget cpio gzip dash modprobe wc touch echo cut
|
||||
dracut_install grep ifconfig hostname awk egrep grep dirname expr
|
||||
dracut_install parted mke2fs bc mkswap swapon chmod
|
||||
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
|
||||
inst_hook pre-mount 5 "$moddir/xcat-premount.sh"
|
||||
inst_hook pre-pivot 5 "$moddir/xcat-prepivot.sh"
|
||||
|
18
xCAT-server/share/xcat/netboot/rh/dracut/xcat-premount.sh
Normal file
18
xCAT-server/share/xcat/netboot/rh/dracut/xcat-premount.sh
Normal file
@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
#script to update nodelist.nodestatus during provision
|
||||
|
||||
MASTER=`echo $XCAT |awk -F: '{print $1}'`
|
||||
|
||||
getarg nonodestatus
|
||||
NODESTATUS=$?
|
||||
|
||||
XCATIPORT="$(getarg XCATIPORT=)"
|
||||
if [ $? -ne 0 ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ $NODESTATUS -ne 0 ];then
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
24
xCAT-server/share/xcat/netboot/rh/dracut/xcat-updateflag
Executable file
24
xCAT-server/share/xcat/netboot/rh/dracut/xcat-updateflag
Executable file
@ -0,0 +1,24 @@
|
||||
#!/bin/awk -f
|
||||
#script to feedback the node provision status to xcatd
|
||||
BEGIN {
|
||||
|
||||
xcatdhost = ARGV[1]
|
||||
xcatiport = ARGV[2]
|
||||
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if($0 == "ready")
|
||||
print ARGV[3] |& ns
|
||||
if($0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
@ -5,6 +5,22 @@ XCATMASTER=$XCAT
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
rootlimit="$(getarg rootlimit=)"
|
||||
|
||||
|
||||
getarg nonodestatus
|
||||
NODESTATUS=$?
|
||||
|
||||
MASTER=`echo $XCATMASTER |awk -F: '{print $1}'`
|
||||
XCATIPORT="$(getarg XCATIPORT=)"
|
||||
if [ $? -ne 0 ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
|
||||
if [ $NODESTATUS -ne 0 ];then
|
||||
/tmp/updateflag $MASTER $XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
if [ ! -z "$imgurl" ]; then
|
||||
if [ xhttp = x${imgurl%%:*} ]; then
|
||||
NFS=0
|
||||
|
@ -538,6 +538,7 @@ if (-d "$rootimg_dir/usr/share/dracut") {
|
||||
print "Enter the dracut mode. Dracut version: $dracutver. Dracut directory: $dracutdir.\n";
|
||||
}
|
||||
|
||||
|
||||
#-- for centos, disable the internet repository
|
||||
if( -e "$rootimg_dir/etc/yum.repos.d/CentOS-Base.repo" ) {
|
||||
my $repo_content=`sed -e '/enabled/d' $rootimg_dir/etc/yum.repos.d/CentOS-Base.repo | sed -e '/^gpgkey/i enabled=0'`;
|
||||
@ -778,11 +779,19 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/install.statelite"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/install");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-updateflag",$dracutmpath);
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-updateflag"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-updateflag");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-prepivot.sh",$dracutmpath);
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-prepivot.sh"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-prepivot.sh");
|
||||
|
||||
# update etc/dracut.conf
|
||||
cp("$fullpath/$dracutdir/xcat-premount.sh",$dracutmpath);
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-premount.sh"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-premount.sh");
|
||||
|
||||
#update etc/dracut.conf
|
||||
open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf");
|
||||
if (-d glob("$rootimg_dir/usr/share/dracut/modules.d/[0-9]*fadump")){
|
||||
print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules fadump"\n};
|
||||
@ -802,6 +811,10 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-cmdline.sh"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-cmdline.sh");
|
||||
|
||||
cp("$fullpath/$dracutdir/xcat-updateflag",$dracutmpath);
|
||||
$perm = (stat("$fullpath/$dracutdir/xcat-updateflag"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/xcat-updateflag");
|
||||
|
||||
if ($prinic) {
|
||||
my $optspec;
|
||||
open($optspec,'>>',"$dracutmpath/xcat-cmdline.sh");
|
||||
@ -1058,6 +1071,7 @@ grep '\(debug\)' /proc/cmdline > /dev/null && export DEBUG=1
|
||||
# TODO: does "anaconda.busybox sh" support "set " ?
|
||||
|
||||
PRINIC=$prinic
|
||||
NODESTATUS='y'
|
||||
|
||||
for i in `cat /proc/cmdline`; do
|
||||
KEY=`echo \$i |awk -F= '{print \$1}'`
|
||||
@ -1070,6 +1084,14 @@ for i in `cat /proc/cmdline`; do
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
# format: XCAT=xcatmaster:3001
|
||||
XCATSERVER=\$VALUE
|
||||
elif [ "\$KEY" == 'XCATIPORT' ]; then
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
# format: XCAT=xcatmaster:3001
|
||||
XCATIPORT=\$VALUE
|
||||
fi
|
||||
#if "nonodestatus" specified,do not update the nodestatus
|
||||
if [ \$i == 'nonodestatus' ]; then
|
||||
NODESTATUS='n'
|
||||
fi
|
||||
done
|
||||
|
||||
@ -1098,6 +1120,18 @@ while ! ifconfig | grep inet; do
|
||||
done
|
||||
ifconfig lo 127.0.0.1
|
||||
ifconfig lo up
|
||||
|
||||
XCATMASTER=`echo \$XCATSERVER|awk -F: '{print \$1}'`
|
||||
|
||||
if [ -z \$XCATIPORT ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
#update nodelist.nodestatus to "netbooting"
|
||||
if [ \$NODESTATUS != 'n' ]; then
|
||||
/tmp/updateflag \$XCATMASTER \$XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
cd /
|
||||
for i in `cat /proc/cmdline`; do
|
||||
KEY=`echo \$i |awk -F= '{print \$1}'`
|
||||
@ -1144,6 +1178,10 @@ for i in `cat /proc/cmdline`; do
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# show xCAT logo
|
||||
fancydisplay
|
||||
|
||||
@ -1353,8 +1391,38 @@ EOMS
|
||||
open($inifile,">"."/tmp/xcatinitrd.$$/bin/netstart");
|
||||
print $inifile "#!/sbin/nash\n";
|
||||
close($inifile);
|
||||
|
||||
#/tmp/updateflag: a script to feedback node provision status to xcatd
|
||||
system("mkdir -p /tmp/xcatinitrd.$$/tmp/");
|
||||
open($inifile, ">","/tmp/xcatinitrd.$$/tmp/updateflag");
|
||||
|
||||
print $inifile <<EOMS;
|
||||
#!/bin/sh
|
||||
if [ \$# -eq 3 ]; then
|
||||
echo \$3 > /tmp/ncarg
|
||||
nc \$1 \$2 -w 60 -e /tmp/updateflag
|
||||
else
|
||||
retrytimes=0
|
||||
cmd=""
|
||||
while [ "\$cmd" != "done" ]; do
|
||||
retrytimes=`expr \$retrytimes + 1`
|
||||
if [ \$retrytimes -eq 60 ]; then
|
||||
break;
|
||||
fi
|
||||
read -t 60 cmd
|
||||
if [ "\$cmd" == "ready" ]; then
|
||||
head -n 1 /tmp/ncarg
|
||||
rm -rf /tmp/ncarg
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
EOMS
|
||||
close($inifile);
|
||||
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/init");
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/bin/netstart");
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/tmp/updateflag");
|
||||
@filestoadd=();
|
||||
foreach (@ndrivers) {
|
||||
if (-f "$customdir/$_") {
|
||||
|
@ -472,7 +472,7 @@ unless ($onlyinitrd) {
|
||||
}
|
||||
}
|
||||
|
||||
foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) {
|
||||
foreach $pass (sort {$a <=> $b} (keys(%extra_hash))) {
|
||||
|
||||
my $index=1;
|
||||
#remove the old repository for extra packages
|
||||
@ -1032,6 +1032,7 @@ EOMS
|
||||
# check the kernel parameters firstly
|
||||
# if one parameter for the booting device is here, it will be used
|
||||
PRINIC=$prinic
|
||||
NODESTATUS='y'
|
||||
XCATMNTOPTS='nolock,tcp'
|
||||
for i in `cat /proc/cmdline`; do
|
||||
KEY=`echo \$i |awk -F= '{print \$1}'`
|
||||
@ -1050,6 +1051,11 @@ for i in `cat /proc/cmdline`; do
|
||||
XCATMNTOPTS=\$VALUE
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [ \$i == 'nonodestatus' ]; then
|
||||
NODESTATUS='n'
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "\$IFACE" ]; then
|
||||
@ -1083,6 +1089,18 @@ echo "STARTMODE=nfsroot" > /tmp/ifcfg-\$IFACE
|
||||
|
||||
ip addr add dev lo 127.0.0.1/8
|
||||
ip link set lo up
|
||||
|
||||
|
||||
XCATMASTER=`echo \$XCATSERVER|awk -F: '{print \$1}'`
|
||||
|
||||
if [ -z \$XCATIPORT ]; then
|
||||
XCATIPORT="3002"
|
||||
fi
|
||||
|
||||
if [ \$NODESTATUS != 'n' ]; then
|
||||
/tmp/updateflag \$XCATMASTER \$XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
cd /
|
||||
for i in `cat /proc/cmdline`; do
|
||||
KEY=`echo \$i |awk -F= '{print \$1}'`
|
||||
@ -1373,8 +1391,43 @@ cat /var/lib/dhcpcd/*info | grep HOSTNAME | uniq | awk -F= '{print \$2}'| sed \"
|
||||
END
|
||||
|
||||
close($inifile);
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/init");
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/bin/netstart");
|
||||
|
||||
#if "nonodestatus" specified,do not update the nodestatus
|
||||
system("mkdir -p /tmp/xcatinitrd.$$/tmp/");
|
||||
open($inifile, ">","/tmp/xcatinitrd.$$/tmp/updateflag");
|
||||
|
||||
print $inifile <<EOMS;
|
||||
#!/usr/bin/awk -f
|
||||
BEGIN {
|
||||
|
||||
xcatdhost = ARGV[1]
|
||||
xcatiport = ARGV[2]
|
||||
|
||||
|
||||
ns = "/inet/tcp/0/" xcatdhost "/" xcatiport
|
||||
print "xCAT_xcatd" |& ns
|
||||
|
||||
while(1) {
|
||||
ns |& getline
|
||||
|
||||
if(\$0 == "ready")
|
||||
print ARGV[3] |& ns
|
||||
if(\$0 == "done")
|
||||
break
|
||||
}
|
||||
|
||||
close(ns)
|
||||
|
||||
exit 0
|
||||
}
|
||||
|
||||
EOMS
|
||||
|
||||
close($inifile);
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/init");
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/bin/netstart");
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/tmp/updateflag");
|
||||
|
||||
@filestoadd=();
|
||||
foreach (@ndrivers) {
|
||||
if (-f "$customdir/$_") {
|
||||
|
@ -263,7 +263,7 @@ unless ($onlyinitrd) {
|
||||
my %pkg_hash=imgutils::get_package_names($pkglist);
|
||||
my $index=1;
|
||||
my $pass;
|
||||
foreach $pass (sort {$a <=> $b} (keys(%pkg_hash))) {
|
||||
foreach $pass (sort {$a <=> $b} (keys(%pkg_hash))) {
|
||||
my $pkgnames = "";
|
||||
foreach (keys(%{$pkg_hash{$pass}})) {
|
||||
if (($_ eq "PRE_REMOVE") || ($_ eq "POST_REMOVE") || ($_ eq "ENVLIST")) { next;}
|
||||
@ -959,6 +959,8 @@ grep '\(debug\)' /proc/cmdline > /dev/null && export DEBUG=1
|
||||
# TODO: does "anaconda.busybox sh" support "set " ?
|
||||
|
||||
PRINIC=$prinic
|
||||
NODESTATUS='y'
|
||||
XCATIPORT="3002"
|
||||
|
||||
for i in `cat /proc/cmdline`; do
|
||||
KEY=`echo \$i |awk -F= '{print \$1}'`
|
||||
@ -971,7 +973,17 @@ for i in `cat /proc/cmdline`; do
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
# format: XCAT=xcatmaster:3001
|
||||
XCATSERVER=\$VALUE
|
||||
elif [ "\$KEY" == 'XCATIPORT' ]; then
|
||||
VALUE=`echo \$i |awk -F= '{print \$2}'`
|
||||
# format: XCAT=xcatmaster:3001
|
||||
XCATIPORT=\$VALUE
|
||||
fi
|
||||
|
||||
#if "nonodestatus" specified,do not update the nodestatus
|
||||
if [ \$i == 'nonodestatus' ]; then
|
||||
NODESTATUS='n'
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ -z "\$IFACE" ]; then
|
||||
@ -998,6 +1010,16 @@ while ! ifconfig | grep 'inet addr'; do
|
||||
done
|
||||
ifconfig lo 127.0.0.1
|
||||
ifconfig lo up
|
||||
|
||||
|
||||
XCATMASTER=`echo \$XCATSERVER|awk -F: '{print \$1}'`
|
||||
|
||||
|
||||
#update nodelist.nodestatus to "netbooting"
|
||||
if [ \$NODESTATUS != 'n' ]; then
|
||||
/tmp/updateflag \$XCATMASTER \$XCATIPORT "installstatus netbooting"
|
||||
fi
|
||||
|
||||
cd /
|
||||
for i in `cat /proc/cmdline`; do
|
||||
KEY=`echo \$i |awk -F= '{print \$1}'`
|
||||
@ -1309,10 +1331,40 @@ exit 0
|
||||
EOF
|
||||
|
||||
close($inifile);
|
||||
|
||||
#if "nonodestatus" specified,do not update the nodestatus
|
||||
system("mkdir -p /tmp/xcatinitrd.$$/tmp/");
|
||||
open($inifile, ">","/tmp/xcatinitrd.$$/tmp/updateflag");
|
||||
|
||||
print $inifile <<EOMS;
|
||||
#!/bin/sh
|
||||
if [ \$# -eq 3 ]; then
|
||||
echo \$3 > /tmp/ncarg
|
||||
nc \$1 \$2 -w 60 -e /tmp/updateflag
|
||||
else
|
||||
retrytimes=0
|
||||
cmd=""
|
||||
while [ "\$cmd" != "done" ]; do
|
||||
retrytimes=`expr \$retrytimes + 1`
|
||||
if [ \$retrytimes -eq 60 ]; then
|
||||
break;
|
||||
fi
|
||||
read -t 60 cmd
|
||||
if [ "\$cmd" == "ready" ]; then
|
||||
head -n 1 /tmp/ncarg
|
||||
rm -rf /tmp/ncarg
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
EOMS
|
||||
close($inifile);
|
||||
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/usr/share/udhcpc/default.script");
|
||||
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/init");
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/bin/netstart");
|
||||
chmod(0755,"/tmp/xcatinitrd.$$/tmp/updateflag");
|
||||
@filestoadd=();
|
||||
foreach (@ndrivers) {
|
||||
if (-f "$customdir/$_") {
|
||||
|
@ -88,7 +88,13 @@ my $sock = IO::Socket::INET->new(Proto => 'udp',
|
||||
#LocalAddr => 0,
|
||||
LocalAddr => $IP,
|
||||
LocalPort => '68',
|
||||
PeerAddr => inet_ntoa(INADDR_BROADCAST)) or die "Create socket error: $@\n";
|
||||
PeerAddr => inet_ntoa(INADDR_BROADCAST));
|
||||
|
||||
unless ($sock) {
|
||||
print "Create socket error: $@\n";
|
||||
kill_child();
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $timeout = 10;
|
||||
if ($::TIMEOUT) {
|
||||
@ -104,6 +110,8 @@ while ($end - $start <= $timeout) {
|
||||
$end =~ s/(\d.*)\.(\d.*)/$1/;
|
||||
}
|
||||
|
||||
|
||||
kill_child();
|
||||
#kill the child process
|
||||
kill 15, $pid;
|
||||
my @pidoftcpdump = `ps -ef | grep -E "[0-9]+:[0-9]+:[0-9]+ tcpdump -i $IF" | awk -F' ' '{print \$2}'`;
|
||||
@ -297,4 +305,11 @@ sub packdhcppkg{
|
||||
return $package;
|
||||
}
|
||||
|
||||
|
||||
sub kill_child {
|
||||
kill 15, $pid;
|
||||
my @pidoftcpdump = `ps -ef | grep -E "[0-9]+:[0-9]+:[0-9]+ tcpdump -i $IF" | awk -F' ' '{print \$2}'`;
|
||||
foreach my $cpid (@pidoftcpdump) {
|
||||
kill 15, $cpid;
|
||||
#print "try to kill $cpid\n";
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,45 @@
|
||||
echo "Setting Boot Manager for the next boot."
|
||||
efibootmgr -c -l \\EFI\\redhat\\grub.efi -L Linux
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo "Setting Boot Manager for the next boot."
|
||||
efibootmgr -c -l \\EFI\\redhat\\grub.efi -L Linux
|
||||
else
|
||||
echo "run grub-install to configure the MBR."
|
||||
if [ -e /etc/mtab ];then
|
||||
mv /etc/mtab /etc/mtab.bak
|
||||
fi
|
||||
grep -v rootfs /proc/mounts > /etc/mtab
|
||||
boot_device=''
|
||||
if [ -f "/etc/systemconfig/systemconfig.conf" ];then
|
||||
boot_device=`cat /etc/systemconfig/systemconfig.conf | grep BOOTDEV | awk '{print $3}'`
|
||||
else
|
||||
str_temp=`mount | awk '{print $1","$3}'`
|
||||
for line in $str_temp
|
||||
do
|
||||
mp=`echo $line | awk -F, '{print $2}'`
|
||||
if [ "$mp" = "/" ];then
|
||||
boot_device=`echo $line | awk -F, '{print $1}' | sed -e 's/[0-9]*$//'`
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$boot_device" ];then
|
||||
echo "the boot device is $boot_device"
|
||||
else
|
||||
echo "Can not find the boot device, return error"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#for sles10, should run grub-install with parameters
|
||||
echo "grub-install --no-floppy --recheck $boot_device"
|
||||
grub-install --no-floppy --recheck $boot_device
|
||||
if [ $? -ne 0 ];then
|
||||
#sles11, run grub install directly
|
||||
grub-install
|
||||
fi
|
||||
|
||||
if [ -e /etc/mtab.bak ];then
|
||||
mv -f /etc/mtab.bak /etc/mtab
|
||||
else
|
||||
rm -f /etc/mtab
|
||||
fi
|
||||
fi
|
||||
|
7
xCAT/postscripts/killsyslog
Executable file
7
xCAT/postscripts/killsyslog
Executable file
@ -0,0 +1,7 @@
|
||||
if [ -f "/etc/SuSE-release" ];then
|
||||
str_out=`ps -ef | grep -v grep | grep syslog-ng`
|
||||
if [ $? -eq 0 ];then
|
||||
str_id=`echo $str_out | awk '{print $2}'`
|
||||
kill -9 $str_id
|
||||
fi
|
||||
fi
|
@ -1 +1,9 @@
|
||||
/opt/xcat/xcatdsklspost
|
||||
#!/bin/bash
|
||||
/opt/xcat/xcatdsklspost
|
||||
|
||||
. /tmp/post-install/variables.txt
|
||||
|
||||
if [ -x "/xcatpost/updateflag.awk" ];then
|
||||
/xcatpost/updateflag.awk $IMAGESERVER 3002
|
||||
fi
|
||||
|
||||
|
@ -1,17 +1,35 @@
|
||||
#!/bin/bash
|
||||
. /tmp/post-install/variables.txt
|
||||
|
||||
echo "Updating hostname to $HOSTNAME"
|
||||
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
|
||||
#delete the udev rule in the image
|
||||
rule_file=`ls /etc/udev/rules.d/*net_persistent_names.rules`
|
||||
if [ -n "$rule_file" ];then
|
||||
rm -f $rule_file
|
||||
fi
|
||||
|
||||
hostname $HOSTNAME
|
||||
|
||||
str_cfg_file=''
|
||||
if [ -d "/etc/sysconfig/network-scripts/" ];then
|
||||
#redhat
|
||||
str_cfg_file="/etc/sysconfig/network-scripts/ifcfg-$DEVICE"
|
||||
sed -i "s/HOSTNAME=.*/HOSTNAME=$HOSTNAME/g" /etc/sysconfig/network
|
||||
elif [ -d "/etc/sysconfig/network/" ];then
|
||||
#suse
|
||||
str_cfg_file="/etc/sysconfig/network/ifcfg-$DEVICE"
|
||||
echo "$HOSTNAME" > /etc/HOSTNAME
|
||||
else
|
||||
#ubuntu
|
||||
str_cfg_file="/etc/network/interfaces.d/$DEVICE"
|
||||
echo "$HOSTNAME" > /etc/hostname
|
||||
fi
|
||||
|
||||
echo "Old ifcfg-$DEVICE is:"
|
||||
cat /etc/sysconfig/network-scripts/ifcfg-$DEVICE
|
||||
cat $str_cfg_file
|
||||
|
||||
HWADDR=`ifconfig $DEVICE|grep HWaddr|awk '{print $5}'`
|
||||
sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" /etc/sysconfig/network-scripts/ifcfg-$DEVICE
|
||||
sed -i "s/UUID=.*//g" /etc/sysconfig/network-scripts/ifcfg-$DEVICE
|
||||
sed -i "s/HWADDR=.*/HWADDR="$HWADDR"/g" $str_cfg_file
|
||||
sed -i "s/UUID=.*//g" $str_cfg_file
|
||||
|
||||
echo "New ifcfg-$DEVICE is:"
|
||||
cat /etc/sysconfig/network-scripts/ifcfg-$DEVICE
|
||||
cat $str_cfg_file
|
||||
|
@ -24,8 +24,7 @@ while ! grep 'resourcerequest: ok' /tmp/goahead.$parpid > /dev/null; do
|
||||
done
|
||||
sleeper=$(cat /tmp/sleeperpid.$parpid)
|
||||
sleeper=$(ps -ef|awk "\$3==$sleeper"|awk '{print $2}')
|
||||
kill -TERM $sleeper
|
||||
rm /tmp/goahead.$parpid
|
||||
rm /tmp/sleeperpid.$parpid
|
||||
rm /tmp/killme.$parpid
|
||||
|
||||
kill -TERM $sleeper
|
||||
|
@ -1,17 +1,73 @@
|
||||
function hashencode(){
|
||||
local map="$1"
|
||||
echo `echo $map | sed 's/\./xDOTx/g' | sed 's/:/xCOLONx/g' | sed 's/,/:xCOMMAx/g'`
|
||||
local str_map="$1"
|
||||
echo `echo $str_map | sed 's/\./xDOTx/g' | sed 's/:/xCOLONx/g' | sed 's/,/:xCOMMAx/g'`
|
||||
}
|
||||
|
||||
function hashset(){
|
||||
local hashname="hash${1}${2}"
|
||||
local value=$3
|
||||
hashname=$(hashencode $hashname)
|
||||
eval "${hashname}='${value}'"
|
||||
local str_hashname="hash${1}${2}"
|
||||
local str_value=$3
|
||||
str_hashname=$(hashencode $str_hashname)
|
||||
eval "${str_hashname}='${str_value}'"
|
||||
}
|
||||
|
||||
function hashget(){
|
||||
local hashname="hash${1}${2}"
|
||||
hashname=$(hashencode $hashname)
|
||||
eval echo "\$${hashname}"
|
||||
local str_hashname="hash${1}${2}"
|
||||
str_hashname=$(hashencode $str_hashname)
|
||||
eval echo "\$${str_hashname}"
|
||||
}
|
||||
|
||||
function debianpreconf(){
|
||||
#create the config sub dir
|
||||
if [ ! -d "/etc/network/interfaces.d" ];then
|
||||
mkdir -p "/etc/network/interfaces.d"
|
||||
fi
|
||||
#search xcat flag
|
||||
`grep "#XCAT_CONFIG" /etc/network/interfaces`
|
||||
if [ $? -eq 0 ];then
|
||||
return
|
||||
fi
|
||||
|
||||
#back up the old interface configure
|
||||
if [ ! -e "/etc/network/interfaces.bak" ];then
|
||||
mv /etc/network/interfaces /etc/network/interfaces.bak
|
||||
fi
|
||||
|
||||
#create the new config file
|
||||
echo "#XCAT_CONFIG" > /etc/network/interfaces
|
||||
echo "source /etc/network/interfaces.d/*" >> /etc/network/interfaces
|
||||
|
||||
local str_conf_file=''
|
||||
|
||||
#read the backfile
|
||||
cat /etc/network/interfaces.bak | while read str_line
|
||||
do
|
||||
if [ ! "$str_line" ];then
|
||||
continue
|
||||
fi
|
||||
local str_first_char=${str_line:0:1}
|
||||
if [ $str_first_char = '#' ];then
|
||||
continue
|
||||
fi
|
||||
|
||||
local str_conf_type=`echo $str_line | cut -d" " -f1`
|
||||
if [ $str_conf_type = 'auto' -o $str_conf_type = 'allow-hotplug' ];then
|
||||
str_line=${str_line#$str_conf_type}
|
||||
for str_nic_name in $str_line; do
|
||||
echo "$str_conf_type $str_nic_name" > "/etc/network/interfaces.d/$str_nic_name"
|
||||
done
|
||||
elif [ $str_conf_type = 'iface' -o $str_conf_type = 'mapping' ];then
|
||||
#find out the nic name, should think about the eth0:1
|
||||
str_nic_name=`echo $str_line | cut -d" " -f 2 | cut -d":" -f 1`
|
||||
str_conf_file="/etc/network/interfaces.d/$str_nic_name"
|
||||
if [ ! -e $str_conf_file ];then
|
||||
echo "auto $str_nic_name" > $str_conf_file
|
||||
fi
|
||||
|
||||
#write lines into the conffile
|
||||
echo $str_line >> $str_conf_file
|
||||
else
|
||||
echo $str_line >> $str_conf_file
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user