Commit 7a95a954 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

rapi: Add /2/nodes/[node_name]/storage resource


Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 131178b9
......@@ -528,6 +528,19 @@ job id.
It supports the ``force`` argument.
``/2/nodes/[node_name]/storage``
++++++++++++++++++++++++++++++++
Manages storage units on the node.
``GET``
~~~~~~~
Requests a list of storage units on a node. Requires the parameters
``storage_type`` (one of ``file``, ``lvm-pv`` or ``lvm-vg``) and
``output_fields``. The result will be a job id, using which the result can be
retrieved.
``/2/nodes/[node_name]/tags``
+++++++++++++++++++++++++++++
......
......@@ -159,6 +159,8 @@ CONNECTOR.update({
rlib2.R_2_nodes_name_evacuate,
re.compile(r'^/2/nodes/([\w\._-]+)/migrate$'):
rlib2.R_2_nodes_name_migrate,
re.compile(r'^/2/nodes/([\w\._-]+)/storage$'):
rlib2.R_2_nodes_name_storage,
"/2/instances": rlib2.R_2_instances,
re.compile(r'^/2/instances/([\w\._-]+)$'): rlib2.R_2_instances_name,
re.compile(r'^/2/instances/([\w\._-]+)/tags$'): rlib2.R_2_instances_name_tags,
......
......@@ -281,7 +281,7 @@ class R_2_nodes_name_evacuate(baserlib.R_Generic):
class R_2_nodes_name_migrate(baserlib.R_Generic):
"""/2/nodes/[node_name]/evacuate migrate.
"""/2/nodes/[node_name]/migrate resource.
"""
def POST(self):
......@@ -296,6 +296,32 @@ class R_2_nodes_name_migrate(baserlib.R_Generic):
return baserlib.SubmitJob([op])
class R_2_nodes_name_storage(baserlib.R_Generic):
"""/2/nodes/[node_name]/storage ressource.
"""
# LUQueryNodeStorage acquires locks, hence restricting access to GET
GET_ACCESS = [rapi.RAPI_ACCESS_WRITE]
def GET(self):
node_name = self.items[0]
storage_type = self._checkStringVariable("storage_type", None)
if not storage_type:
raise http.HttpBadRequest("Missing the required 'storage_type'"
" parameter")
output_fields = self._checkStringVariable("output_fields", None)
if not output_fields:
raise http.HttpBadRequest("Missing the required 'output_fields'"
" parameter")
op = opcodes.OpQueryNodeStorage(nodes=[node_name],
storage_type=storage_type,
output_fields=output_fields.split(","))
return baserlib.SubmitJob([op])
class R_2_instances(baserlib.R_Generic):
"""/2/instances resource.
......
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