be121bafb2
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3194 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
46 lines
1.1 KiB
Perl
Executable File
46 lines
1.1 KiB
Perl
Executable File
#!/usr/bin/env perl
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
BEGIN { $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : -d '/opt/xcat' ? '/opt/xcat' : '/usr'; }
|
|
use lib "$::XCATROOT/lib/perl";
|
|
use Data::Dumper;
|
|
use xCAT::Client;
|
|
use strict;
|
|
my %output;
|
|
while (<STDIN>) {
|
|
my $node;
|
|
my $output;
|
|
if (/:/) {
|
|
($node,$output) = split /:/,$_,2;
|
|
} else {
|
|
$node= "UNKNOWN";
|
|
$output = $_;
|
|
}
|
|
$output =~ s/^ //;
|
|
$output{$node}.=$output;
|
|
}
|
|
my %collated;
|
|
foreach (keys %output) {
|
|
$collated{$output{$_}}->{$_}=1;
|
|
}
|
|
|
|
my $nodes;
|
|
sub fillerup {
|
|
my $response = shift;
|
|
if ($response->{data}->[0]) {
|
|
$nodes = $response->{data}->[0];
|
|
}
|
|
}
|
|
foreach my $output (keys %collated) {
|
|
$nodes = join(',',sort (keys %{$collated{$output}}));
|
|
my $cmdref = {
|
|
noderange => [$nodes],
|
|
command => ['rnoderange'],
|
|
};
|
|
xCAT::Client::submit_request($cmdref,\&fillerup);
|
|
print "====================================\n";
|
|
print "$nodes\n";
|
|
print "====================================\n";
|
|
print $output;
|
|
print "\n";
|
|
}
|