diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-04-04 06:49:13 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-04-04 06:49:13 +0000 |
| commit | a892d2f740d5bdaa82aec4583ced3f336f89bb78 (patch) | |
| tree | ee50bcaf307973a463e26f49dbd2a70322a1bfb9 /nova/compute | |
| parent | 34144bd68de1d2dca649b39c471eed98ad46dc3f (diff) | |
| parent | 306046c7d5c20454035fcea22ce3efeac1d11cfc (diff) | |
| download | nova-a892d2f740d5bdaa82aec4583ced3f336f89bb78.tar.gz nova-a892d2f740d5bdaa82aec4583ced3f336f89bb78.tar.xz nova-a892d2f740d5bdaa82aec4583ced3f336f89bb78.zip | |
Merge "After migrate, catch and remove deleted instances"
Diffstat (limited to 'nova/compute')
| -rwxr-xr-x | nova/compute/manager.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 3e644fecb..8556a5d26 100755 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -440,13 +440,25 @@ class ComputeManager(manager.SchedulerDependentManager): '%(instance_host)s) is not equal to our ' 'host (%(our_host)s).'), locals(), instance=instance) - network_info = self._get_instance_nw_info(context, instance) - bdi = self._get_instance_volume_block_device_info(context, - instance) + # TODO(deva): detect if instance's disk is shared or local, + # and destroy if it is local. + destroy_disks = False + try: + network_info = self._get_instance_nw_info(context, + instance) + bdi = self._get_instance_volume_block_device_info(context, + instance) + except exception.InstanceNotFound: + network_info = network_model.NetworkInfo() + bdi = {} + LOG.info(_('Instance has been marked deleted already, ' + 'removing it from the hypervisor.'), + instance=instance) + # always destroy disks if the instance was deleted + destroy_disks = True self.driver.destroy(instance, self._legacy_nw_info(network_info), - bdi, - False) + bdi, destroy_disks) def _init_instance(self, context, instance): '''Initialize this instance during service init.''' |
