summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorJian Wen <wenjianhn@gmail.com>2012-09-12 17:45:03 +0800
committerJian Wen <wenjianhn@gmail.com>2012-09-13 01:03:10 +0800
commita3bdc1624fd557e0699acb049b1ca0c1ef894c2f (patch)
tree396ca5f8dfb8baf9a4e52a17385f193c383a29f3 /nova/compute
parentb961bd4c2916559bca856bc8b142d9df7494ef13 (diff)
Avoid live migrate overwriting the other task_state
As commit 4082c8375a6ae7e7e67c7ad2e263be2d5fc3dd1f says, one ordinary task is running, so that task_state is set. The live_migrate task is accepted at API, and will change task_state to MIGRATING. However the first task may continue to update task_state or set it to None as it finishes. This patch avoids it by updating task_state in compute.api.live_migrate level with expected_task_state=None. Add test case for compute.api.live_migrate. Fixes bug 1049533 Change-Id: Ida8cef4797de421a7e356c9f5e882fe926535639
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index a9ab17a13..3ad6a6305 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -1941,6 +1941,10 @@ class API(base.Base):
LOG.debug(_("Going to try to live migrate instance to %s"),
host, instance=instance)
+ instance = self.update(context, instance,
+ task_state=task_states.MIGRATING,
+ expected_task_state=None)
+
self.scheduler_rpcapi.live_migration(context, block_migration,
disk_over_commit, instance, host)