Skip to content

Commit

Permalink
Deprecate Multinic, floatingip action and os-virtual-interface API
Browse files Browse the repository at this point in the history
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
  • Loading branch information
soulxu authored and mriedem committed Apr 25, 2017
1 parent a3038b6 commit 03ce169
Show file tree
Hide file tree
Showing 15 changed files with 169 additions and 44 deletions.
2 changes: 1 addition & 1 deletion api-ref/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
12 changes: 9 additions & 3 deletions api-ref/source/os-virtual-interfaces.inc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 10 additions & 14 deletions api-ref/source/servers-action-fixed-ip.inc
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -46,14 +44,12 @@ Response
No response body is returned after a successful addFixedIp action.


Remove (Disassociate) Fixed Ip (removeFixedIp Action)
=====================================================

.. note::
Remove (Disassociate) Fixed Ip (removeFixedIp Action) (DEPRECATED)
===================================================================

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

Expand Down
16 changes: 12 additions & 4 deletions api-ref/source/servers-actions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion doc/api_samples/versions/v21-version-get-resp.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"status": "CURRENT",
"version": "2.43",
"version": "2.44",
"min_version": "2.1",
"updated": "2013-07-23T11:33:21Z"
}
Expand Down
2 changes: 1 addition & 1 deletion doc/api_samples/versions/versions-get-resp.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
],
"status": "CURRENT",
"version": "2.43",
"version": "2.44",
"min_version": "2.1",
"updated": "2013-07-23T11:33:21Z"
}
Expand Down
4 changes: 3 additions & 1 deletion nova/api/openstack/api_version_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
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
Expand All @@ -111,7 +113,7 @@
# 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
Expand Down
4 changes: 4 additions & 0 deletions nova/api/openstack/compute/floating_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,14 @@ def delete(self, req, id):


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)
Expand Down Expand Up @@ -286,6 +289,7 @@ def _add_floating_ip(self, req, id, body):

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)
Expand Down
4 changes: 4 additions & 0 deletions nova/api/openstack/compute/multinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@


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))
Expand All @@ -53,6 +56,7 @@ def _add_fixed_ip(self, req, id, body):
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))
Expand Down
36 changes: 36 additions & 0 deletions nova/api/openstack/compute/rest_api_version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
3 changes: 3 additions & 0 deletions nova/api/openstack/compute/virtual_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -69,6 +71,7 @@ def _items(self, req, server_id, entity_maker):
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."""
Expand Down
19 changes: 19 additions & 0 deletions nova/tests/unit/api/openstack/compute/test_floating_ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -987,3 +987,22 @@ def test_all_apis_return_not_found(self):
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)
38 changes: 20 additions & 18 deletions nova/tests/unit/api/openstack/compute/test_multinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,7 @@ def test_add_fixed_ip(self):
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):
Expand Down Expand Up @@ -119,15 +111,7 @@ def test_remove_fixed_ip(self):
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):
Expand Down Expand Up @@ -188,3 +172,21 @@ def test_remove_fixed_ip_policy_failed(self):
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)
14 changes: 13 additions & 1 deletion nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, context):


class ServerVirtualInterfaceTestV21(test.NoDBTestCase):
wsgi_api_version = None
wsgi_api_version = '2.1'
expected_response = {
'virtual_interfaces': [
{'id': uuids.vif1_uuid,
Expand Down Expand Up @@ -155,3 +155,15 @@ def test_index_virtual_interfaces_policy_failed(self):
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)
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit 03ce169

Please sign in to comment.