From 5f46f6acf3a000c8e65ee6f2574aff518b036d29 Mon Sep 17 00:00:00 2001 From: Fei Long Wang Date: Sun, 10 Mar 2013 22:57:13 +0800 Subject: Fixes instance task_state being left as migrating In a cross-hypervisor environment, such as KVM + Hyper-v. After negative test which live migrate a KVM instance to Hyper-v host, there will be an exception InvalidHypervisorType. As a result, the instance task_state is being left as migrating. That leaves the instance in a broken state and most of the requests on the instance will fail. Actually, there are some other exceptions will cause this issue as well, such as UnableToMigrateToSelf, DestinationHypervisorTooOld. All of them are thrown from the driver of scheduler during live migration. But obviously, if the live migration fails at the schedule stage, the task_state of the target instance should be updated to None. Fixes Bug: 1153283 Change-Id: Ide4b48653268c8dbe31de6964814830d2e82a5ba --- nova/api/openstack/compute/contrib/admin_actions.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nova/api') diff --git a/nova/api/openstack/compute/contrib/admin_actions.py b/nova/api/openstack/compute/contrib/admin_actions.py index 8e5863706..951bc0c11 100644 --- a/nova/api/openstack/compute/contrib/admin_actions.py +++ b/nova/api/openstack/compute/contrib/admin_actions.py @@ -282,7 +282,10 @@ class AdminActionsController(wsgi.Controller): instance = self.compute_api.get(context, id) self.compute_api.live_migrate(context, instance, block_migration, disk_over_commit, host) - except exception.ComputeServiceUnavailable as ex: + except (exception.ComputeServiceUnavailable, + exception.InvalidHypervisorType, + exception.UnableToMigrateToSelf, + exception.DestinationHypervisorTooOld) as ex: raise exc.HTTPBadRequest(explanation=str(ex)) except Exception: if host is None: -- cgit