From ca225c7dfed74365177d90a86f6b6422277f6df9 Mon Sep 17 00:00:00 2001 From: nott Date: Tue, 1 Feb 2011 17:01:40 +0000 Subject: [PATCH] check for duplicate entries in statelite table git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8780 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- perl-xCAT/xCAT/InstUtils.pm | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/perl-xCAT/xCAT/InstUtils.pm b/perl-xCAT/xCAT/InstUtils.pm index 5ba19bd1e..e55a14741 100644 --- a/perl-xCAT/xCAT/InstUtils.pm +++ b/perl-xCAT/xCAT/InstUtils.pm @@ -894,6 +894,34 @@ sub dolitesetup return 1; } + # + # Check the statelite table for duplicate node entries + # + my $recs=$statelitetab->getAllEntries(); + my @SLnodes; + foreach my $entry (@$recs) { + + # get the "node" value + my $node = $entry->{node}; + + # run it through noderange + my @newnodes = xCAT::NodeRange::noderange($node); + + # for each node - see if it's already in the list + foreach my $n (@newnodes) { + if (!grep (/^$n$/, @SLnodes) ) { + push(@SLnodes, $n); + } else { + # if it's already in the list then this is an error + my $rsp; + push @{$rsp->{data}}, "The node \'$n\' is included in multiple statelite entries.\n"; + xCAT::MsgUtils->message("E", $rsp, $callback); + return 1; + } + } + } + + # create the statelite table file my $stateHash = $statelitetab->getNodesAttribs(\@nodelist, ['statemnt']); foreach my $node (@nodelist) { @@ -945,6 +973,7 @@ sub dolitesetup } my @filelist = xCAT::Utils->runcmd("/opt/xcat/bin/litefile $noderange", -1); + foreach my $l (@filelist) { $l =~ s/://g; # remove ":"'s $l =~ s/\s+/|/g; # change separator to "|"