Commit 9f0e6b37 authored by Iustin Pop's avatar Iustin Pop
Browse files

rpc.call_instance_migrate: pass the whole instance

Currently the call_instance_migrate call only passes the instance name;
we need to pass the whole object for the hypervisor_type changes (all
the other individual instance rpc calls already pass the instance
object).

Reviewed-by: imsnah
parent cd55576a
......@@ -362,6 +362,7 @@ class NodeDaemonRequestHandler(http.HTTPRequestHandler):
"""
instance, target, live = params
instance = objects.Instance.FromDict(instance)
return backend.MigrateInstance(instance, target, live)
@staticmethod
......
......@@ -771,11 +771,23 @@ def RebootInstance(instance, reboot_type, extra_args):
def MigrateInstance(instance, target, live):
"""Migrates an instance to another node.
@type instance: C{objects.Instance}
@param instance: the instance definition
@type target: string
@param target: the target node name
@type live: boolean
@param live: whether the migration should be done live or not (the
interpretation of this parameter is left to the hypervisor)
@rtype: tuple
@return: a tuple of (success, msg) where:
- succes is a boolean denoting the success/failure of the operation
- msg is a string with details in case of failure
"""
hyper = hypervisor.GetHypervisor(_GetConfig())
try:
hyper.MigrateInstance(instance, target, live)
hyper.MigrateInstance(instance.name, target, live)
except errors.HypervisorError, err:
msg = "Failed to migrate instance: %s" % str(err)
logging.error(msg)
......
......@@ -209,8 +209,18 @@ def call_instance_migrate(node, instance, target, live):
This is a single-node call.
"""
c = Client("instance_migrate", [instance.name, target, live])
@type node: string
@param node: the node on which the instance is currently running
@type instance: instance object
@param instance: the instance definition
@type target: string
@param target: the target node name
@type live: boolean
@param live: whether the migration should be done live or not (the
interpretation of this parameter is left to the hypervisor)
"""
c = Client("instance_migrate", [instance.ToDict(), target, live])
c.connect(node)
c.run()
return c.getresult().get(node, False)
......
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