summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorYun Mao <yunmao@gmail.com>2012-06-06 15:08:15 -0400
committerYun Mao <yunmao@gmail.com>2012-06-06 16:05:02 -0400
commit53cb7ea71409dc7ecfe36f92df63e11231022455 (patch)
treece46ad39541344b3e6f00205cc0169bc386c0004 /nova/compute
parent9121fc6b9d6b1a7a9d945cfdad944fa59b648106 (diff)
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
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py14
1 files changed, 14 insertions, 0 deletions
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):