diff --git a/nova/scheduler/client/report.py b/nova/scheduler/client/report.py index 3da52c3dedb0..b496b93bfa1b 100644 --- a/nova/scheduler/client/report.py +++ b/nova/scheduler/client/report.py @@ -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 diff --git a/nova/tests/unit/scheduler/client/test_report.py b/nova/tests/unit/scheduler/client/test_report.py index ae17c2748ce9..29ee1ec7f110 100644 --- a/nova/tests/unit/scheduler/client/test_report.py +++ b/nova/tests/unit/scheduler/client/test_report.py @@ -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')