Merge "Deprecate legacy way to retrieve neutron usage"

This commit is contained in:
Zuul 2020-03-29 00:34:33 +00:00 committed by Gerrit Code Review
commit 0d569a45de
3 changed files with 19 additions and 0 deletions

View File

@ -20,6 +20,7 @@ import glob
import logging
import os
import sys
import warnings
from django.utils.translation import ugettext_lazy as _
@ -40,6 +41,8 @@ from openstack_dashboard.defaults import * # noqa: F403,H303
_LOG = logging.getLogger(__name__)
warnings.filterwarnings("default", category=DeprecationWarning)
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
if ROOT_PATH not in sys.path:

View File

@ -13,6 +13,7 @@
from collections import defaultdict
import itertools
import logging
import warnings
from django.utils.translation import ugettext_lazy as _
@ -361,8 +362,14 @@ def _get_neutron_quota_data(request, qs, disabled_quotas, tenant_id):
return qs
# TODO(amotoki): Deprecated in Ussuri. Drop this in Victoria release or later.
def _get_tenant_network_usages_legacy(request, usages, disabled_quotas,
tenant_id):
warnings.warn(
"The legacy way to retrieve neutron resource usage is deprecated "
"in Ussuri release. Horizon will depend on 'quota_details' "
"neutron extension added in Pike release in future.",
DeprecationWarning)
qs = base.QuotaSet()
_get_neutron_quota_data(request, qs, disabled_quotas, tenant_id)
for quota in qs:

View File

@ -0,0 +1,9 @@
---
deprecations:
- |
The legacy way to retrive neutron resource usages is deprecated.
In future, horizon will require ``quota_details`` neutron extension.
In the legacy way, horizon list all related resources to count resource usage.
It is not efficient and ``quota_details`` neutron extension was added
to address it. It was implemented in Pike release and the enough migration
period has passed, so we deprecate the legacy way.