Commit 878b4645 authored by Gary Wong's avatar Gary Wong
Browse files

Add an "available" parameter to DiscoverResources, which when set limits

the output to the nodes currently available.
parent 8b4da64f
......@@ -237,6 +237,7 @@ sub DiscoverResources($)
{
my ($argref) = @_;
my $credential = $argref->{'credential'};
my $available = $argref->{'available'};
my $user_uuid = $ENV{'GENIUSER'};
$credential = GeniCredential->CreateFromSigned($credential);
......@@ -250,6 +251,11 @@ sub DiscoverResources($)
"Invalid credentials for operation");
}
# Oh, for $*%(s sake. Frontier::RPC2 insists on representing a
# Boolean as its own object type -- which Perl always interprets as
# true, regardless of the object's value. Undo all of that silliness.
$available = defined( $available ) && $available->value;
#
# A sitevar controls whether external users can get any nodes.
#
......@@ -270,7 +276,9 @@ sub DiscoverResources($)
#
# Use ptopgen in xml mode to spit back an xml file.
#
if (! open(AVAIL, "$PTOPGEN -x -g -r -p GeniSlices |")) {
my $invocation = "$PTOPGEN -x -g -r -p GeniSlices";
$invocation .= " -a" unless $available;
if (! open(AVAIL, "$invocation |")) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Could not start avail");
}
......
......@@ -53,6 +53,7 @@ for manager in response["value"]:
#
params = {}
params["credential"] = mycredential
params["available"] = True
rval,response = do_method(None,
"DiscoverResources", params, manager["url"])
if rval:
......
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