From a3bdc1624fd557e0699acb049b1ca0c1ef894c2f Mon Sep 17 00:00:00 2001 From: Jian Wen Date: Wed, 12 Sep 2012 17:45:03 +0800 Subject: 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 --- nova/compute/api.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nova/compute') 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) -- cgit