From 53cb7ea71409dc7ecfe36f92df63e11231022455 Mon Sep 17 00:00:00 2001 From: Yun Mao Date: Wed, 6 Jun 2012 15:08:15 -0400 Subject: Make live_migration a first-class compute API. * Move the trivial implementation from admin_actions to compute.api * Remove the dependency to scheduler from admin_actions * Add check_instance_state like all other compute APIs to prevent undesirable behavior Change-Id: Ib5176718eae624de982f641bf3ec201fc7b4efcc --- nova/compute/api.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index b5babf30d..e877fe6c2 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -1826,6 +1826,20 @@ class API(base.Base): return self.db.block_device_mapping_get_all_by_instance(context, instance['uuid']) + @check_instance_state(vm_state=[vm_states.ACTIVE]) + def live_migrate(self, context, instance, block_migration, + disk_over_commit, host): + """Migrate a server lively to a new host.""" + instance_uuid = instance["uuid"] + LOG.debug(_("Going to try to live migrate instance"), + instance=instance) + self.scheduler_rpcapi.live_migration(context, + block_migration, + disk_over_commit, + instance["id"], + host, + topic=FLAGS.compute_topic) + class HostAPI(base.Base): def __init__(self): -- cgit