From 80a55176e11da1594c9d663df0e4a0a755018c16 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Mon, 26 Mar 2012 17:25:12 +0000 Subject: Don't set instance ACTIVE until it's really active Fixes bug 963656 Reverting a resize would end up setting the instance ACTIVE before the driver had finished all of the work starting up the original instance. If the instance is deleted quickly after the revert, a race condition could occur between restarting the original instance and deleting it. Change-Id: Iba26ad7d1bc1049137f94e13898be86698963fb3 --- nova/compute/manager.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index efe560911..7c8d24eda 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1226,6 +1226,9 @@ class ComputeManager(manager.SchedulerDependentManager): old_instance_type = migration_ref['old_instance_type_id'] instance_type = instance_types.get_instance_type(old_instance_type) + self.driver.finish_revert_migration(instance_ref, + self._legacy_nw_info(network_info)) + # Just roll back the record. There's no need to resize down since # the 'old' VM already has the preferred attributes self._instance_update(context, @@ -1239,8 +1242,6 @@ class ComputeManager(manager.SchedulerDependentManager): vm_state=vm_states.ACTIVE, task_state=None) - self.driver.finish_revert_migration(instance_ref, - self._legacy_nw_info(network_info)) self.db.migration_update(context, migration_id, {'status': 'reverted'}) -- cgit