makeconservercf: skip adding node to the cf file if nodehm.cons is not defined for this node

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1226 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2008-04-29 23:45:00 +00:00
parent 0ac6b30f4d
commit 71a215a705

View File

@ -89,16 +89,17 @@ sub preprocess_request {
if ($noderange && @$noderange>0) {
$allnodes=0;
foreach my $node (@$noderange) {
my $ent=$hmtab->getNodeAttribs($node,['node', 'conserver']);
my $ent=$hmtab->getNodeAttribs($node,['node', 'cons', 'conserver']);
push @items,$ent;
}
} else {
$allnodes=1;
@items = $hmtab->getAllNodeAttribs(['node', 'conserver']);
@items = $hmtab->getAllNodeAttribs(['node', 'cons', 'conserver']);
}
my @nodes=();
foreach (@items) {
if ((!defined($_->{cons})) || ($_->{cons} eq "")) { next;} #skip if 'cons' is not defined for this node
if (defined($_->{conserver})) { push @{$cons_hash{$_->{conserver}}{nodes}}, $_->{node};}
else { push @{$cons_hash{$master}{nodes}}, $_->{node};}
push @nodes,$_->{node};
@ -128,7 +129,7 @@ sub preprocess_request {
if ($doit) {
my $reqcopy = {%$request};
$reqcopy->{'_xcatdest'} = $cons;
$reqcopy->{'_allnodes'} = $allnodes; # the original command comes with nodes or not
$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";
@ -211,10 +212,17 @@ sub makeconservercf {
#print "process_request nodes=@$nodes\n";
my $hmtab = xCAT::Table->new('nodehm');
my @cfgents = $hmtab->getAllNodeAttribs(['mgt','cons','conserver']);
my @cfgents1 = $hmtab->getAllNodeAttribs(['cons','conserver']);
#cfgents should now have all the nodes, so we can fill in our hashes one at a time.
# skip the one that does not have 'cons' defined
my @cfgents=();
foreach (@cfgents1) {
if ($_->{cons}) { push @cfgents, $_; }
}
# get the teminal servers and terminal port when cons is mrv or cyclades
foreach (@cfgents) {
unless ($_->{cons}) {$_->{cons} = $_->{mgt};} #populate with fallback
my $cmeth=$_->{cons};
if (grep(/^$cmeth$/,@cservers)) { #terminal server, more attribs needed
my $node = $_->{node};
@ -224,9 +232,11 @@ sub makeconservercf {
$_->{termport}= $tent->{termport};
}
}
# nodes defined, it is either on the service node or mkconserver is call with noderange on mn
if (($nodes and @$nodes > 0) or $req->{noderange}->[0]) {
# strip all xCAT configured stuff from config if the original command was for all nodes
if ($req->{_allnodes}==1) {zapcfg(\@filecontent);}
if (($req->{_allnodes}) && ($req->{_allnodes}->[0]==1)) {zapcfg(\@filecontent);}
foreach (@$nodes) {
my $node = $_;
foreach (@cfgents) {