Remove unnecessary call to info_cache.delete

Removed unnecessary call to instance.info_cache.delete from
_local_delete method because info_cache is deleted by calling
instance.destroy from _local_delete. Also it raises
InstanceInfoCacheNotFound exception in a race condition when
instance.refresh is called after info_cache is deleted by this call.

Partial-Bug: 1404867
Change-Id: Ia76ded06a9ce014fb5d9cb35a03ae868d5106ba1
This commit is contained in:
ankitagrawal 2015-09-23 03:18:12 -07:00
parent 4ee4f9f2ec
commit cb02486816
2 changed files with 0 additions and 12 deletions

View File

@ -1803,14 +1803,6 @@ class API(base.Base):
else:
LOG.warning(_LW("instance's host %s is down, deleting from "
"database"), instance.host, instance=instance)
if instance.info_cache is not None:
instance.info_cache.delete()
else:
# NOTE(yoshimatsu): Avoid AttributeError if instance.info_cache
# is None. When the root cause that instance.info_cache becomes
# None is fixed, the log level should be reconsidered.
LOG.warning(_LW("Info cache for instance could not be found. "
"Ignore."), instance=instance)
compute_utils.notify_about_instance_usage(
self.notifier, context, instance, "%s.start" % delete_type)

View File

@ -740,7 +740,6 @@ class _ComputeAPIUnitTestMixIn(object):
test.TestingException("Unexpected error"))
def _test_downed_host_part(self, inst, updates, delete_time, delete_type):
inst.info_cache.delete()
compute_utils.notify_about_instance_usage(
self.compute_api.notifier, self.context, inst,
'%s.start' % delete_type)
@ -792,7 +791,6 @@ class _ComputeAPIUnitTestMixIn(object):
self.mox.StubOutWithMock(compute_utils, 'reserve_quota_delta')
self.mox.StubOutWithMock(self.compute_api, '_record_action_start')
self.mox.StubOutWithMock(db, 'instance_update_and_get_original')
self.mox.StubOutWithMock(inst.info_cache, 'delete')
self.mox.StubOutWithMock(self.compute_api.network_api,
'deallocate_for_instance')
self.mox.StubOutWithMock(db, 'instance_system_metadata_get')
@ -1029,7 +1027,6 @@ class _ComputeAPIUnitTestMixIn(object):
self.mox.StubOutWithMock(inst, 'destroy')
self.mox.StubOutWithMock(self.context, 'elevated')
self.mox.StubOutWithMock(inst.info_cache, 'delete')
self.mox.StubOutWithMock(self.compute_api.network_api,
'deallocate_for_instance')
self.mox.StubOutWithMock(db, 'instance_system_metadata_get')
@ -1039,7 +1036,6 @@ class _ComputeAPIUnitTestMixIn(object):
'terminate_connection')
self.mox.StubOutWithMock(objects.BlockDeviceMapping, 'destroy')
inst.info_cache.delete()
compute_utils.notify_about_instance_usage(
self.compute_api.notifier, self.context,
inst, 'delete.start')