Merge branch 'master' of ssh://git.code.sf.net/p/xcat/xcat-core
softlayer install and sysclone working for strangely ordered nics and cross vlan
This commit is contained in:
commit
516ab61cc3
@ -48,7 +48,7 @@ binary-arch: build install
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man5/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/man/man7/*
|
||||
chmod 644 `pwd`/debian/perl-xcat/opt/xcat/share/doc/man7/*
|
||||
./modifyUtils `cat ../Version` `svn info | grep Revision | cut -d" " -f 2`
|
||||
./modifyUtils `cat ../Version` `git log -n 1 | head -n 1 | cut -f 2 -d ' '`
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
@ -1901,50 +1901,6 @@ sub isIpaddr
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getSubnetGateway
|
||||
Description:
|
||||
Get gateway from the networks table of the specified net.
|
||||
|
||||
Arguments:
|
||||
net: the net, ie. the "net" field of the networks table
|
||||
Returns:
|
||||
Return a string, of the gateway
|
||||
undef - Failed to get the gateway
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $gateway = xCAT::NetworkUtils::getSubnetGateway('192.168.1.0');
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getSubnetGateway
|
||||
{
|
||||
my $netname=shift;
|
||||
if( $netname =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$netname=shift;
|
||||
}
|
||||
|
||||
my $gateway=undef;
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
unless($nettab) { die "No entry defined in networks"; }
|
||||
my @nets = $nettab->getAllAttribs('net','gateway');
|
||||
foreach(@nets)
|
||||
{
|
||||
if("$_->{net}" eq "$netname")
|
||||
{
|
||||
$gateway = $_->{gateway};
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@ -2002,6 +1958,50 @@ sub getNodeNameservers{
|
||||
return \%nodenameservers;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
=head3 getNodeGateway
|
||||
Description:
|
||||
Get gateway from the networks table of the node.
|
||||
|
||||
Arguments:
|
||||
ip: the ip address of the node
|
||||
Returns:
|
||||
Return a string, of the gateway
|
||||
undef - Failed to get the gateway
|
||||
Globals:
|
||||
none
|
||||
Error:
|
||||
none
|
||||
Example:
|
||||
my $gateway = xCAT::NetworkUtils::getNodeGateway('192.168.1.0');
|
||||
Comments:
|
||||
none
|
||||
|
||||
=cut
|
||||
#-------------------------------------------------------------------------------
|
||||
sub getNodeGateway
|
||||
{
|
||||
my $ip=shift;
|
||||
if( $ip =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$ip=shift;
|
||||
}
|
||||
my $gateway=undef;
|
||||
|
||||
my $nettab = xCAT::Table->new("networks");
|
||||
if ($nettab) {
|
||||
my @nets = $nettab->getAllAttribs('net','mask','gateway');
|
||||
foreach my $net (@nets) {
|
||||
if (xCAT::NetworkUtils::isInSameSubnet( $net->{'net'}, $ip, $net->{'mask'}, 0)) {
|
||||
$gateway=$net->{'gateway'};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return $gateway;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 getNodeNetworkCfg
|
||||
@ -2031,8 +2031,8 @@ sub getNodeNetworkCfg
|
||||
if( $node =~ /xCAT::NetworkUtils/)
|
||||
{
|
||||
$node =shift;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
my $nets = xCAT::NetworkUtils::my_nets();
|
||||
my $ip = xCAT::NetworkUtils->getipaddr($node);
|
||||
my $mask = undef;
|
||||
@ -2041,12 +2041,14 @@ sub getNodeNetworkCfg
|
||||
{
|
||||
my $netname;
|
||||
($netname,$mask) = split /\//, $net;
|
||||
$gateway=xCAT::NetworkUtils::getSubnetGateway($netname);
|
||||
last if ( xCAT::NetworkUtils::isInSameSubnet( $netname, $ip, $mask, 1));
|
||||
}
|
||||
$gateway=xCAT::NetworkUtils::getNodeGateway($ip);
|
||||
return ($ip, $node, $gateway, xCAT::NetworkUtils::formatNetmask($mask,1,0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
=head3 get_hdwr_ip
|
||||
|
1
xCAT-client/bin/makeconfluentcfg
Symbolic link
1
xCAT-client/bin/makeconfluentcfg
Symbolic link
@ -0,0 +1 @@
|
||||
xcatclient
|
@ -2582,7 +2582,7 @@ sub setFINALattrs
|
||||
|
||||
# special case for the nic* attributes
|
||||
# merge nic*.eth0, nic*.eth1
|
||||
if ($::FILEATTRS{$objname}{objtype} eq 'node')
|
||||
if (($::FILEATTRS{$objname}{objtype} eq 'node') || ($::FILEATTRS{$objname}{objtype} eq 'group'))
|
||||
{
|
||||
xCAT::DBobjUtils->collapsenicsattr($::FILEATTRS{$objname}, $objname);
|
||||
}
|
||||
@ -2643,7 +2643,7 @@ sub setFINALattrs
|
||||
unless(exists($::CLIATTRS{$objname})) {
|
||||
next;
|
||||
}
|
||||
if ($::CLIATTRS{$objname}{objtype} eq 'node')
|
||||
if (($::CLIATTRS{$objname}{objtype} eq 'node') || ($::CLIATTRS{$objname}{objtype} eq 'group'))
|
||||
{
|
||||
# Even if only the nicips.eth0 is specified with CLI,
|
||||
# need to read the whole nicips attribute from the nics table,
|
||||
|
@ -662,7 +662,11 @@ sub mknetboot
|
||||
$kcmdline = "NFSROOT=$nfssrv:$nfsdir STATEMNT=";
|
||||
}
|
||||
} else {
|
||||
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
|
||||
if (-r "$rootimgdir/rootimg-statelite.gz.metainfo") {
|
||||
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz.metainfo STATEMNT=";
|
||||
} else {
|
||||
$kcmdline = "imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg-statelite.gz STATEMNT=";
|
||||
}
|
||||
}
|
||||
|
||||
# add support for subVars in the value of "statemnt"
|
||||
@ -724,8 +728,13 @@ sub mknetboot
|
||||
$kcmdline .= "NODE=$node ";
|
||||
}
|
||||
else {
|
||||
$kcmdline =
|
||||
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix ";
|
||||
if (-r "$rootimgdir/rootimg.$suffix.metainfo") {
|
||||
$kcmdline =
|
||||
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix.metainfo ";
|
||||
} else {
|
||||
$kcmdline =
|
||||
"imgurl=$httpmethod://$imgsrv:$httpport/$rootimgdir/rootimg.$suffix ";
|
||||
}
|
||||
$kcmdline .= "XCAT=$xcatmaster:$xcatdport ";
|
||||
$kcmdline .= "NODE=$node ";
|
||||
# add flow control setting
|
||||
|
406
xCAT-server/lib/xcat/plugins/confluent.pm
Normal file
406
xCAT-server/lib/xcat/plugins/confluent.pm
Normal file
@ -0,0 +1,406 @@
|
||||
# IBM(c) 2014 EPL license http://www.eclipse.org/legal/epl-v10.html
|
||||
#TODO: delete entries not being refreshed if no noderange
|
||||
package xCAT_plugin::confluent;
|
||||
use strict;
|
||||
use warnings;
|
||||
use xCAT::PasswordUtils;
|
||||
use xCAT::Table;
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use Getopt::Long;
|
||||
use Sys::Hostname;
|
||||
use xCAT::SvrUtils;
|
||||
use Confluent::Client;
|
||||
|
||||
use strict;
|
||||
my %termservers; #list of noted termservers
|
||||
|
||||
my $usage_string=
|
||||
" makeconfluentcfg [-d|--delete] noderange
|
||||
makeconfluentcf [-l|--local]
|
||||
makeconfluentcf [-c|--confluent]
|
||||
makeconfluentcf
|
||||
makeconfluentcf -h|--help
|
||||
makeconfluentcf -v|--version
|
||||
-c|--confluent Configure confluent only on the host.
|
||||
The default goes down to all the confluent instances on
|
||||
the server nodes and set them up
|
||||
-l|--local Configure confluent only on the local system.
|
||||
The default goes down to all the confluent instances on
|
||||
the server nodes and set them up
|
||||
-d|--delete Conserver has the relevant entries for the given noderange removed immediately from configuration
|
||||
-h|--help Display this usage statement.
|
||||
-V|--verbose Verbose mode.
|
||||
-v|--version Display the version number.";
|
||||
|
||||
my $version_string=xCAT::Utils->Version();
|
||||
|
||||
sub handled_commands {
|
||||
return {
|
||||
makeconfluentcfg => "confluent"
|
||||
}
|
||||
}
|
||||
|
||||
sub preprocess_request {
|
||||
my $request = shift;
|
||||
#if ($request->{_xcatdest}) { return [$request]; } #exit if preprocessed
|
||||
if ($request->{_xcatpreprocessed}->[0] == 1) { return [$request]; }
|
||||
my $callback=shift;
|
||||
my @requests;
|
||||
my $noderange = $request->{node}; #Should be arrayref
|
||||
|
||||
#display usage statement if -h
|
||||
my $extrargs = $request->{arg};
|
||||
my @exargs=($request->{arg});
|
||||
if (ref($extrargs)) {
|
||||
@exargs=@$extrargs;
|
||||
}
|
||||
@ARGV=@exargs;
|
||||
|
||||
my $isSN=xCAT::Utils->isServiceNode();
|
||||
my @hostinfo=xCAT::NetworkUtils->determinehostname();
|
||||
my %iphash=();
|
||||
foreach(@hostinfo) { $iphash{$_}=1;}
|
||||
|
||||
$Getopt::Long::ignorecase=0;
|
||||
#$Getopt::Long::pass_through=1;
|
||||
if(!GetOptions(
|
||||
'c|confluent' => \$::CONSERVER,
|
||||
'l|local' => \$::LOCAL,
|
||||
'h|help' => \$::HELP,
|
||||
'D|debug' => \$::DEBUG,
|
||||
'v|version' => \$::VERSION,
|
||||
'V|verbose' => \$::VERBOSE)) {
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
if ($::HELP) {
|
||||
$callback->({data=>$usage_string});
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
if ($::VERSION) {
|
||||
$callback->({data=>$version_string});
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
if ($::LOCAL) {
|
||||
if ($noderange && @$noderange>0) {
|
||||
$callback->({data=>"Invalid option -l or --local when there are nodes specified."});
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ($::CONSERVER && $::LOCAL) {
|
||||
$callback->({data=>"Can not specify -l or --local together with -c or --confluent."});
|
||||
$request = {};
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
# get site master
|
||||
my $master=xCAT::TableUtils->get_site_Master();
|
||||
if (!$master) { $master=hostname(); }
|
||||
|
||||
my %cons_hash=();
|
||||
my $hmtab = xCAT::Table->new('nodehm');
|
||||
my @items;
|
||||
my $allnodes=1;
|
||||
if ($noderange && @$noderange>0) {
|
||||
$allnodes=0;
|
||||
my $hmcache=$hmtab->getNodesAttribs($noderange,['node', 'serialport','cons', 'conserver']);
|
||||
foreach my $node (@$noderange) {
|
||||
my $ent=$hmcache->{$node}->[0]; #$hmtab->getNodeAttribs($node,['node', 'serialport','cons', 'conserver']);
|
||||
push @items,$ent;
|
||||
}
|
||||
} else {
|
||||
$allnodes=1;
|
||||
@items = $hmtab->getAllNodeAttribs(['node', 'serialport','cons', 'conserver']);
|
||||
}
|
||||
|
||||
my @nodes=();
|
||||
foreach (@items) {
|
||||
if (((!defined($_->{cons})) || ($_->{cons} eq "")) and !defined($_->{serialport})) { next;} #skip if 'cons' is not defined for this node, unless serialport suggests otherwise
|
||||
if (defined($_->{conserver})) { push @{$cons_hash{$_->{conserver}}{nodes}}, $_->{node};}
|
||||
else { push @{$cons_hash{$master}{nodes}}, $_->{node};}
|
||||
push @nodes,$_->{node};
|
||||
}
|
||||
|
||||
#send all nodes to the MN
|
||||
if (!$isSN && !$::CONSERVER) { #If -c flag is set, do not add the all nodes to the management node
|
||||
if ($::VERBOSE) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "Configuring nodes in confluent on the management node";
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
my $reqcopy = {%$request};
|
||||
$reqcopy->{'_xcatdest'} = $master;
|
||||
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
||||
$reqcopy->{'_allnodes'} = $allnodes; # the original command comes with nodes or not
|
||||
if ($allnodes==1) { @nodes=(); }
|
||||
$reqcopy->{node} = \@nodes;
|
||||
push @requests, $reqcopy;
|
||||
if ($::LOCAL) { return \@requests; }
|
||||
}
|
||||
|
||||
# send to conserver hosts
|
||||
foreach my $cons (keys %cons_hash) {
|
||||
#print "cons=$cons\n";
|
||||
my $doit=0;
|
||||
if ($isSN) {
|
||||
if (exists($iphash{$cons})) { $doit=1; }
|
||||
} else {
|
||||
if (!exists($iphash{$cons}) || $::CONSERVER) { $doit=1; }
|
||||
}
|
||||
|
||||
if ($doit) {
|
||||
my $reqcopy = {%$request};
|
||||
$reqcopy->{'_xcatdest'} = $cons;
|
||||
$reqcopy->{_xcatpreprocessed}->[0] = 1;
|
||||
$reqcopy->{'_allnodes'} = [$allnodes]; # the original command comes with nodes or not
|
||||
$reqcopy->{node} = $cons_hash{$cons}{nodes};
|
||||
my $no=$reqcopy->{node};
|
||||
#print "node=@$no\n";
|
||||
push @requests, $reqcopy;
|
||||
} #end if
|
||||
} #end foreach
|
||||
|
||||
if ($::DEBUG) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "In preprocess_request, request is " . Dumper(@requests);
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
}
|
||||
return \@requests;
|
||||
}
|
||||
|
||||
sub process_request {
|
||||
my $req = shift;
|
||||
my $cb = shift;
|
||||
if ($req->{command}->[0] eq "makeconfluentcfg") {
|
||||
makeconfluentcfg($req,$cb);
|
||||
}
|
||||
}
|
||||
|
||||
# Read the file, get db info, update the file contents, and then write the file
|
||||
sub makeconfluentcfg {
|
||||
my $req = shift;
|
||||
%termservers = (); #clear hash of existing entries
|
||||
my $cb = shift;
|
||||
my $extrargs = $req->{arg};
|
||||
my @exargs=($req->{arg});
|
||||
if (ref($extrargs)) {
|
||||
@exargs=@$extrargs;
|
||||
}
|
||||
@ARGV=@exargs;
|
||||
$Getopt::Long::ignorecase=0;
|
||||
#$Getopt::Long::pass_through=1;
|
||||
my $delmode;
|
||||
GetOptions('d|delete' => \$delmode,
|
||||
);
|
||||
my $nodes = $req->{node};
|
||||
my $svboot=0;
|
||||
if (exists($req->{svboot})) { $svboot=1;}
|
||||
my $confluent = Confluent::Client->new(); # just the local form for now..
|
||||
|
||||
my $isSN=xCAT::Utils->isServiceNode();
|
||||
my @hostinfo=xCAT::NetworkUtils->determinehostname();
|
||||
my %iphash=();
|
||||
foreach(@hostinfo) {$iphash{$_}=1;}
|
||||
|
||||
#print "process_request nodes=@$nodes\n";
|
||||
|
||||
# Get db info for the nodes related to console
|
||||
my $hmtab = xCAT::Table->new('nodehm');
|
||||
my @cfgents1;# = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport']);
|
||||
if (($nodes and @$nodes > 0) or $req->{noderange}->[0]) {
|
||||
@cfgents1 = $hmtab->getNodesAttribs($nodes,['node','cons','serialport','mgt','conserver','termserver','termport','consoleondemand']);
|
||||
# Adjust the data structure to make the result consistent with the getAllNodeAttribs() call we make if a noderange was not specified
|
||||
my @tmpcfgents1;
|
||||
foreach my $ent (@cfgents1)
|
||||
{
|
||||
foreach my $nodeent ( keys %$ent)
|
||||
{
|
||||
push @tmpcfgents1, $ent->{$nodeent}->[0] ;
|
||||
}
|
||||
}
|
||||
@cfgents1 = @tmpcfgents1
|
||||
|
||||
} else {
|
||||
@cfgents1 = $hmtab->getAllNodeAttribs(['cons','serialport','mgt','conserver','termserver','termport','consoleondemand']);
|
||||
}
|
||||
|
||||
|
||||
#cfgents1 should now have all the nodes, so we can fill in the cfgents array and cfgenthash one at a time.
|
||||
# skip the nodes that do not have 'cons' defined, unless a serialport setting suggests otherwise
|
||||
my @cfgents=();
|
||||
my %cfgenthash;
|
||||
foreach (@cfgents1) {
|
||||
if ($_->{cons} or defined($_->{'serialport'})) {
|
||||
unless ($_->{cons}) {$_->{cons} = $_->{mgt};} #populate with fallback
|
||||
push @cfgents, $_;
|
||||
$cfgenthash{$_->{node}} = $_; # also put the ref to the entry in a hash for quick look up
|
||||
}
|
||||
}
|
||||
|
||||
if ($::DEBUG) {
|
||||
my $rsp;
|
||||
$rsp->{data}->[0] = "In makeconservercf, cfgents is " . Dumper(@cfgents);
|
||||
xCAT::MsgUtils->message("I", $rsp, $cb);
|
||||
}
|
||||
|
||||
# if nodes defined, it is either on the service node or makeconserver was called with noderange on mn
|
||||
if (($nodes and @$nodes > 0) or $req->{noderange}->[0]) {
|
||||
# strip all xCAT configured nodes from config if the original command was for all nodes
|
||||
#if (($req->{_allnodes}) && ($req->{_allnodes}->[0]==1)) {} #TODO: identify nodes that will be removed
|
||||
# call donodeent to add all node entries into the file. It will return the 1st node in error.
|
||||
my $node;
|
||||
if ($node=donodeent(\%cfgenthash,$confluent,$delmode, $cb)) {
|
||||
#$cb->({node=>[{name=>$node,error=>"Bad configuration, check attributes under the nodehm category",errorcode=>1}]});
|
||||
xCAT::SvrUtils::sendmsg([1,"Bad configuration, check attributes under the nodehm category"],$cb,$node);
|
||||
}
|
||||
} else { #no nodes specified, do em all up
|
||||
#zapcfg(\@filecontent); # strip all xCAT configured nodes from config
|
||||
#TODO: identify nodes to be removed
|
||||
|
||||
# get nodetype so we can filter out node types without console support
|
||||
my $typetab = xCAT::Table->new('nodetype');
|
||||
my %type;
|
||||
|
||||
if ( defined($typetab)) {
|
||||
my @ents = $typetab->getAllNodeAttribs([qw(node nodetype)]);
|
||||
foreach (@ents) {
|
||||
$type{$_->{node}}=$_->{nodetype};
|
||||
}
|
||||
}
|
||||
# remove nodes that arent for this SN or type of node doesnt have console
|
||||
foreach (@cfgents) {
|
||||
my $keepdoing=0;
|
||||
if ($isSN && $_->{conserver} && exists($iphash{$_->{conserver}})) {
|
||||
$keepdoing=1; #only hanlde the nodes that use this SN as the conserver
|
||||
}
|
||||
if (!$isSN) { $keepdoing=1;} #handle all for MN
|
||||
if ($keepdoing) {
|
||||
if ($_->{termserver} and not $termservers{$_->{termserver}}) {
|
||||
die "confluent does not currently support termserver";
|
||||
$termservers{$_->{termserver}}=1; # dont add this one again
|
||||
}
|
||||
if ( $type{$_->{node}} =~ /fsp|bpa|hmc|ivm/ ) {
|
||||
$keepdoing=0; # these types dont have consoles
|
||||
}
|
||||
}
|
||||
if (!$keepdoing) { delete $cfgenthash{$_->{node}}; } # remove this node from the hash so we dont process it later
|
||||
}
|
||||
|
||||
# Now add into the file all the node entries that we kept
|
||||
my $node;
|
||||
if ($node=donodeent(\%cfgenthash,$confluent, undef, $cb)) {
|
||||
# donodeent will return the 1st node in error
|
||||
#$cb->({node=>[{name=>$node,error=>"Bad configuration, check attributes under the nodehm category",errorcode=>1}]});
|
||||
xCAT::SvrUtils::sendmsg([1,"Bad configuration, check attributes under the nodehm category"],$cb,$node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Add entries in the file for each node. This function used to do 1 node at a time, but was changed to do
|
||||
# all nodes at once for performance reasons. If there is a problem with a nodes config, this
|
||||
# function will return that node name as the one in error.
|
||||
sub donodeent {
|
||||
my $cfgenthash = shift;
|
||||
my $confluent = shift;
|
||||
my $delmode = shift;
|
||||
my $cb = shift;
|
||||
my $idx=0;
|
||||
my $toidx=-1;
|
||||
my $skip = 0;
|
||||
my $skipnext = 0;
|
||||
|
||||
# Delete all the previous stanzas of the nodes specified
|
||||
my $isSN=xCAT::Utils->isServiceNode();
|
||||
my $curnode;
|
||||
# Loop till find the start of a node stanza and remove lines till get to the end of the stanza
|
||||
my %currnodes;
|
||||
$confluent->read('/nodes/');
|
||||
my $listitem = $confluent->next_result();
|
||||
while ($listitem) {
|
||||
if (exists $listitem->{item}) {
|
||||
my $name = $listitem->{item}->{href};
|
||||
$name =~ s/\/$//;
|
||||
$currnodes{$name} = 1;
|
||||
}
|
||||
$listitem = $confluent->next_result();
|
||||
}
|
||||
if ($delmode) {
|
||||
foreach my $confnode (keys %currnodes) {
|
||||
if ($cfgenthash->{$confnode}) {
|
||||
$confluent->delete('/nodes/' . $confnode);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
my @toconfignodes = keys %{$cfgenthash};
|
||||
my $ipmitab = xCAT::Table->new('ipmi', -create=>0);
|
||||
my $ipmientries = {};
|
||||
if ($ipmitab) {
|
||||
$ipmientries = $ipmitab->getNodesAttribs(\@toconfignodes,
|
||||
[qw/bmc username password/]);
|
||||
}
|
||||
my $ipmiauthdata = xCAT::PasswordUtils::getIPMIAuth(
|
||||
noderange=>\@toconfignodes, ipmihash=>$ipmientries);
|
||||
|
||||
# Go thru all nodes specified to add them to the file
|
||||
foreach my $node (sort keys %$cfgenthash) {
|
||||
my $cfgent = $cfgenthash->{$node};
|
||||
my $cmeth=$cfgent->{cons};
|
||||
if (not $cmeth) {
|
||||
return $node;
|
||||
}
|
||||
if ($cmeth ne 'ipmi') {
|
||||
die 'TODO: non ipmi consoles...'
|
||||
}
|
||||
my %parameters;
|
||||
$parameters{'console.method'} = $cmeth;
|
||||
if ($cmeth eq 'ipmi') {
|
||||
$parameters{'secret.hardwaremanagementuser'} =
|
||||
$ipmiauthdata->{$node}->{username};
|
||||
$parameters{'secret.hardwaremanagementpassphrase'} =
|
||||
$ipmiauthdata->{$node}->{password};
|
||||
my $bmc = $ipmientries->{$node}->[0]->{bmc};
|
||||
$bmc =~ s/,.*//;
|
||||
$parameters{'hardwaremanagement.manager'} = $bmc;
|
||||
}
|
||||
if (defined($cfgent->{consoleondemand})) {
|
||||
if ($cfgent->{consoleondemand}) {
|
||||
$parameters{'console.logging'} = 'none';
|
||||
}
|
||||
else {
|
||||
$parameters{'console.logging'} = 'full';
|
||||
}
|
||||
} elsif ($::XCATSITEVALS{'consoleondemand'} and $::XCATSITEVALS{'consoleondemand'} !~ m/^n/) {
|
||||
$parameters{'console.logging'} = 'none';
|
||||
}
|
||||
if (exists $currnodes{$node}) {
|
||||
$confluent->update('/nodes/'.$node.'/attributes/current', parameters=>\%parameters);
|
||||
my $rsp = $confluent->next_result();
|
||||
while ($rsp) {
|
||||
if (exists $rsp->{error}) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Confluent error: " . $rsp->{error}],$cb,$node);
|
||||
}
|
||||
$rsp = $confluent->next_result();
|
||||
}
|
||||
} else {
|
||||
$parameters{name} = $node;
|
||||
$confluent->create('/nodes/bob/', parameters=>\%parameters);
|
||||
my $rsp = $confluent->next_result();
|
||||
while ($rsp) {
|
||||
if (exists $rsp->{error}) {
|
||||
xCAT::SvrUtils::sendmsg([1,"Confluent error: " . $rsp->{error}],$cb,$node);
|
||||
}
|
||||
$rsp = $confluent->next_result();
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
1;
|
@ -7,6 +7,7 @@ use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use Getopt::Long;
|
||||
use Sys::Hostname;
|
||||
use xCAT::SvrUtils;
|
||||
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
|
@ -568,6 +568,7 @@ sub nextdestiny {
|
||||
}
|
||||
|
||||
my $node;
|
||||
my $noupdate_flag = 0;
|
||||
$chaintab = xCAT::Table->new('chain');
|
||||
my $chainents = $chaintab->getNodesAttribs(\@nodes,[qw(currstate currchain chain)]);
|
||||
foreach $node (@nodes) {
|
||||
@ -599,14 +600,24 @@ sub nextdestiny {
|
||||
{
|
||||
my @items = split /[:]/,$ref->{currstate};
|
||||
$requ{arg}= \@items;
|
||||
$noupdate_flag = 1;
|
||||
}
|
||||
setdestiny(\%requ, $flag+1);
|
||||
}
|
||||
|
||||
if ($callnodeset) {
|
||||
my $args;
|
||||
if($noupdate_flag)
|
||||
{
|
||||
$args = ['enact', '--noupdateinitrd'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$args = ['enact'];
|
||||
}
|
||||
$subreq->({command=>['nodeset'],
|
||||
node=> \@nodes,
|
||||
arg=>['enact', '--noupdateinitrd']});
|
||||
arg=>$args});
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -636,15 +636,20 @@ sub sysclone_createosimgdef{
|
||||
my ($node, $server, $osimage, $callback, $subreq) = @_;
|
||||
my $createnew = 0;
|
||||
my %osimgdef;
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
my $osimgtab = xCAT::Table->new('osimage');
|
||||
my $entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
|
||||
if($entry){
|
||||
my $entry;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
$entry = ($osimgtab->getAllAttribsWhere("\"imagename\" = '$osimage'", 'ALL' ))[0];
|
||||
} else {
|
||||
$entry = ($osimgtab->getAllAttribsWhere("imagename = '$osimage'", 'ALL' ))[0];
|
||||
}
|
||||
if($entry){
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0] = qq{Using the existing osimage "$osimage" defined on $server.};
|
||||
xCAT::MsgUtils->message("I", $rsp, $callback);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
# try to see if we can get the osimage def from golden client.
|
||||
my $nttab = xCAT::Table->new('nodetype');
|
||||
|
@ -17,7 +17,7 @@ use warnings;
|
||||
#use xCAT::Table;
|
||||
#use xCAT::Schema;
|
||||
#use xCAT::NodeRange qw/noderange abbreviate_noderange/;
|
||||
#use xCAT::Utils;
|
||||
use xCAT::Utils;
|
||||
use xCAT::TableUtils;
|
||||
use Data::Dumper;
|
||||
use XML::Simple;
|
||||
@ -316,6 +316,7 @@ sub get_image_info {
|
||||
my $kitlist;
|
||||
my $kitrepolist;
|
||||
my $kitcomplist;
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
foreach my $kitcomponent (split ',', $attrs0->{kitcomponents}) {
|
||||
(my $kitcomphash) = $kitcomponenttab->getAttribs({kitcompname => $kitcomponent},'kitname');
|
||||
if (!$kitcomphash) {
|
||||
@ -325,15 +326,24 @@ sub get_image_info {
|
||||
|
||||
if ($kitcomphash->{kitname}) {
|
||||
$kitlist->{$kitcomphash->{kitname}} = 1;
|
||||
|
||||
my @kitrepohash = $kitrepotab->getAllAttribsWhere( "kitname = '$kitcomphash->{kitname}'", 'kitreponame');
|
||||
my @kitrepohash;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@kitrepohash = $kitrepotab->getAllAttribsWhere( "\"kitname\" = '$kitcomphash->{kitname}'", 'kitreponame');
|
||||
} else {
|
||||
@kitrepohash = $kitrepotab->getAllAttribsWhere( "kitname = '$kitcomphash->{kitname}'", 'kitreponame');
|
||||
}
|
||||
foreach my $kitrepo (@kitrepohash) {
|
||||
if ($kitrepo->{kitreponame}) {
|
||||
$kitrepolist->{$kitrepo->{kitreponame}} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
my @kitcomponents = $kitcomponenttab->getAllAttribsWhere( "kitname = '$kitcomphash->{kitname}'", 'kitcompname');
|
||||
my @kitcomponents;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@kitcomponents = $kitcomponenttab->getAllAttribsWhere( "\"kitname\" = '$kitcomphash->{kitname}'", 'kitcompname');
|
||||
} else {
|
||||
@kitcomponents = $kitcomponenttab->getAllAttribsWhere( "kitname = '$kitcomphash->{kitname}'", 'kitcompname');
|
||||
}
|
||||
foreach my $kitcomp (@kitcomponents) {
|
||||
if ($kitcomp->{kitcompname}) {
|
||||
$kitcomplist->{$kitcomp->{kitcompname}} = 1;
|
||||
|
@ -1494,6 +1494,7 @@ sub rmkit
|
||||
my %kitnames;
|
||||
my $des = shift @ARGV;
|
||||
my @kits = split ',', $des;
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
foreach my $kit (@kits) {
|
||||
|
||||
# Check if it is a kitname or basename
|
||||
@ -1508,7 +1509,12 @@ sub rmkit
|
||||
}
|
||||
$kitnames{$kit} = 1;
|
||||
} else {
|
||||
my @entries = $tabs{kit}->getAllAttribsWhere( "basename = '$kit'", 'kitname', 'isinternal');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kit}->getAllAttribsWhere( "\"basename\" = '$kit'", 'kitname', 'isinternal');
|
||||
} else {
|
||||
@entries = $tabs{kit}->getAllAttribsWhere( "basename = '$kit'", 'kitname', 'isinternal');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Kit $kit could not be found in DB $t";
|
||||
@ -1545,8 +1551,12 @@ sub rmkit
|
||||
|
||||
# Find all the components in this kit.
|
||||
my $kitcompnames;
|
||||
my @kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "kitname = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
|
||||
|
||||
my @kitcomphash;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "\"kitname\" = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
|
||||
} else {
|
||||
@kitcomphash = $tabs{kitcomponent}->getAllAttribsWhere( "kitname = '$kitname'", 'kitcompname', 'postbootscripts', 'genimage_postinstall');
|
||||
}
|
||||
if (@entries && (@entries > 0)) {
|
||||
|
||||
if($::VERBOSE and !$test){
|
||||
@ -1682,7 +1692,12 @@ sub rmkit
|
||||
}
|
||||
|
||||
# Remove kitrepo
|
||||
my @kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "kitname = '$kitname'", 'kitreponame');
|
||||
my @kitrepohash;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "\"kitname\" = '$kitname'", 'kitreponame');
|
||||
} else {
|
||||
@kitrepohash = $tabs{kitrepo}->getAllAttribsWhere( "kitname = '$kitname'", 'kitreponame');
|
||||
}
|
||||
foreach my $kitrepo ( @kitrepohash ) {
|
||||
my $kitreponame = $kitrepo->{kitreponame};
|
||||
$tabs{kitrepo}->delEntries({kitreponame => $kitreponame});
|
||||
@ -1878,7 +1893,7 @@ sub addkitcomp
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
my %tabs = ();
|
||||
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
|
||||
foreach my $t ( @tables ) {
|
||||
@ -1911,7 +1926,12 @@ sub addkitcomp
|
||||
$kitcomps{$kitcomponent}{name} = $kitcomponent;
|
||||
$kitcomps{$kitcomponent}{basename} = $kitcomptable->{'basename'};
|
||||
} else {
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
|
||||
@ -2101,7 +2121,12 @@ sub addkitcomp
|
||||
my @kitcompdeps = split ',', $kitcomptable->{'kitcompdeps'};
|
||||
foreach my $kitcompdependency ( @kitcompdeps ) {
|
||||
my ($kitcompdep, $vers) = split /<=|>=|=|<|>/, $kitcompdependency;
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitreponame', 'kitname', 'kitcompname' , 'serverroles', 'kitcompdeps', 'version', 'prerequisite', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "Cannot find any matched kit component for kit component $kitcomp dependency $kitcompdep";
|
||||
@ -2413,7 +2438,7 @@ sub rmkitcomp
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
my %tabs = ();
|
||||
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
|
||||
foreach my $t ( @tables ) {
|
||||
@ -2456,7 +2481,12 @@ sub rmkitcomp
|
||||
$kitcomps{$kitcomponent}{driverpacks} = $kitcomptable->{driverpacks};
|
||||
$kitcomps{$kitcomponent}{genimage_postinstall} = $kitcomptable->{genimage_postinstall};
|
||||
} else {
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
|
||||
@ -2530,7 +2560,12 @@ sub rmkitcomp
|
||||
|
||||
my ($kitcompdep, $vers) = split /<=|>=|=|<|>/, $kitcompdependency;
|
||||
# Get the kit component full name from basename.
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitcompname' , 'version', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcompdep'", 'kitcompname' , 'version', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcompdep'", 'kitcompname' , 'version', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "kitcomponent $kitcompdep basename does not exist";
|
||||
@ -3214,7 +3249,7 @@ sub chkkitcomp
|
||||
create_version_response('chkkitcomp');
|
||||
return 1; # no usage - just exit
|
||||
}
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
my %tabs = ();
|
||||
my @tables = qw(kit kitrepo kitcomponent osimage osdistro linuximage);
|
||||
foreach my $t ( @tables ) {
|
||||
@ -3248,7 +3283,12 @@ sub chkkitcomp
|
||||
$kitcomps{$kitcomponent}{serverroles} = $kitcomptable->{serverroles};
|
||||
$kitcompbasename{$kitcomptable->{basename}} = 1;
|
||||
} else {
|
||||
my @entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
my @entries;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "\"basename\" = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
} else {
|
||||
@entries = $tabs{kitcomponent}->getAllAttribsWhere( "basename = '$kitcomponent'", 'kitcompname' , 'version', 'release');
|
||||
}
|
||||
unless (@entries) {
|
||||
my %rsp;
|
||||
push@{ $rsp{data} }, "$kitcomponent kitcomponent does not exist";
|
||||
@ -4660,6 +4700,7 @@ sub db_get_table_rows {
|
||||
|
||||
my $table = xCAT::Table->new($tablename);
|
||||
my @table_rows = ();
|
||||
# todo fix for DB2 support
|
||||
if (defined($filter_stmt)) {
|
||||
if (length($filter_stmt) > 0) {
|
||||
@table_rows = $table->getAllAttribsWhere($filter_stmt, @{$attrs});
|
||||
|
@ -95,6 +95,7 @@ sub getOSdistroref
|
||||
{
|
||||
return undef;
|
||||
}
|
||||
# verified this does work on DB2
|
||||
|
||||
my @clause=();
|
||||
|
||||
|
@ -51,12 +51,14 @@ sub process_request {
|
||||
my $rootimg_dir;
|
||||
my $destdir;
|
||||
my $imagename;
|
||||
my $dotorrent;
|
||||
|
||||
GetOptions(
|
||||
"profile|p=s" => \$profile,
|
||||
"arch|a=s" => \$arch,
|
||||
"osver|o=s" => \$osver,
|
||||
"method|m=s" => \$method,
|
||||
"tracker=s" => \$dotorrent,
|
||||
"help|h" => \$help,
|
||||
"version|v" => \$version
|
||||
);
|
||||
@ -386,6 +388,14 @@ sub process_request {
|
||||
`$excludestr`;
|
||||
if ($method =~ /cpio/) {
|
||||
chmod 0644,"$destdir/rootimg.gz";
|
||||
if ($dotorrent) {
|
||||
my $currdir = getcwd;
|
||||
chdir($destdir);
|
||||
unlink("rootimg.gz.metainfo");
|
||||
system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg.gz.metainfo rootimg.gz");
|
||||
chmod 0644, "rootimg.gz.metainfo";
|
||||
chdir($currdir);
|
||||
}
|
||||
umask $oldmask;
|
||||
} elsif ($method =~ /squashfs/) {
|
||||
my $flags;
|
||||
|
@ -25,6 +25,7 @@ use xCAT::NodeRange;
|
||||
use xCAT::Table;
|
||||
use xCAT::NetworkUtils;
|
||||
use xCAT::MsgUtils;
|
||||
use xCAT::Utils;
|
||||
use xCAT::DiscoveryUtils;
|
||||
use xCAT::NodeRange qw/noderange/;
|
||||
require xCAT::data::ibmhwtypes;
|
||||
@ -701,7 +702,7 @@ Usage:
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
# Go thought discoverydata table and display the sequential disocvery entries
|
||||
my $distab = xCAT::Table->new('discoverydata');
|
||||
unless ($distab) {
|
||||
@ -710,7 +711,12 @@ Usage:
|
||||
xCAT::MsgUtils->message("E", $rsp, $callback);
|
||||
return;
|
||||
}
|
||||
my @disdata = $distab->getAllAttribsWhere("method='sequential'", 'node', 'mtm', 'serial');
|
||||
my @disdata;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"method\" = 'sequential'", 'node', 'mtm', 'serial');
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("method='sequential'", 'node', 'mtm', 'serial');
|
||||
}
|
||||
my @discoverednodes;
|
||||
|
||||
foreach (@disdata) {
|
||||
@ -817,6 +823,7 @@ Usage:
|
||||
}
|
||||
}
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
# Go thought discoverydata table and display the disocvery entries
|
||||
my $distab = xCAT::Table->new('discoverydata');
|
||||
unless ($distab) {
|
||||
@ -837,10 +844,18 @@ Usage:
|
||||
@disdata = $distab->getAllAttribs(@disattrs);
|
||||
} else {
|
||||
$type = "sequential" if ($type =~ /^seq/);
|
||||
@disdata = $distab->getAllAttribsWhere("method='$type'", @disattrs);
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"method\" = '$type'", @disattrs);
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("method='$type'", @disattrs);
|
||||
}
|
||||
}
|
||||
} elsif ($uuid) {
|
||||
@disdata = $distab->getAllAttribsWhere("uuid='$uuid'", @disattrs);
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"uuid\" = '$uuid'", @disattrs);
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("uuid='$uuid'", @disattrs);
|
||||
}
|
||||
}
|
||||
my $discoverednum = $#disdata + 1;
|
||||
|
||||
@ -1002,6 +1017,7 @@ Usage:
|
||||
return;
|
||||
}
|
||||
|
||||
my $DBname = xCAT::Utils->get_DBName; # support for DB2
|
||||
# open the discoverydata table for the subsequent using
|
||||
my $distab = xCAT::Table->new("discoverydata");
|
||||
unless ($distab) {
|
||||
@ -1022,7 +1038,12 @@ Usage:
|
||||
|
||||
if ($uuid) {
|
||||
# handle the -r -u <uuid>
|
||||
my @disdata = $distab->getAllAttribsWhere("uuid='$uuid'", 'method');
|
||||
my @disdata;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"uuid\" = '$uuid'", 'method');
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("uuid='$uuid'", 'method');
|
||||
}
|
||||
unless (@disdata) {
|
||||
xCAT::MsgUtils->message("E", {data=>["Cannot find discovery entry with uuid equals [$uuid]."]}, $callback);
|
||||
return;
|
||||
@ -1089,7 +1110,12 @@ Usage:
|
||||
|
||||
# get all the attributes for the entry from the discoverydata table
|
||||
my @disattrs = ('uuid', 'node', 'method', 'discoverytime', 'arch', 'cpucount', 'cputype', 'memory', 'mtm', 'serial', 'nicdriver', 'nicipv4', 'nichwaddr', 'nicpci', 'nicloc', 'niconboard', 'nicfirm', 'switchname', 'switchaddr', 'switchdesc', 'switchport', 'otherdata');
|
||||
my @disdata = $distab->getAllAttribsWhere("uuid='$uuid'", @disattrs);
|
||||
my @disdata ;
|
||||
if ($DBname =~ /^DB2/) {
|
||||
@disdata = $distab->getAllAttribsWhere("\"uuid\" = '$uuid'", @disattrs);
|
||||
} else {
|
||||
@disdata = $distab->getAllAttribsWhere("uuid='$uuid'", @disattrs);
|
||||
}
|
||||
unless (@disdata) {
|
||||
xCAT::MsgUtils->message("E", {data=>["Cannot find discovery entry with uuid equals $uuid"]}, $callback);
|
||||
return;
|
||||
|
@ -67,6 +67,7 @@ sub process_request {
|
||||
my $exlist; # it is used when rootfstype = ramdisk
|
||||
my $destdir;
|
||||
my $imagename;
|
||||
my $dotorrent;
|
||||
|
||||
GetOptions(
|
||||
"rootfstype|t=s" => \$rootfstype,
|
||||
@ -74,6 +75,7 @@ sub process_request {
|
||||
"arch|a=s" => \$arch,
|
||||
"osver|o=s" => \$osver,
|
||||
"help|h" => \$help,
|
||||
"tracker" => \$dotorrent,
|
||||
"version|v" => \$version,
|
||||
"verbose|V" => \$verbose
|
||||
);
|
||||
@ -534,6 +536,14 @@ sub process_request {
|
||||
chdir("$rootimg_dir");
|
||||
xCAT::Utils->runcmd("$excludestr");
|
||||
chmod 0644, "$destdir/rootimg-statelite.gz";
|
||||
if ($dotorrent) {
|
||||
my $currdir = getcwd;
|
||||
chdir($destdir);
|
||||
unlink("rootimg-statelite.gz.metainfo");
|
||||
system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg-statelite.gz.metainfo rootimg.gz");
|
||||
chmod 0644, "rootimg-statelite.gz.metainfo";
|
||||
chdir($currdir);
|
||||
}
|
||||
umask $oldmask;
|
||||
|
||||
system("rm -f $xcat_packimg_tmpfile");
|
||||
|
@ -1385,6 +1385,13 @@ sub updatenoderunps
|
||||
|
||||
foreach my $snkey (keys %servernodes)
|
||||
{
|
||||
if ((!defined($snkey)) or ($snkey eq "")) { # if we could not find the xcatmaster
|
||||
|
||||
my $rsp = {};
|
||||
$rsp->{error}->[0] = "Could not find xcatmaster for @{$servernodes{$snkey}}. Will skip this node. ";
|
||||
$callback->($rsp);
|
||||
next;
|
||||
}
|
||||
my $nodestring = join(',', @{$servernodes{$snkey}});
|
||||
my $args;
|
||||
my $mode;
|
||||
|
@ -59,7 +59,7 @@ do
|
||||
mv $i/postscripts /xcatpost
|
||||
rm -rf $i
|
||||
chmod +x /xcatpost/*
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
@ -72,7 +72,7 @@ do
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
done
|
||||
|
||||
|
@ -61,7 +61,7 @@ do
|
||||
mv $i/postscripts /xcatpost
|
||||
rm -rf $i
|
||||
chmod +x /xcatpost/*
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
MAX_RETRIES=10
|
||||
RETRY=0
|
||||
@ -74,7 +74,7 @@ do
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
done
|
||||
|
||||
|
@ -44,7 +44,7 @@ do
|
||||
if [ ! -x /xcatpost/mypostscript ]; then
|
||||
|
||||
chmod +x /xcatpost/*
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
|
||||
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
@ -59,7 +59,7 @@ do
|
||||
|
||||
let SLI=$RANDOM%10+10
|
||||
sleep $SLI
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /xcatpost/mypostscript
|
||||
/xcatpost/getpostscript.awk |sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</' -e 's/>/>/' -e 's/&/&/' -e 's/"/"/' -e "s/'/'/" > /xcatpost/mypostscript
|
||||
|
||||
MYCONT=`grep MASTER /xcatpost/mypostscript`
|
||||
done
|
||||
|
@ -25,7 +25,6 @@ cat <<END >$installroot/etc/fstab
|
||||
proc /proc proc rw 0 0
|
||||
sysfs /sys sysfs rw 0 0
|
||||
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
|
||||
${profile}_${arch} / tmpfs rw 0 1
|
||||
END
|
||||
|
||||
|
||||
|
@ -25,9 +25,6 @@ cat <<END >$installroot/etc/fstab
|
||||
proc /proc proc rw 0 0
|
||||
sysfs /sys sysfs rw 0 0
|
||||
devpts /dev/pts devpts rw,gid=5,mode=620 0 0
|
||||
${profile}_${arch} / tmpfs rw 0 1
|
||||
none /tmp tmpfs defaults,size=10m 0 2
|
||||
none /var/tmp tmpfs defaults,size=10m 0 2
|
||||
END
|
||||
|
||||
#-- Uncomment the line contains "cons" in /etc/inittab
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
echo $drivers
|
||||
dracut_install wget cpio gzip dash modprobe touch echo cut wc
|
||||
dracut_install wget cpio gzip dash modprobe touch echo cut wc
|
||||
dracut_install -o ctorrent
|
||||
dracut_install grep ifconfig hostname awk egrep grep dirname expr
|
||||
dracut_install mount.nfs
|
||||
dracut_install parted mke2fs bc mkswap swapon chmod
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
echo $drivers
|
||||
dracut_install wget cpio gzip dash modprobe wc touch echo cut
|
||||
dracut_install -o ctorrent
|
||||
dracut_install grep ifconfig hostname awk egrep grep dirname expr
|
||||
dracut_install parted mke2fs bc mkswap swapon chmod
|
||||
inst "$moddir/xcat-updateflag" "/tmp/updateflag"
|
||||
|
@ -45,6 +45,9 @@ if [ ! -z "$imgurl" ]; then
|
||||
fi
|
||||
#echo 0 > /proc/sys/vm/zone_reclaim_mode #Avoid kernel bug
|
||||
|
||||
if [ -r /*.metainfo ]; then
|
||||
ctorrent /*.metainfo -e 0
|
||||
fi
|
||||
if [ -r /rootimg.sfs ]; then
|
||||
echo Setting up squashfs with ram overlay.
|
||||
mknod /dev/loop0 b 7 0
|
||||
|
@ -116,6 +116,54 @@ mount -n --bind /dev $NEWROOT/dev
|
||||
mount -n --bind /proc $NEWROOT/proc
|
||||
mount -n --bind /sys $NEWROOT/sys
|
||||
|
||||
function getdevfrommac() {
|
||||
boothwaddr=$1
|
||||
ip link show | while read line
|
||||
do
|
||||
dev=`echo $line | egrep "^[0-9]+: [0-9A-Za-z]+" | cut -d ' ' -f 2 | cut -d ':' -f 1`
|
||||
if [ "X$dev" != "X" ]; then
|
||||
devname=$dev
|
||||
fi
|
||||
|
||||
if [ "X$devname" != "X" ]; then
|
||||
hwaddr=`echo $line | egrep "^[ ]*link" | awk '{print $2}'`
|
||||
if [ "X$hwaddr" = "X$boothwaddr" ]; then
|
||||
echo $devname
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
for lf in /tmp/dhclient.*.lease; do
|
||||
netif=${lf#*.}
|
||||
netif=${netif%.*}
|
||||
cp $lf "$NEWROOT/var/lib/dhclient/dhclient-$netif.leases"
|
||||
done
|
||||
|
||||
if [ ! -z "$ifname" ]; then
|
||||
MACX=${ifname#*:}
|
||||
ETHX=${ifname%:$MACX*}
|
||||
elif [ ! -z "$netdev" ]; then
|
||||
ETHX=$netdev
|
||||
MACX=`ip link show $netdev | grep ether | awk '{print $2}'`
|
||||
elif [ ! -z "$BOOTIF" ]; then
|
||||
MACX=$BOOTIF
|
||||
ETHX=$(getdevfrommac $BOOTIF)
|
||||
fi
|
||||
|
||||
if [ ! -z "$MACX" ] && [ ! -z "$ETHX" ]; then
|
||||
if [ ! -e $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX ]; then
|
||||
touch $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
echo "DEVICE=$ETHX" > $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
echo "BOOTPROTO=dhcp" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
echo "HWADDR=$MACX" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
echo "ONBOOT=yes" >> $NEWROOT/etc/sysconfig/network-scripts/ifcfg-$ETHX
|
||||
fi
|
||||
|
||||
cp /etc/resolv.conf "$NEWROOT/etc/"
|
||||
|
||||
if [ -d "$NEWROOT/etc/sysconfig" -a ! -e "$NEWROOT/etc/sysconfig/selinux" ]; then
|
||||
echo "SELINUX=disabled" >> "$NEWROOT/etc/sysconfig/selinux"
|
||||
fi
|
||||
|
@ -29,16 +29,16 @@ if [%3] EQU [bcdonly] set BCDONLY=1
|
||||
if [%WINPENAME%] NEQ [] set BOOTPATH=winboot\%WINPENAME%\Boot
|
||||
|
||||
::location where Windows PE from ADK install is located
|
||||
set adkpedir=%defdrive%\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Windows Preinstallation Environment
|
||||
set oscdimg=%defdrive%\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg
|
||||
set adkpedir=%defdrive%\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment
|
||||
set oscdimg=%defdrive%\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg
|
||||
set WinPERoot=%adkpedir%
|
||||
set OSCDImgRoot=%oscdimg%
|
||||
set Path=C:\Program Files (x86)\Windows Kits\8.0\Assessment and Deployment Kit\Deployment Tools\amd64\DISM;%Path%
|
||||
set Path=C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM;%Path%
|
||||
|
||||
::clean the c:\winPE_amd64 and copy it from ADK
|
||||
if exist %defdrive%\WinPE_%SUFFIX% rd %defdrive%\WinPE_%SUFFIX% /s /q
|
||||
set retpath=%cd%
|
||||
cd "%adkpedir%"
|
||||
cd /d "%adkpedir%"
|
||||
call copype.cmd %ARCH% %defdrive%\WinPE_%SUFFIX%
|
||||
cd /d %retpath%
|
||||
|
||||
@ -70,8 +70,8 @@ rem copy "%defdrive%\Program Files\Windows AIK\Tools\%ARCH%\imagex.exe" %defdriv
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-WMI.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-Scripting.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-RNDIS.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-NetFX4.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-PowerShell3.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-NetFX.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-PowerShell.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-DismCmdlets.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-StorageWMI.cab"
|
||||
dism /Image:%defdrive%\WinPE_%SUFFIX%\mount /add-package /packagepath:"%adkpedir%\amd64\WinPE_OCs\WinPE-WDS-Tools.cab"
|
||||
|
@ -722,6 +722,25 @@ sub read_conf{
|
||||
# pro_result
|
||||
#######################################
|
||||
sub pro_result{
|
||||
my $result = shift;
|
||||
my $mailprog = "/bin/mail";
|
||||
my $subject = "[xcat-autotest] autotest result ";
|
||||
my $message = "\n Host:172.20.0.21[Redhat 6.4 RC2]\n";
|
||||
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
|
||||
$message = $message." | RESULT | Remark \n";
|
||||
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
|
||||
if($result){
|
||||
$message = $message."| full installation | PASS |\n";
|
||||
} else{
|
||||
$message = $message."| full installation | FAIL |";
|
||||
}
|
||||
$message = $message."---------------------------------------------------------------------------------------------------------------\n";
|
||||
|
||||
$message = $message."Note: This message is sent by Automated test system, Please don't reply it\n";
|
||||
my $sendmail = "echo \"$message\"";
|
||||
my $email = "litingt\@cn.ibm.com";
|
||||
$sendmail = $sendmail." | $mailprog -s \"$subject\" \"$email\" ";
|
||||
system($sendmail);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -19,16 +19,19 @@ function splitconfig(){
|
||||
IFS=$','
|
||||
array_conf_temp=($1)
|
||||
IFS=$old_ifs
|
||||
for i in ${array_conf_temp[@]}
|
||||
|
||||
i=0
|
||||
while [ $i -lt ${#array_conf_temp[@]} ]
|
||||
do
|
||||
token="${array_conf_temp[$i]}"
|
||||
D=
|
||||
if [ `echo $i | grep "!"` ];then
|
||||
if echo "$token" | grep "!"; then
|
||||
D="!"
|
||||
else
|
||||
D=":"
|
||||
fi
|
||||
key=`echo $i | cut -d"$D" -f 1`
|
||||
str_temp_value=`echo $i | cut -d"$D" -f 2`
|
||||
key=`echo "$token" | cut -d"$D" -f 1`
|
||||
str_temp_value=`echo "$token" | cut -d"$D" -f 2`
|
||||
|
||||
str_temp=$(hashget hash_defined_nics $key)
|
||||
if [ -n "$str_temp" ];then
|
||||
@ -37,7 +40,8 @@ function splitconfig(){
|
||||
str_temp="$str_temp_value"
|
||||
str_all_nics=$str_all_nics"$key "
|
||||
fi
|
||||
hashset hash_defined_nics $key $str_temp
|
||||
hashset hash_defined_nics $key "$str_temp"
|
||||
i=$((i+1))
|
||||
done
|
||||
}
|
||||
|
||||
@ -198,8 +202,8 @@ if [ -z "$NICIPS" ];then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
splitconfig $NICIPS
|
||||
splitconfig $NICCUSTOMSCRIPTS
|
||||
splitconfig "$NICIPS"
|
||||
splitconfig "$NICCUSTOMSCRIPTS"
|
||||
|
||||
if [ $boot_myscript -eq 1 ];then
|
||||
. $str_dir_name/$myscript
|
||||
|
@ -508,7 +508,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then
|
||||
useflowcontrol=0
|
||||
fi
|
||||
fi
|
||||
/$xcatpost/getpostscript.awk | egrep '<data>' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /$xcatpost/mypostscript;
|
||||
/$xcatpost/getpostscript.awk | egrep '<data>' | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript;
|
||||
|
||||
|
||||
MYCONT=`grep MASTER /$xcatpost/mypostscript`
|
||||
@ -539,7 +539,7 @@ if [ ! -x /$xcatpost/mypostscript ]; then
|
||||
useflowcontrol=0
|
||||
fi
|
||||
fi
|
||||
/$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' > /$xcatpost/mypostscript;
|
||||
/$xcatpost/getpostscript.awk | sed -e 's/<[^>]*>//g'|egrep -v '^ *$'|sed -e 's/^ *//' | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/\&/g' -e 's/"/"/g' -e "s/'/'/g" > /$xcatpost/mypostscript;
|
||||
MYCONT=`grep MASTER /$xcatpost/mypostscript`
|
||||
if [ ! -z "$MYCONT" ]; then
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user