Skip to content
Snippets Groups Projects
Commit 4ee72287 authored by René Nussbaumer's avatar René Nussbaumer
Browse files

Adding RAPI resource for multi-allocation


This is straightforward.

Signed-off-by: default avatarRené Nussbaumer <rn@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent d4752785
No related branches found
No related tags found
No related merge requests found
......@@ -628,6 +628,25 @@ to URI like::
It supports the ``dry-run`` argument.
``/2/instances-multi-alloc``
++++++++++++++++++++++++++++
Tries to allocate multiple instances.
It supports the following commands: ``POST``
``POST``
~~~~~~~~
The parameters:
.. opcode_params:: OP_INSTANCE_MULTI_ALLOC
Job result:
.. opcode_result:: OP_INSTANCE_MULTI_ALLOC
``/2/instances``
++++++++++++++++
......
......@@ -185,6 +185,7 @@ def GetHandlers(node_name_pattern, instance_name_pattern,
re.compile(r"^/2/jobs/(%s)/wait$" % job_id_pattern):
rlib2.R_2_jobs_id_wait,
"/2/instances-multi-alloc": rlib2.R_2_instances_multi_alloc,
"/2/tags": rlib2.R_2_tags,
"/2/info": rlib2.R_2_info,
"/2/os": rlib2.R_2_os,
......
......@@ -812,6 +812,24 @@ class R_2_instances(baserlib.OpcodeResource):
})
class R_2_instances_multi_alloc(baserlib.OpcodeResource):
"""/2/instances-multi-alloc resource.
"""
POST_OPCODE = opcodes.OpInstanceMultiAlloc
def GetPostOpInput(self):
"""Try to allocate multiple instances.
@return: A dict with submitted jobs, allocatable instances and failed
allocations
"""
return (self.request_body, {
"dry_run": self.dryRun(),
})
class R_2_instances_name(baserlib.OpcodeResource):
"""/2/instances/[instance_name] resource.
......
......@@ -46,6 +46,7 @@ import testutils
_KNOWN_UNUSED = set([
rlib2.R_root,
rlib2.R_2,
rlib2.R_2_instances_multi_alloc,
])
# Global variable for collecting used handlers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment