+ return (True, "Reboot successful")
+
+
+def MigrationInfo(instance):
+ """Gather information about an instance to be migrated.
+
+ @type instance: L{objects.Instance}
+ @param instance: the instance definition
+
+ """
+ hyper = hypervisor.GetHypervisor(instance.hypervisor)
+ try:
+ info = hyper.MigrationInfo(instance)
+ except errors.HypervisorError, err:
+ msg = "Failed to fetch migration information"
+ logging.exception(msg)
+ return (False, '%s: %s' % (msg, err))
+ return (True, info)
+
+
+def AcceptInstance(instance, info, target):
+ """Prepare the node to accept an instance.
+
+ @type instance: L{objects.Instance}
+ @param instance: the instance definition
+ @type info: string/data (opaque)
+ @param info: migration information, from the source node
+ @type target: string
+ @param target: target host (usually ip), on this node
+
+ """
+ hyper = hypervisor.GetHypervisor(instance.hypervisor)
+ try:
+ hyper.AcceptInstance(instance, info, target)
+ except errors.HypervisorError, err:
+ msg = "Failed to accept instance"
+ logging.exception(msg)
+ return (False, '%s: %s' % (msg, err))
+ return (True, "Accept successfull")
+
+
+def FinalizeMigration(instance, info, success):
+ """Finalize any preparation to accept an instance.
+
+ @type instance: L{objects.Instance}
+ @param instance: the instance definition
+ @type info: string/data (opaque)
+ @param info: migration information, from the source node
+ @type success: boolean
+ @param success: whether the migration was a success or a failure
+
+ """
+ hyper = hypervisor.GetHypervisor(instance.hypervisor)
+ try:
+ hyper.FinalizeMigration(instance, info, success)
+ except errors.HypervisorError, err:
+ msg = "Failed to finalize migration"
+ logging.exception(msg)
+ return (False, '%s: %s' % (msg, err))
+ return (True, "Migration Finalized")