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.
Conflicts:
nova/compute/resource_tracker.py
nova/tests/unit/compute/test_resource_tracker.py
NOTE(mriedem): The conflict is due to change
I80ba844a6e0fcea89f80aa253d57ac73092773ae in Pike where
this code was all moved to the resource tracker.
Change-Id: Idf88eef036bbe8deca190366f052ab9e355de6e9
Closes-Bug: #1693903
(cherry picked from commit 590ecfb894
)
This commit is contained in:
parent
7c30084d84
commit
9f84d0d435
@ -746,8 +746,8 @@ class SchedulerReportClient(object):
|
||||
removed_instances = set(allocations.keys()) - set(instance_dict.keys())
|
||||
|
||||
for uuid in removed_instances:
|
||||
LOG.warning(_LW('Deleting stale allocation for instance %s'),
|
||||
uuid)
|
||||
LOG.debug('Deleting stale allocation for instance %s',
|
||||
uuid)
|
||||
self._delete_allocation_for_instance(uuid)
|
||||
|
||||
@safe_connect
|
||||
|
@ -1259,6 +1259,7 @@ class TestAllocations(SchedulerReportClientTestCase):
|
||||
self.client.update_instance_allocation(cn, inst, -1)
|
||||
self.assertTrue(mock_warn.called)
|
||||
|
||||
@mock.patch('nova.scheduler.client.report.LOG')
|
||||
@mock.patch('nova.scheduler.client.report.SchedulerReportClient.'
|
||||
'delete')
|
||||
@mock.patch('nova.scheduler.client.report.SchedulerReportClient.'
|
||||
@ -1266,7 +1267,7 @@ class TestAllocations(SchedulerReportClientTestCase):
|
||||
@mock.patch('nova.scheduler.client.report.'
|
||||
'_instance_to_allocations_dict')
|
||||
def test_remove_deleted_instances(self, mock_a, mock_get,
|
||||
mock_delete):
|
||||
mock_delete, mock_log):
|
||||
cn = objects.ComputeNode(uuid=uuids.cn)
|
||||
inst1 = objects.Instance(uuid=uuids.inst1)
|
||||
inst2 = objects.Instance(uuid=uuids.inst2)
|
||||
@ -1293,6 +1294,10 @@ class TestAllocations(SchedulerReportClientTestCase):
|
||||
mock.call('/allocations/%s' % inst1.uuid),
|
||||
mock.call('/allocations/%s' % inst2.uuid)]
|
||||
mock_delete.assert_has_calls(expected_calls, any_order=True)
|
||||
expected_calls = [
|
||||
mock.call('Deleting stale allocation for instance %s', inst1.uuid),
|
||||
mock.call('Deleting stale allocation for instance %s', inst2.uuid)]
|
||||
mock_log.debug.assert_has_calls(expected_calls, any_order=True)
|
||||
|
||||
@mock.patch('nova.scheduler.client.report.SchedulerReportClient.'
|
||||
'delete')
|
||||
|
Loading…
Reference in New Issue
Block a user