Merge "Remove the useless version calculation for proxy api deprecated version"
This commit is contained in:
commit
75b9b143dd
@ -102,8 +102,9 @@ _MAX_API_VERSION = "2.36"
|
||||
DEFAULT_API_VERSION = _MIN_API_VERSION
|
||||
|
||||
# All the proxy APIs which related network, images and baremetal
|
||||
# were deprecated after this version.
|
||||
# were deprecated from 2.36.
|
||||
MAX_PROXY_API_SUPPORT_VERSION = '2.35'
|
||||
MIN_WITHOUT_PROXY_API_SUPPORT_VERSION = '2.36'
|
||||
|
||||
|
||||
# NOTE(cyeoh): min and max versions declared as functions so we can
|
||||
|
@ -13,9 +13,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
from nova.api.openstack.api_version_request \
|
||||
import MAX_PROXY_API_SUPPORT_VERSION
|
||||
from nova.api.openstack.api_version_request \
|
||||
import MIN_WITHOUT_PROXY_API_SUPPORT_VERSION
|
||||
from nova.api.openstack.compute.views import limits as limits_views
|
||||
from nova.api.openstack import extensions
|
||||
from nova.api.openstack import wsgi
|
||||
@ -27,18 +28,6 @@ QUOTAS = quota.QUOTAS
|
||||
ALIAS = 'limits'
|
||||
|
||||
|
||||
def _get_filter_result_version():
|
||||
"""Calculate the start API version which needs to filter the network
|
||||
related limits. MAX_PROXY_API_SUPPORT_VERSION is the end API version
|
||||
of supporting those network related limits. So we return
|
||||
MAX_PROXY_API_SUPPORT_VERSION +1 in this method.
|
||||
"""
|
||||
filter_result_version = api_version_request.APIVersionRequest(
|
||||
MAX_PROXY_API_SUPPORT_VERSION)
|
||||
filter_result_version.ver_minor = filter_result_version.ver_minor + 1
|
||||
return filter_result_version.get_string()
|
||||
|
||||
|
||||
class LimitsController(wsgi.Controller):
|
||||
"""Controller for accessing limits in the OpenStack API."""
|
||||
|
||||
@ -47,7 +36,7 @@ class LimitsController(wsgi.Controller):
|
||||
def index(self, req):
|
||||
return self._index(req)
|
||||
|
||||
@wsgi.Controller.api_version(_get_filter_result_version()) # noqa
|
||||
@wsgi.Controller.api_version(MIN_WITHOUT_PROXY_API_SUPPORT_VERSION) # noqa
|
||||
@extensions.expected_errors(())
|
||||
def index(self, req):
|
||||
return self._index(req, filter_result=True)
|
||||
|
@ -18,9 +18,10 @@ import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
import webob
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
from nova.api.openstack.api_version_request \
|
||||
import MAX_PROXY_API_SUPPORT_VERSION
|
||||
from nova.api.openstack.api_version_request \
|
||||
import MIN_WITHOUT_PROXY_API_SUPPORT_VERSION
|
||||
from nova.api.openstack.compute.schemas import quota_sets
|
||||
from nova.api.openstack import extensions
|
||||
from nova.api.openstack import wsgi
|
||||
@ -38,15 +39,6 @@ QUOTAS = quota.QUOTAS
|
||||
FILTERED_QUOTAS = ["fixed_ips", "floating_ips", "networks",
|
||||
"security_group_rules", "security_groups"]
|
||||
|
||||
max_proxy_api_version_obj = api_version_request.APIVersionRequest(
|
||||
MAX_PROXY_API_SUPPORT_VERSION)
|
||||
api_version_without_proxy_api_obj = api_version_request.APIVersionRequest()
|
||||
api_version_without_proxy_api_obj.ver_major = (
|
||||
max_proxy_api_version_obj.ver_major)
|
||||
api_version_without_proxy_api_obj.ver_minor = (
|
||||
max_proxy_api_version_obj.ver_minor + 1)
|
||||
API_VERSION_WITHOUT_PROXY_API = api_version_without_proxy_api_obj.get_string()
|
||||
|
||||
|
||||
class QuotaSetsController(wsgi.Controller):
|
||||
|
||||
@ -103,7 +95,7 @@ class QuotaSetsController(wsgi.Controller):
|
||||
def show(self, req, id):
|
||||
return self._show(req, id, [])
|
||||
|
||||
@wsgi.Controller.api_version(API_VERSION_WITHOUT_PROXY_API) # noqa
|
||||
@wsgi.Controller.api_version(MIN_WITHOUT_PROXY_API_SUPPORT_VERSION) # noqa
|
||||
def show(self, req, id):
|
||||
return self._show(req, id, FILTERED_QUOTAS)
|
||||
|
||||
@ -121,7 +113,7 @@ class QuotaSetsController(wsgi.Controller):
|
||||
def detail(self, req, id):
|
||||
return self._detail(req, id, [])
|
||||
|
||||
@wsgi.Controller.api_version(API_VERSION_WITHOUT_PROXY_API) # noqa
|
||||
@wsgi.Controller.api_version(MIN_WITHOUT_PROXY_API_SUPPORT_VERSION) # noqa
|
||||
@extensions.expected_errors(())
|
||||
def detail(self, req, id):
|
||||
return self._detail(req, id, FILTERED_QUOTAS)
|
||||
@ -141,7 +133,7 @@ class QuotaSetsController(wsgi.Controller):
|
||||
def update(self, req, id, body):
|
||||
return self._update(req, id, body, [])
|
||||
|
||||
@wsgi.Controller.api_version(API_VERSION_WITHOUT_PROXY_API) # noqa
|
||||
@wsgi.Controller.api_version(MIN_WITHOUT_PROXY_API_SUPPORT_VERSION) # noqa
|
||||
@extensions.expected_errors(400)
|
||||
@validation.schema(quota_sets.update_v236)
|
||||
def update(self, req, id, body):
|
||||
@ -199,7 +191,7 @@ class QuotaSetsController(wsgi.Controller):
|
||||
def defaults(self, req, id):
|
||||
return self._defaults(req, id, [])
|
||||
|
||||
@wsgi.Controller.api_version(API_VERSION_WITHOUT_PROXY_API) # noqa
|
||||
@wsgi.Controller.api_version(MIN_WITHOUT_PROXY_API_SUPPORT_VERSION) # noqa
|
||||
@extensions.expected_errors(())
|
||||
def defaults(self, req, id):
|
||||
return self._defaults(req, id, FILTERED_QUOTAS)
|
||||
|
Loading…
Reference in New Issue
Block a user