Add exception handling in _cleanup_allocated_network
The _cleanup_allocated_network method used in nova.compute.manager.py has exception handling around deallocate_for_instance. That should be added in nova.condutor.manager as well. Without it we'll end up with the RPC layer complaining about unexpected exceptions. This commit add exception handling logic around deallocate_for_instance nova.conductor.manager._cleanup_allocated_network() method. Change-Id: Id536e2b4794d56a32af4d13577415e427e2eeb2d
This commit is contained in:
parent
49c05a2430
commit
a70af8319c
@ -254,8 +254,22 @@ class ComputeTaskManager(base.Base):
|
||||
|
||||
def _cleanup_allocated_networks(
|
||||
self, context, instance, requested_networks):
|
||||
self.network_api.deallocate_for_instance(
|
||||
context, instance, requested_networks=requested_networks)
|
||||
try:
|
||||
self.network_api.deallocate_for_instance(
|
||||
context, instance, requested_networks=requested_networks)
|
||||
except Exception:
|
||||
msg = _LE('Failed to deallocate networks')
|
||||
LOG.exception(msg, instance=instance)
|
||||
return
|
||||
|
||||
instance.system_metadata['network_allocated'] = 'False'
|
||||
try:
|
||||
instance.save()
|
||||
except exception.InstanceNotFound:
|
||||
# NOTE: It's possible that we're cleaning up the networks
|
||||
# because the instance was deleted. If that's the case then this
|
||||
# exception will be raised by instance.save()
|
||||
pass
|
||||
|
||||
def _live_migrate(self, context, instance, scheduler_hint,
|
||||
block_migration, disk_over_commit):
|
||||
|
Loading…
Reference in New Issue
Block a user