From 13c1aa146a8f382dae237d8d21e4285c9921a0aa Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Fri, 2 May 2008 01:43:35 +0000 Subject: [PATCH] -Restore disparate tftp directory support to pxe plugin when requested git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1246 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server-2.0/lib/xcat/plugins/pxe.pm | 34 +++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/xCAT-server-2.0/lib/xcat/plugins/pxe.pm b/xCAT-server-2.0/lib/xcat/plugins/pxe.pm index 91618f851..13015774c 100644 --- a/xCAT-server-2.0/lib/xcat/plugins/pxe.pm +++ b/xCAT-server-2.0/lib/xcat/plugins/pxe.pm @@ -143,9 +143,18 @@ sub pass_along { -# Removing hierarchy, command will be processed on the MN. -# If hierachy is put back the code my change to use Utils->get_Servicenode -# and not use xcatservers from the site table. +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 $req = shift; + my $sent = $stab->getAttribs({key=>'sharedtftp'},'value'); + if ($sent and ($sent->{value} == 0 or $ent->{value} =~ /no/i)) { + $req->{'_disparatetftp'}=[1]; + return xCAT::Scope->get_broadcast_scope($req,@_); + } + return [$req]; +} #sub preprocess_request { # my $req = shift; # $callback = shift; @@ -217,13 +226,18 @@ sub process_request { } return; } - @nodes = @rnodes; - #@nodes = (); - #foreach (@rnodes) { - #if (xCAT::Utils->nodeonmynet($_)) { - # push @nodes,$_; - #} - #} + #if not shared, then help sync up + if ($req->{_disparatetftp}) { #reading hint from preprocess_command + @nodes = (); + foreach (@rnodes) { + if (xCAT::Utils->nodeonmynet($_)) { + push @nodes,$_; + } + } + } else { + @nodes = @rnodes; + } + if (! -r "$tftpdir/pxelinux.0") { unless (-r "/usr/lib/syslinux/pxelinux.0") { $callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});