Skip to content

Commit

Permalink
Allow proper instance cleanup if state == SHUTOFF
Browse files Browse the repository at this point in the history
Removes an obsolete check for instance's power_state
on shutdown_instance().  With it in place, volume detachment
and disassociation never takes place.  Compute should instead rely
on virt drivers to handle this case and raise accordingly. libvirt's
destroy() currently handles powered off instances fine, and properly
detaches any existing volume connections.

Fixes bug 954692

Change-Id: I200d5b2073e5b52a9733d8324d016b14bdc96067
  • Loading branch information
Adam Gandelman authored and vishvananda committed Mar 16, 2012
1 parent 67b84dd commit 6657f70
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions nova/compute/manager.py
Expand Up @@ -673,13 +673,6 @@ def _shutdown_instance(self, context, instance, action_str):
# tear down allocated network structure
self._deallocate_network(context, instance)

current_power_state = self._get_power_state(context, instance)

if current_power_state == power_state.SHUTOFF:
self.db.instance_destroy(context, instance_id)
_msg = _('trying to destroy already destroyed instance: %s')
raise exception.Invalid(_msg % instance_uuid)

# NOTE(vish) get bdms before destroying the instance
bdms = self._get_instance_volume_bdms(context, instance_id)
block_device_info = self._get_instance_volume_block_device_info(
Expand Down

0 comments on commit 6657f70

Please sign in to comment.