diff --git a/xCAT-server/lib/xcat/plugins/yaboot.pm b/xCAT-server/lib/xcat/plugins/yaboot.pm index 6351ff2e6..2988a926a 100644 --- a/xCAT-server/lib/xcat/plugins/yaboot.pm +++ b/xCAT-server/lib/xcat/plugins/yaboot.pm @@ -5,6 +5,7 @@ use Sys::Syslog; use xCAT::Scope; use xCAT::Utils; use xCAT::TableUtils; +use xCAT::ServiceNodeUtils; use xCAT::NetworkUtils; use xCAT::MsgUtils; use File::Path; @@ -334,7 +335,7 @@ sub preprocess_request { @args=($req->{arg}); } @ARGV = @args; - + my $nodes = $req->{node}; #use Getopt::Long; Getopt::Long::Configure("bundling"); Getopt::Long::Configure("pass_through"); @@ -375,13 +376,23 @@ sub preprocess_request { #Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when - #they specify no sharedtftp in site table - #my $stab = xCAT::Table->new('site'); - - #my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); + #if they specify no sharedtftp in site table my @entries = xCAT::TableUtils->get_site_attribute("sharedtftp"); my $t_entry = $entries[0]; if ( defined($t_entry) and ($t_entry == 0 or $t_entry =~ /no/i)) { + # check for computenodes and servicenodes from the noderange, if so error out + my @SN; + my @CN; + xCAT::ServiceNodeUtils->getSNandCPnodes(\@$nodes, \@SN, \@CN); + if ((@SN > 0) && (@CN >0 )) { # there are both SN and CN + my $rsp; + $rsp->{data}->[0] = + "Nodeset was run with a noderange containing both service nodes and compute nodes. This is not valid. You must submit with either compute nodes in the noderange or service nodes. \n"; + xCAT::MsgUtils->message("E", $rsp, $callback1); + return; + + } + $req->{'_disparatetftp'}=[1]; if ($req->{inittime}->[0]) { return [$req]; @@ -390,40 +401,6 @@ sub preprocess_request { } return [$req]; } -#sub preprocess_request { -# my $req = shift; -# my $callback = shift; -# my %localnodehash; -# my %dispatchhash; -# my $nrtab = xCAT::Table->new('noderes'); -# foreach my $node (@{$req->{node}}) { -# my $nodeserver; -# my $tent = $nrtab->getNodeAttribs($node,['tftpserver']); -# if ($tent) { $nodeserver = $tent->{tftpserver} } -# unless ($tent and $tent->{tftpserver}) { -# $tent = $nrtab->getNodeAttribs($node,['servicenode']); -# if ($tent) { $nodeserver = $tent->{servicenode} } -# } -# if ($nodeserver) { -# $dispatchhash{$nodeserver}->{$node} = 1; -# } else { -# $localnodehash{$node} = 1; -# } -# } -# my @requests; -# my $reqc = {%$req}; -# $reqc->{node} = [ keys %localnodehash ]; -# if (scalar(@{$reqc->{node}})) { push @requests,$reqc } -# -# foreach my $dtarg (keys %dispatchhash) { #iterate dispatch targets -# my $reqcopy = {%$req}; #deep copy -# $reqcopy->{'_xcatdest'} = $dtarg; -# $reqcopy->{node} = [ keys %{$dispatchhash{$dtarg}}]; -# push @requests,$reqcopy; -# } -# return \@requests; -#} -# sub process_request {