diff --git a/daemons/ganeti-noded b/daemons/ganeti-noded index 495b65c21e93e57869e74edef9deed58a3aaee0b..6c5831182889c4ce7e5bc3cfed465de319fc8b7d 100755 --- a/daemons/ganeti-noded +++ b/daemons/ganeti-noded @@ -362,6 +362,7 @@ class NodeDaemonRequestHandler(http.HTTPRequestHandler): """ instance, target, live = params + instance = objects.Instance.FromDict(instance) return backend.MigrateInstance(instance, target, live) @staticmethod diff --git a/lib/backend.py b/lib/backend.py index 7dbce0c6c64b96f1188918c554b4a2d85b0535db..5e11fcb0adc8b24217908e50ee5fea0178f27dce 100644 --- a/lib/backend.py +++ b/lib/backend.py @@ -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) diff --git a/lib/rpc.py b/lib/rpc.py index 14a618580ee5b15cccc9919d6ed702a0f3980eb9..2a8e98bd36af2867c83868801677e34dfbab7788 100644 --- a/lib/rpc.py +++ b/lib/rpc.py @@ -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)