Changing deleting stale allocations warning to debug

Deleting the allocations is an expected action, and happens
frequently so we don't want it to be a warning. It is useful
as a piece of debug information, however.

Change-Id: Idf88eef036bbe8deca190366f052ab9e355de6e9
Closes-Bug: #1693903
This commit is contained in:
Chris Dent 2017-05-26 19:25:18 +00:00 committed by Matt Riedemann
parent 7916941571
commit 590ecfb894
2 changed files with 7 additions and 3 deletions

View File

@ -1066,8 +1066,8 @@ class ResourceTracker(object):
# The instance is gone, so we definitely want to
# remove allocations associated with it.
pass
LOG.warning('Deleting stale allocation for instance %s',
instance_uuid)
LOG.debug('Deleting stale allocation for instance %s',
instance_uuid)
self.reportclient.delete_allocation_for_instance(instance_uuid)
def _find_orphaned_instances(self):

View File

@ -2392,8 +2392,10 @@ class TestUpdateUsageFromInstance(BaseTestCase):
mock_update_usage.assert_called_once_with(
self.rt._get_usage_dict(self.instance), _NODENAME, sign=-1)
@mock.patch('nova.compute.resource_tracker.LOG')
@mock.patch('nova.objects.Instance.get_by_uuid')
def test_remove_deleted_instances_allocations(self, mock_inst_get):
def test_remove_deleted_instances_allocations(self, mock_inst_get,
mock_log):
rc = self.rt.reportclient
self.rt.tracked_instances = {}
# Create 3 instances
@ -2429,6 +2431,8 @@ class TestUpdateUsageFromInstance(BaseTestCase):
# Only one call should be made to delete allocations, and that should
# be for the first instance created above
rc.delete_allocation_for_instance.assert_called_once_with(uuids.inst0)
mock_log.debug.assert_called_once_with(
'Deleting stale allocation for instance %s', uuids.inst0)
@mock.patch('nova.objects.Instance.get_by_uuid')
def test_remove_deleted_instances_allocations_no_instance(self,