Commit 1c482bab authored by Michael Hanselmann's avatar Michael Hanselmann

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

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent b21d8c7f
......@@ -480,6 +480,20 @@ parameters must be passed:
evacuate?iallocator=[iallocator]
evacuate?remote_node=[nodeX.example.com]
``/2/nodes/[node_name]/migrate``
+++++++++++++++++++++++++++++++++
Migrates all primary instances from a node.
It supports the following commands: ``POST``.
``POST``
~~~~~~~~
No parameters are required, but ``live`` can be set to a boolean value.
migrate?live=[0|1]
``/2/nodes/[node_name]/role``
+++++++++++++++++++++++++++++
......
......@@ -157,6 +157,8 @@ CONNECTOR.update({
re.compile(r'^/2/nodes/([\w\._-]+)/role$'): rlib2.R_2_nodes_name_role,
re.compile(r'^/2/nodes/([\w\._-]+)/evacuate$'):
rlib2.R_2_nodes_name_evacuate,
re.compile(r'^/2/nodes/([\w\._-]+)/migrate$'):
rlib2.R_2_nodes_name_migrate,
"/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,
......
......@@ -280,6 +280,22 @@ class R_2_nodes_name_evacuate(baserlib.R_Generic):
return baserlib.SubmitJob([op])
class R_2_nodes_name_migrate(baserlib.R_Generic):
"""/2/nodes/[node_name]/evacuate migrate.
"""
def POST(self):
"""Migrate all primary instances from a node.
"""
node_name = self.items[0]
live = bool(self._checkIntVariable("live", default=1))
op = opcodes.OpMigrateNode(node_name=node_name, live=live)
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