Deprecate Multinic, floatingip action and os-virtual-interface API

The following APIs which are considered as proxies of Neutron networking
API, are deprecated and will result in a 404 error response in new
Microversion:

     POST /servers/{server_uuid}/action
     {
         "addFixedIp": {...}
     }
     POST /servers/{server_uuid}/action
     {
         "removeFixedIp": {...}
     }
     POST /servers/{server_uuid}/action
     {
         "addFloatingIp": {...}
     }
     POST /servers/{server_uuid}/action
     {
         "removeFloatingIp": {...}

And the nova-network specific API for query server's interfaces is
deprecated also:

     GET /servers/{server_uuid}/os-virtual-interfaces

Partial implement blueprint deprecate-multinic-proxy-api

Change-Id: I1848db384a825d3b166f113b30ebad92113af8e5
This commit is contained in:
He Jie Xu 2017-04-17 15:45:17 +08:00 committed by Matt Riedemann
parent a3038b6524
commit 03ce169884
15 changed files with 169 additions and 44 deletions

View File

@ -30,7 +30,6 @@ the `API guide <http://developer.openstack.org/api-guide/compute/index.html>`_.
.. include:: os-instance-actions.inc
.. include:: os-interface.inc
.. include:: os-server-password.inc
.. include:: os-virtual-interfaces.inc
.. include:: os-volume-attachments.inc
.. include:: flavors.inc
.. include:: os-flavor-access.inc
@ -71,3 +70,4 @@ the `API guide <http://developer.openstack.org/api-guide/compute/index.html>`_.
.. include:: os-security-group-default-rules.inc
.. include:: os-security-group-rules.inc
.. include:: os-hosts.inc
.. include:: os-virtual-interfaces.inc

View File

@ -1,11 +1,17 @@
.. -*- rst -*-
=============================================================
Servers virtual interfaces (servers, os-virtual-interfaces)
=============================================================
=========================================================================
Servers virtual interfaces (servers, os-virtual-interfaces) (DEPRECATED)
=========================================================================
Lists virtual interfaces for a server.
.. warning:: Since this API is only implemented for the nova-network, the API
is deprecated from the Microversion 2.44. This API will fail with
a 404 starting from microversion 2.44. To query the server attached
neutron interface, please use the API
``GET /servers/{server_uuid}/os-interface``.
.. note::
This API is only implemented for the nova-network service and will result
in a 400 error response if the cloud is using the Neutron networking

View File

@ -1,13 +1,11 @@
.. -*- rst -*-
Add (Associate) Fixed Ip (addFixedIp Action)
============================================
Add (Associate) Fixed Ip (addFixedIp Action) (DEPRECATED)
==========================================================
.. note::
Network APIs and proxies are deprecated beginning microversion 2.36, except
for actions on non-deprecated resources such as servers. The addFixedIp
action is one such exemption.
.. warning:: This API is deprecated and will fail with a 404 starting
from microversion 2.44. This is replaced with using the
Neutron networking service API.
.. rest_method:: POST /servers/{server_id}/action
@ -46,14 +44,12 @@ Response
No response body is returned after a successful addFixedIp action.
Remove (Disassociate) Fixed Ip (removeFixedIp Action)
=====================================================
Remove (Disassociate) Fixed Ip (removeFixedIp Action) (DEPRECATED)
===================================================================
.. note::
Network APIs and proxies are deprecated as of microversion 2.36, except
for actions on non-deprecated resources such as servers. The removeFixedIp
action is one such exemption.
.. warning:: This API is deprecated and will fail with a 404 starting
from microversion 2.44. This is replaced with using the
Neutron networking service API.
.. rest_method:: POST /servers/{server_id}/action

View File

@ -25,8 +25,12 @@ into a server since Mitaka release.
You can get an RDP, serial, SPICE, or VNC console for a server.
Add (Associate) Floating Ip (addFloatingIp Action)
==================================================
Add (Associate) Floating Ip (addFloatingIp Action) (DEPRECATED)
================================================================
.. warning:: This API is deprecated and will fail with a 404 starting
from microversion 2.44. This is replaced with using the
Neutron networking service API.
.. rest_method:: POST /servers/{server_id}/action
@ -430,8 +434,12 @@ Response
.. literalinclude:: ../../doc/api_samples/servers/server-action-rebuild-resp.json
:language: javascript
Remove (Disassociate) Floating Ip (removeFloatingIp Action)
===========================================================
Remove (Disassociate) Floating Ip (removeFloatingIp Action) (DEPRECATED)
=========================================================================
.. warning:: This API is deprecated and will fail with a 404 starting
from microversion 2.44. This is replaced with using the
Neutron networking service API.
.. rest_method:: POST /servers/{server_id}/action

View File

@ -19,7 +19,7 @@
}
],
"status": "CURRENT",
"version": "2.43",
"version": "2.44",
"min_version": "2.1",
"updated": "2013-07-23T11:33:21Z"
}

