Log quota legacy method warning only if counting from placement
The log warning message is being emitted unconditionally and should be limited to only when CONF.quota.count_usage_from_placement = True. This fixes the issue and adds missing unit test coverage that would have caught it. Closes-Bug: #1833130 Change-Id: I00ee0bd99c4f31a2b73fc69373fefb56740f5425
This commit is contained in:
parent
ea7293c7be
commit
818c31f96e
@ -1312,8 +1312,8 @@ def _instances_cores_ram_count(context, project_id, user_id=None):
|
|||||||
return _instances_cores_ram_count_api_db_placement(context,
|
return _instances_cores_ram_count_api_db_placement(context,
|
||||||
project_id,
|
project_id,
|
||||||
user_id=user_id)
|
user_id=user_id)
|
||||||
LOG.warning('Falling back to legacy quota counting method for instances, '
|
LOG.warning('Falling back to legacy quota counting method for '
|
||||||
'cores, and ram')
|
'instances, cores, and ram')
|
||||||
return _instances_cores_ram_count_legacy(context, project_id,
|
return _instances_cores_ram_count_legacy(context, project_id,
|
||||||
user_id=user_id)
|
user_id=user_id)
|
||||||
|
|
||||||
|
@ -2057,6 +2057,8 @@ class QuotaCountTestCase(test.NoDBTestCase):
|
|||||||
# We only log the message if someone has opted in to counting
|
# We only log the message if someone has opted in to counting
|
||||||
# from placement.
|
# from placement.
|
||||||
mock_warn_log.assert_called_once()
|
mock_warn_log.assert_called_once()
|
||||||
|
else:
|
||||||
|
mock_warn_log.assert_not_called()
|
||||||
# We should not have called the API DB and placement counting
|
# We should not have called the API DB and placement counting
|
||||||
# method.
|
# method.
|
||||||
mock_api_db_placement_count.assert_not_called()
|
mock_api_db_placement_count.assert_not_called()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user