From 6657f70ee3e792b39e45a2a96fb5d4b380f0ae91 Mon Sep 17 00:00:00 2001 From: Adam Gandelman Date: Thu, 15 Mar 2012 18:08:35 -0700 Subject: [PATCH] Allow proper instance cleanup if state == SHUTOFF 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 --- nova/compute/manager.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index e91d5e9e38e..e596f81afdd 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -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(