diff options
author | Dan Smith <dansmith@redhat.com> | 2022-08-11 09:50:30 -0700 |
---|---|---|
committer | Dan Smith <dansmith@redhat.com> | 2022-08-18 07:22:37 -0700 |
commit | c178d9360665c219cbcc71c9f37b9e6e3055a5e5 (patch) | |
tree | 319663342124fe6a976efc273092a0c06f0bfbea /nova/quota.py | |
parent | 627af67f5e631e8e1b23aa1527517a6cd6abd462 (diff) | |
download | nova-c178d9360665c219cbcc71c9f37b9e6e3055a5e5.tar.gz |
Unify placement client singleton implementations
We have many places where we implement singleton behavior for the
placement client. This unifies them into a single place and
implementation. Not only does this DRY things up, but may cause us
to initialize it fewer times and also allows for emitting a common
set of error messages about expected failures for better
troubleshooting.
Change-Id: Iab8a791f64323f996e1d6e6d5a7e7a7c34eb4fb3
Related-Bug: #1846820
Diffstat (limited to 'nova/quota.py')
-rw-r--r-- | nova/quota.py | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/nova/quota.py b/nova/quota.py index b9dd763012..eafad4cd23 100644 --- a/nova/quota.py +++ b/nova/quota.py @@ -1348,11 +1348,8 @@ def _instances_cores_ram_count_legacy(context, project_id, user_id=None): def _cores_ram_count_placement(context, project_id, user_id=None): - global PLACEMENT_CLIENT - if not PLACEMENT_CLIENT: - PLACEMENT_CLIENT = report.SchedulerReportClient() - return PLACEMENT_CLIENT.get_usages_counts_for_quota(context, project_id, - user_id=user_id) + return report.report_client_singleton().get_usages_counts_for_quota( + context, project_id, user_id=user_id) def _instances_cores_ram_count_api_db_placement(context, project_id, |