Deprecate legacy way to retrieve neutron usage

neutron 'quota_details' extension was added in Pike to provide
a convenient way to retrieve resource usage in neutron without listing
individual resources. It was added in Pike release and we will have
six releases since then once Ussuri release is shipped. Enough time has
passed to migrate it to the new mechanism, so it is time to deprecate
the legacy way for future cleanup.

Change-Id: Ie0b4613bf9fdcd96481b3bb1139b4fb153bfef83
This commit is contained in:
Akihiro Motoki 2020-02-19 17:17:47 +09:00
parent 11d4954cc3
commit 6ce40aee83
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.