Skip to content

Commit

Permalink
Don't set instance ACTIVE until it's really active
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Johannes Erdfelt authored and vishvananda committed Mar 31, 2012
1 parent ada63db commit 9a21d9f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions nova/compute/manager.py
Expand Up @@ -1226,6 +1226,9 @@ def finish_revert_resize(self, context, instance_uuid, migration_id):
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,
Expand All @@ -1239,8 +1242,6 @@ def finish_revert_resize(self, context, instance_uuid, migration_id):
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'})

Expand Down

0 comments on commit 9a21d9f

Please sign in to comment.