xcat-core/perl-xCAT/xCAT/Scope.pm
2012-08-09 03:48:50 +00:00

39 lines
1.1 KiB
Perl

package xCAT::Scope;
use xCAT::Utils;
use xCAT::Table;
use xCAT::ServiceNodeUtils qw(getSNList);
sub get_broadcast_scope {
my $req = shift;
if ($req =~ /xCAT::Scope/) {
$req = shift;
}
$callback = shift;
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
#Exit if the packet has been preprocessed in its history
my @requests = ({%$req}); #Start with a straight copy to reflect local instance
foreach (xCAT::ServiceNodeUtils->getSNList()) {
if (xCAT::NetworkUtils->thishostisnot($_)) {
my $reqcopy = {%$req};
$reqcopy->{'_xcatdest'} = $_;
$reqcopy->{_xcatpreprocessed}->[0] = 1;
push @requests,$reqcopy;
}
}
return \@requests;
#my $sitetab = xCAT::Table->new('site');
#(my $ent) = $sitetab->getAttribs({key=>'xcatservers'},'value');
#$sitetab->close;
#if ($ent and $ent->{value}) {
# foreach (split /,/,$ent->{value}) {
# if (xCAT::NetworkUtils->thishostisnot($_)) {
# my $reqcopy = {%$req};
# $reqcopy->{'_xcatdest'} = $_;
# push @requests,$reqcopy;
# }
# }
#}
#return \@requests;
}
1;