more on prescripts
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3982 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
f688e3f09f
commit
cee982b877
@ -58,7 +58,7 @@ sub preprocess_request
|
||||
Getopt::Long::Configure("bundling");
|
||||
Getopt::Long::Configure("pass_through");
|
||||
GetOptions('l' => \$::LOCAL);
|
||||
my $sn = xCAT::Utils->get_ServiceNode($nodes, $service, "MN");
|
||||
my $sn = xCAT::Utils->getSNformattedhash($nodes, $service, "MN");
|
||||
my @requests;
|
||||
if ($::LOCAL) { #only handle the local nodes
|
||||
print "process local nodes: @$nodes\n";
|
||||
@ -164,7 +164,7 @@ sub runbeginpre
|
||||
if ($runnodes && (@$runnodes>0)) {
|
||||
my $runnodes_s=join(',', @$runnodes);
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0]="$localhostname: Running $scripts for nodes $runnodes_s.";
|
||||
$rsp->{data}->[0]="$localhostname: Running begin scripts $scripts for nodes $runnodes_s.";
|
||||
$callback->($rsp);
|
||||
|
||||
#now run the scripts
|
||||
@ -217,7 +217,7 @@ sub runendpre
|
||||
my %runnodes_hash=();
|
||||
|
||||
my $rsp = {};
|
||||
$rsp->{data}->[0]="$localhostname: Running $scripts for nodes $runnodes_s.";
|
||||
$rsp->{data}->[0]="$localhostname: Running end scripts $scripts for nodes $runnodes_s.";
|
||||
$callback->($rsp);
|
||||
|
||||
#now run the scripts
|
||||
|
@ -9,7 +9,6 @@ use Getopt::Long;
|
||||
|
||||
my $request;
|
||||
my $callback;
|
||||
my $callback1;
|
||||
my $dhcpconf = "/etc/dhcpd.conf";
|
||||
my $tftpdir = "/tftpboot";
|
||||
#my $dhcpver = 3;
|
||||
@ -222,26 +221,12 @@ sub pass_along {
|
||||
}
|
||||
}
|
||||
|
||||
sub pass_along1 {
|
||||
my $resp = shift;
|
||||
$callback1->($resp);
|
||||
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
|
||||
$errored=1;
|
||||
}
|
||||
foreach (@{$resp->{node}}) {
|
||||
if ($_->{error} or $_->{errorcode}) {
|
||||
$errored=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub preprocess_request {
|
||||
my $req = shift;
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
|
||||
$callback1 = shift;
|
||||
my $callback1 = shift;
|
||||
my $command = $req->{command}->[0];
|
||||
my $sub_req = shift;
|
||||
my @args=();
|
||||
@ -290,20 +275,6 @@ sub preprocess_request {
|
||||
return;
|
||||
}
|
||||
|
||||
#now run the begin part of the prescripts
|
||||
my @nodes=();
|
||||
if (ref($req->{node})) {
|
||||
@nodes = @{$req->{node}};
|
||||
} else {
|
||||
if ($req->{node}) { @nodes = ($req->{node}); }
|
||||
}
|
||||
$errored=0;
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@nodes,
|
||||
arg=>[$args[0]]},\&pass_along1);
|
||||
}
|
||||
if ($errored) { return; }
|
||||
|
||||
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
|
||||
#they specify no sharedtftp in site table
|
||||
@ -403,7 +374,29 @@ sub process_request {
|
||||
} else {
|
||||
@nodes = @rnodes;
|
||||
}
|
||||
|
||||
|
||||
if (ref($request->{arg})) {
|
||||
@args=@{$request->{arg}};
|
||||
} else {
|
||||
@args=($request->{arg});
|
||||
}
|
||||
|
||||
#now run the begin part of the prescripts
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$errored=0;
|
||||
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@nodes,
|
||||
arg=>[$args[0], '-l']},\&pass_along);
|
||||
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@rnodes,
|
||||
arg=>[$args[0]]},\&pass_along);
|
||||
}
|
||||
if ($errored) { return; }
|
||||
}
|
||||
|
||||
#back to normal business
|
||||
if (! -r "$tftpdir/pxelinux.0") {
|
||||
unless (-r "/usr/lib/syslinux/pxelinux.0" or -r "/usr/share/syslinux/pxelinux.0") {
|
||||
$callback->({error=>["Unable to find pxelinux.0 "],errorcode=>[1]});
|
||||
@ -422,11 +415,7 @@ sub process_request {
|
||||
}
|
||||
|
||||
|
||||
if (ref($request->{arg})) {
|
||||
@args=@{$request->{arg}};
|
||||
} else {
|
||||
@args=($request->{arg});
|
||||
}
|
||||
|
||||
$errored=0;
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$sub_req->({command=>['setdestiny'],
|
||||
|
@ -11,7 +11,6 @@ my $request;
|
||||
my %breaknetbootnodes;
|
||||
my %normalnodes;
|
||||
my $callback;
|
||||
my $callback1;
|
||||
my $sub_req;
|
||||
my $dhcpconf = "/etc/dhcpd.conf";
|
||||
my $tftpdir = "/tftpboot";
|
||||
@ -205,28 +204,12 @@ sub pass_along {
|
||||
}
|
||||
}
|
||||
|
||||
sub pass_along1 {
|
||||
print "pass_along1\n";
|
||||
my $resp = shift;
|
||||
|
||||
# print Dumper($resp);
|
||||
|
||||
$callback1->($resp);
|
||||
if ($resp and ($resp->{errorcode} and $resp->{errorcode}->[0]) or ($resp->{error} and $resp->{error}->[0])) {
|
||||
$errored=1;
|
||||
}
|
||||
foreach (@{$resp->{node}}) {
|
||||
if ($_->{error} or $_->{errorcode}) {
|
||||
$errored=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub preprocess_request {
|
||||
my $req = shift;
|
||||
if ($req->{_xcatpreprocessed}->[0] == 1) { return [$req]; }
|
||||
|
||||
$callback1 = shift;
|
||||
my $callback1 = shift;
|
||||
my $command = $req->{command}->[0];
|
||||
my $sub_req = shift;
|
||||
my @args=();
|
||||
@ -275,20 +258,6 @@ sub preprocess_request {
|
||||
return;
|
||||
}
|
||||
|
||||
#now run the begin part of the prescripts
|
||||
my @nodes=();
|
||||
if (ref($req->{node})) {
|
||||
@nodes = @{$req->{node}};
|
||||
} else {
|
||||
if ($req->{node}) { @nodes = ($req->{node}); }
|
||||
}
|
||||
$errored=0;
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@nodes,
|
||||
arg=>[$args[0]]},\&pass_along1);
|
||||
}
|
||||
if ($errored) { return; }
|
||||
|
||||
#Assume shared tftp directory for boring people, but for cool people, help sync up tftpdirectory contents when
|
||||
#they specify no sharedtftp in site table
|
||||
@ -363,7 +332,6 @@ sub process_request {
|
||||
return;
|
||||
}
|
||||
|
||||
#back to normal business
|
||||
#if not shared tftpdir, then filter, otherwise, set up everything
|
||||
if ($request->{'_disparatetftp'}->[0]) { #reading hint from preprocess_command
|
||||
@nodes = ();
|
||||
@ -383,6 +351,22 @@ sub process_request {
|
||||
@args=($request->{arg});
|
||||
}
|
||||
|
||||
#now run the begin part of the prescripts
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$errored=0;
|
||||
if ($request->{'_disparatetftp'}->[0]) { #the call is distrubuted to the service node already, so only need to handles my own children
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@nodes,
|
||||
arg=>[$args[0], '-l']},\&pass_along);
|
||||
} else { #nodeset did not distribute to the service node, here we need to let runednpre to distribute the nodes to their masters
|
||||
$sub_req->({command=>['runbeginpre'],
|
||||
node=>\@rnodes,
|
||||
arg=>[$args[0]]},\&pass_along);
|
||||
}
|
||||
if ($errored) { return; }
|
||||
}
|
||||
|
||||
#back to normal business
|
||||
$errored=0;
|
||||
unless ($args[0] eq 'stat') { # or $args[0] eq 'enact') {
|
||||
$sub_req->({command=>['setdestiny'],
|
||||
|
Loading…
Reference in New Issue
Block a user