View File

@ -22,7 +22,7 @@
}
],
"status": "CURRENT",
"version": "2.43",
"version": "2.44",
"min_version": "2.1",
"updated": "2013-07-23T11:33:21Z"
}

View File

@ -103,6 +103,8 @@ REST_API_VERSION_HISTORY = """REST API Version History:
starting with version 2.33 for block devices and starting with
version 2.37 for network interfaces.
* 2.43 - Deprecate os-hosts API
* 2.44 - The servers action addFixedIp, removeFixedIp, addFloatingIp,
removeFloatingIp and os-virtual-interfaces APIs are deprecated.
"""
# The minimum and maximum versions of the API supported
@ -111,7 +113,7 @@ REST_API_VERSION_HISTORY = """REST API Version History:
# Note(cyeoh): This only applies for the v2.1 API once microversions
# support is fully merged. It does not affect the V2 API.
_MIN_API_VERSION = "2.1"
_MAX_API_VERSION = "2.43"
_MAX_API_VERSION = "2.44"
DEFAULT_API_VERSION = _MIN_API_VERSION
# Almost all proxy APIs which related to network, images and baremetal

View File

@ -203,11 +203,14 @@ class FloatingIPController(wsgi.Controller):
class FloatingIPActionController(wsgi.Controller):
"""This API is deprecated from the Microversion '2.44'."""
def __init__(self, *args, **kwargs):
super(FloatingIPActionController, self).__init__(*args, **kwargs)
self.compute_api = compute.API()
self.network_api = network.API()
@wsgi.Controller.api_version("2.1", "2.43")
@extensions.expected_errors((400, 403, 404))
@wsgi.action('addFloatingIp')
@validation.schema(floating_ips.add_floating_ip)
@ -286,6 +289,7 @@ class FloatingIPActionController(wsgi.Controller):
return webob.Response(status_int=202)
@wsgi.Controller.api_version("2.1", "2.43")
@extensions.expected_errors((400, 403, 404, 409))
@wsgi.action('removeFloatingIp')
@validation.schema(floating_ips.remove_floating_ip)

View File

@ -31,10 +31,13 @@ ALIAS = "os-multinic"
class MultinicController(wsgi.Controller):
"""This API is deprecated from Microversion '2.44'."""
def __init__(self, *args, **kwargs):
super(MultinicController, self).__init__(*args, **kwargs)
self.compute_api = compute.API()
@wsgi.Controller.api_version("2.1", "2.43")
@wsgi.response(202)
@wsgi.action('addFixedIp')
@extensions.expected_errors((400, 404))
@ -53,6 +56,7 @@ class MultinicController(wsgi.Controller):
except exception.NoMoreFixedIps as e:
raise exc.HTTPBadRequest(explanation=e.format_message())
@wsgi.Controller.api_version("2.1", "2.43")
@wsgi.response(202)
@wsgi.action('removeFixedIp')
@extensions.expected_errors((400, 404))

View File

@ -493,3 +493,39 @@ user documentation.
`shutdown`, `startup`, `reboot`, or `maintenance_mode` actions as those are
system-level operations which should be outside of the control of the
compute service.
2.44
----
The following APIs which are considered as proxies of Neutron networking API,
are deprecated and will result in a 404 error response in new Microversion::
POST /servers/{server_uuid}/action
{
"addFixedIp": {...}
}
POST /servers/{server_uuid}/action
{
"removeFixedIp": {...}
}
POST /servers/{server_uuid}/action
{
"addFloatingIp": {...}
}
POST /servers/{server_uuid}/action
{
"removeFloatingIp": {...}
}
Those server actions can be replaced by calling the Neutron API directly.
The nova-network specific API to query the server's interfaces is
deprecated::
GET /servers/{server_uuid}/os-virtual-interfaces
To query attached neutron interfaces for a specific server, the API
`GET /servers/{server_uuid}/os-interface` can be used.

View File

@ -46,6 +46,8 @@ def _translate_vif_summary_view(req, vif):
class ServerVirtualInterfaceController(wsgi.Controller):
"""The instance VIF API controller for the OpenStack API.
This API is deprecated from the Microversion '2.44'.
"""
def __init__(self):
@ -69,6 +71,7 @@ class ServerVirtualInterfaceController(wsgi.Controller):
res = [entity_maker(req, vif) for vif in limited_list]
return {'virtual_interfaces': res}
@wsgi.Controller.api_version("2.1", "2.43")
@extensions.expected_errors((400, 404))
def index(self, req, server_id):
"""Returns the list of VIFs for a given instance."""

View File

@ -987,3 +987,22 @@ class FloatingIpsDeprecationTest(test.NoDBTestCase):
self.controller.create, self.req, {})
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller.delete, self.req, fakes.FAKE_UUID)
class FloatingIpActionDeprecationTest(test.NoDBTestCase):
def setUp(self):
super(FloatingIpActionDeprecationTest, self).setUp()
self.req = fakes.HTTPRequest.blank('', version='2.44')
self.controller = fips_v21.FloatingIPActionController()
def test_add_floating_ip_not_found(self):
body = dict(addFloatingIp=dict(address='10.10.10.11'))
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller._add_floating_ip, self.req, FAKE_UUID, body=body)
def test_remove_floating_ip_not_found(self):
body = dict(removeFloatingIp=dict(address='10.10.10.10'))
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller._remove_floating_ip, self.req, FAKE_UUID,
body=body)

View File

@ -71,15 +71,7 @@ class FixedIpTestV21(test.NoDBTestCase):
last_add_fixed_ip = (None, None)
body = dict(addFixedIp=dict(networkId='test_net'))
resp = self.controller._add_fixed_ip(self.fake_req, UUID, body=body)
# NOTE: on v2.1, http status code is set as wsgi_code of API
# method instead of status_int in a response object.
if isinstance(self.controller,
multinic_v21.MultinicController):
status_int = self.controller._add_fixed_ip.wsgi_code
else:
status_int = resp.status_int
self.assertEqual(status_int, 202)
self.controller._add_fixed_ip(self.fake_req, UUID, body=body)
self.assertEqual(last_add_fixed_ip, (UUID, 'test_net'))
def _test_add_fixed_ip_bad_request(self, body):
@ -119,15 +111,7 @@ class FixedIpTestV21(test.NoDBTestCase):
last_remove_fixed_ip = (None, None)
body = dict(removeFixedIp=dict(address='10.10.10.1'))
resp = self.controller._remove_fixed_ip(self.fake_req, UUID, body=body)
# NOTE: on v2.1, http status code is set as wsgi_code of API
# method instead of status_int in a response object.
if isinstance(self.controller,
multinic_v21.MultinicController):
status_int = self.controller._remove_fixed_ip.wsgi_code
else:
status_int = resp.status_int
self.assertEqual(status_int, 202)
self.controller._remove_fixed_ip(self.fake_req, UUID, body=body)
self.assertEqual(last_remove_fixed_ip, (UUID, '10.10.10.1'))
def test_remove_fixed_ip_no_address(self):
@ -188,3 +172,21 @@ class MultinicPolicyEnforcementV21(test.NoDBTestCase):
self.assertEqual(
"Policy doesn't allow %s to be performed." % rule_name,
exc.format_message())
class MultinicAPIDeprecationTest(test.NoDBTestCase):
def setUp(self):
super(MultinicAPIDeprecationTest, self).setUp()
self.controller = multinic_v21.MultinicController()
self.req = fakes.HTTPRequest.blank('', version='2.44')
def test_add_fixed_ip_not_found(self):
body = dict(addFixedIp=dict(networkId='test_net'))
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller._add_fixed_ip, self.req, UUID, body=body)
def test_remove_fixed_ip__not_found(self):
body = dict(removeFixedIp=dict(address='10.10.10.1'))
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller._remove_fixed_ip, self.req, UUID, body=body)

View File

@ -61,7 +61,7 @@ class FakeRequest(object):
class ServerVirtualInterfaceTestV21(test.NoDBTestCase):
wsgi_api_version = None
wsgi_api_version = '2.1'
expected_response = {
'virtual_interfaces': [
{'id': uuids.vif1_uuid,
@ -155,3 +155,15 @@ class ServerVirtualInterfaceEnforcementV21(test.NoDBTestCase):
self.assertEqual(
"Policy doesn't allow %s to be performed." % rule_name,
exc.format_message())
class ServerVirtualInterfaceDeprecationTest(test.NoDBTestCase):
def setUp(self):
super(ServerVirtualInterfaceDeprecationTest, self).setUp()
self.controller = vi21.ServerVirtualInterfaceController()
self.req = fakes.HTTPRequest.blank('', version='2.44')
def test_index_not_found(self):
self.assertRaises(exception.VersionNotFoundForAPIMethod,
self.controller.index, self.req, FAKE_UUID)

View File

@ -0,0 +1,33 @@
---
deprecations:
- |
The following APIs which are considered as proxies of Neutron networking
API, are deprecated and will result in a 404 error response in microversion
`2.44`::
POST /servers/{server_uuid}/action
{
"addFixedIp": {...}
}
POST /servers/{server_uuid}/action
{
"removeFixedIp": {...}
}
POST /servers/{server_uuid}/action
{
"addFloatingIp": {...}
}
POST /servers/{server_uuid}/action
{
"removeFloatingIp": {...}
}
Those server actions can be replaced by calling the Neutron API directly.
The nova-network specific API to query the server's interfaces is
deprecated::
GET /servers/{server_uuid}/os-virtual-interfaces
To query attached neutron interfaces for a specific server, the API
`GET /servers/{server_uuid}/os-interface` can be used.