Deprecate FixedIP related proxy APIs

This patch deprecates all the proxy APIs for FixedIP. All those APIs will
return 404 in new Microversion.

The deprecated API endpoints are
'/os-fixed-ips'
'/os-fixed-ips/{id}/action'

This patch doesn't bump the max API version, due to the patch separation.
The max API version will bump in the last patch.

Partially implements blueprint deprecate-api-proxies

Change-Id: I4f940f8c932798e039a518d4090fab0b31bba860
This commit is contained in:
He Jie Xu 2016-06-23 15:45:41 +08:00
parent f419c7bb59
commit d9a01d98eb
2 changed files with 21 additions and 0 deletions

View File

@ -15,6 +15,8 @@
import webob
import webob.exc
from nova.api.openstack.api_version_request \
import MAX_PROXY_API_SUPPORT_VERSION
from nova.api.openstack.compute.schemas import fixed_ips
from nova.api.openstack import extensions
from nova.api.openstack import wsgi
@ -39,6 +41,7 @@ class FixedIPController(wsgi.Controller):
def _fill_reserved_status(self, req, fixed_ip, fixed_ip_info):
fixed_ip_info['fixed_ip']['reserved'] = fixed_ip.reserved
@wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION)
@extensions.expected_errors((400, 404))
def show(self, req, id):
"""Return data about the given fixed IP."""
@ -73,6 +76,7 @@ class FixedIPController(wsgi.Controller):
return fixed_ip_info
@wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION)
@wsgi.response(202)
@extensions.expected_errors((400, 404))
@validation.schema(fixed_ips.reserve)
@ -83,6 +87,7 @@ class FixedIPController(wsgi.Controller):
return self._set_reserved(context, id, True)
@wsgi.Controller.api_version("2.1", MAX_PROXY_API_SUPPORT_VERSION)
@wsgi.response(202)
@extensions.expected_errors((400, 404))
@validation.schema(fixed_ips.unreserve)

View File

@ -247,3 +247,19 @@ class FixedIpTestV24(FixedIpTestV21):
if address == fixed_ip['address']:
return {'reserved': fixed_ip['reserved']}
self.fail('Invalid address: %s' % address)
class FixedIpDeprecationTest(test.NoDBTestCase):
def setUp(self):
super(FixedIpDeprecationTest, self).setUp()
self.req = fakes.HTTPRequest.blank('', version='2.36')
self.controller = fixed_ips_v21.FixedIPController()
def test_all_apis_return_not_found(self):
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller.show, self.req, fakes.FAKE_UUID)
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller.reserve, self.req, fakes.FAKE_UUID, {})
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller.unreserve, self.req, fakes.FAKE_UUID, {})