Commit d6c970fc authored by Leigh B Stoller's avatar Leigh B Stoller

Temporary gross hacks to avoid breakage when an RPC fails. I am in

the midst of a full cleanup in my devel tree.
parent 417da381
......@@ -3222,12 +3222,12 @@ sub DoPanic()
my $response = $sliver->Panic(($setclr eq "clear" ? 1 : 0));
if (!defined($response)) {
print STDERR "RPC Error calling Panic\n";
return -1;
return GENIRESPONSE_RPCERROR;
}
if ($response->code() != GENIRESPONSE_SUCCESS) {
print STDERR "Could not panic sliver: ".
$response->output() . "\n";
return -1;
return $response->code();
}
return 0;
};
......@@ -3330,7 +3330,7 @@ sub DoLinktest()
my $response = $sliver->RunLinktest($action, $level);
if (!defined($response)) {
print STDERR "RPC Error calling linktest on $sliver\n";
return -1;
return GENIRESPONSE_RPCERROR;
}
if ($response->code() != GENIRESPONSE_SUCCESS) {
print STDERR "Could not $action linktest on sliver: ".
......@@ -3532,7 +3532,7 @@ sub DoUpdateKeys()
my $response = $sliver->UpdateKeys($users);
if (!defined($response)) {
print STDERR "RPC Error calling updatekeys on $sliver\n";
return -1;
return GENIRESPONSE_RPCERROR;
}
if ($response->code() != GENIRESPONSE_SUCCESS) {
print STDERR "Could not update keys on sliver: ".
......@@ -4342,13 +4342,21 @@ sub CallAggregateMethod($$@)
my $response = $sliver->$method();
if (!defined($response)) {
$errmsg = "RPC Error calling $method on $sliver";
$errcode = -1;
$errcode = GENIRESPONSE_RPCERROR;
goto bad;
}
if ($response->code() != GENIRESPONSE_SUCCESS) {
$errmsg = "Could not call $method for $sliver: " .
$response->output();
$errcode = $response->code();
if ($response->code() == GENIRESPONSE_SERVER_UNAVAILABLE ||
$response->code() == GENIRESPONSE_RPCERROR) {
$errcode = GENIRESPONSE_RPCERROR;
$errmsg = "RPC Error calling $method on $sliver; ".
"server unavailable, try again later";
}
else {
$errcode = $response->code();
$errmsg = "Error calling $method for $sliver: " .
$response->output();
}
goto bad;
}
if (defined($pref)) {
......@@ -4402,7 +4410,7 @@ sub CallAggregateMethod($$@)
$errmsg .= ": " . $agg->webtask()->output();
}
$$prval = $errmsg;
return $code;
return $agg->webtask()->exitcode();
}
push(@return_values, $agg->webtask()->results());
}
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
# Copyright (c) 2000-2018 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -849,16 +849,18 @@ sub DoSystemInfo()
#
if (defined($webtask)) {
$webtask->output($response->output());
$webtask->Exited(-1);
$webtask->Exited($response->code());
$webtask->Store();
}
else {
print STDERR "$authority: " . $response->output() . "\n";
}
return -1;
return $response->code();
}
if (defined($webtask)) {
$webtask->value($response->value());
$webtask->Exited(0);
$webtask->Store();
}
return 0;
};
......@@ -1006,12 +1008,13 @@ sub DoPrediction()
#
if (defined($webtask)) {
$webtask->output($response->output());
$webtask->Exited(-1);
$webtask->Exited($response->code());
$webtask->Store();
}
else {
print STDERR "$authority: " . $response->output() . "\n";
}
return -1;
return $response->code();
}
if (defined($webtask)) {
$webtask->value($response->value());
......@@ -1042,7 +1045,7 @@ sub DoPrediction()
# The parent caught a signal. Leave things intact so that we can
# kill things cleanly later.
#
$errmsg = "Internal error get reservation prediction info";
$errmsg = "Internal error getting reservation prediction info";
goto bad;
}
#
......
#!/usr/bin/perl -w
#
# Copyright (c) 2008-2016 University of Utah and the Flux Group.
# Copyright (c) 2008-2016, 2018 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -423,6 +423,9 @@ sub CallMethodInternal($$$$@)
print STDERR "CallMethod: $method failed: $code";
print STDERR ", $output\n" if (defined($output) && $output ne "");
}
if ($code == GENIRESPONSE_SERVER_UNAVAILABLE) {
$code = GENIRESPONSE_RPCERROR;
}
return GeniResponse->new($code, $value, $output, $logurl);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment