From 03ce16988463c08761e9dbe90579792dcdf94c68 Mon Sep 17 00:00:00 2001 From: He Jie Xu Date: Mon, 17 Apr 2017 15:45:17 +0800 Subject: [PATCH] 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 --- api-ref/source/index.rst | 2 +- api-ref/source/os-virtual-interfaces.inc | 12 ++++-- api-ref/source/servers-action-fixed-ip.inc | 24 +++++------- api-ref/source/servers-actions.inc | 16 ++++++-- .../versions/v21-version-get-resp.json | 2 +- .../versions/versions-get-resp.json | 2 +- nova/api/openstack/api_version_request.py | 4 +- nova/api/openstack/compute/floating_ips.py | 4 ++ nova/api/openstack/compute/multinic.py | 4 ++ .../compute/rest_api_version_history.rst | 36 ++++++++++++++++++ .../openstack/compute/virtual_interfaces.py | 3 ++ .../openstack/compute/test_floating_ips.py | 19 ++++++++++ .../api/openstack/compute/test_multinic.py | 38 ++++++++++--------- .../compute/test_virtual_interfaces.py | 14 ++++++- ...virtualinterface-api-73b24e5304635e9d.yaml | 33 ++++++++++++++++ 15 files changed, 169 insertions(+), 44 deletions(-) create mode 100644 releasenotes/notes/deprecates-multinic-floatingipaction-osvirtualinterface-api-73b24e5304635e9d.yaml diff --git a/api-ref/source/index.rst b/api-ref/source/index.rst index ffb989956e0..f80626376a4 100644 --- a/api-ref/source/index.rst +++ b/api-ref/source/index.rst @@ -30,7 +30,6 @@ the `API guide `_. .. 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 `_. .. include:: os-security-group-default-rules.inc .. include:: os-security-group-rules.inc .. include:: os-hosts.inc +.. include:: os-virtual-interfaces.inc diff --git a/api-ref/source/os-virtual-interfaces.inc b/api-ref/source/os-virtual-interfaces.inc index b7fcd7518c3..3390bdf1adb 100644 --- a/api-ref/source/os-virtual-interfaces.inc +++ b/api-ref/source/os-virtual-interfaces.inc @@ -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 diff --git a/api-ref/source/servers-action-fixed-ip.inc b/api-ref/source/servers-action-fixed-ip.inc index 5bbe90c982a..71f06490f50 100644 --- a/api-ref/source/servers-action-fixed-ip.inc +++ b/api-ref/source/servers-action-fixed-ip.inc @@ -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) -===================================================== - -.. 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 diff --git a/api-ref/source/servers-actions.inc b/api-ref/source/servers-actions.inc index d6aae58dc5a..a4c56be00aa 100644 --- a/api-ref/source/servers-actions.inc +++ b/api-ref/source/servers-actions.inc @@ -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 diff --git a/doc/api_samples/versions/v21-version-get-resp.json b/doc/api_samples/versions/v21-version-get-resp.json index 241212017ea..793177e1007 100644 --- a/doc/api_samples/versions/v21-version-get-resp.json +++ b/doc/api_samples/versions/v21-version-get-resp.json @@ -19,7 +19,7 @@ } ], "status": "CURRENT", - "version": "2.43", + "version": "2.44", "min_version": "2.1", "updated": "2013-07-23T11:33:21Z" } diff --git a/doc/api_samples/versions/versions-get-resp.json b/doc/api_samples/versions/versions-get-resp.json index 924b060df15..e0b3d8a024f 100644 --- a/doc/api_samples/versions/versions-get-resp.json +++ b/doc/api_samples/versions/versions-get-resp.json @@ -22,7 +22,7 @@ } ], "status": "CURRENT", - "version": "2.43", + "version": "2.44", "min_version": "2.1", "updated": "2013-07-23T11:33:21Z" } diff --git a/nova/api/openstack/api_version_request.py b/nova/api/openstack/api_version_request.py index 254920e211d..d1409730dff 100644 --- a/nova/api/openstack/api_version_request.py +++ b/nova/api/openstack/api_version_request.py @@ -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 @@ -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 diff --git a/nova/api/openstack/compute/floating_ips.py b/nova/api/openstack/compute/floating_ips.py index ac472e72c5d..d800b82ea9b 100644 --- a/nova/api/openstack/compute/floating_ips.py +++ b/nova/api/openstack/compute/floating_ips.py @@ -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) @@ -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) diff --git a/nova/api/openstack/compute/multinic.py b/nova/api/openstack/compute/multinic.py index 2e46e81c152..4d44ebc9776 100644 --- a/nova/api/openstack/compute/multinic.py +++ b/nova/api/openstack/compute/multinic.py @@ -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)) @@ -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)) diff --git a/nova/api/openstack/compute/rest_api_version_history.rst b/nova/api/openstack/compute/rest_api_version_history.rst index afcfd03f6d4..b8a6c50f280 100644 --- a/nova/api/openstack/compute/rest_api_version_history.rst +++ b/nova/api/openstack/compute/rest_api_version_history.rst @@ -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. diff --git a/nova/api/openstack/compute/virtual_interfaces.py b/nova/api/openstack/compute/virtual_interfaces.py index 7dcebecdfa8..6b59e947224 100644 --- a/nova/api/openstack/compute/virtual_interfaces.py +++ b/nova/api/openstack/compute/virtual_interfaces.py @@ -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 @@ 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.""" diff --git a/nova/tests/unit/api/openstack/compute/test_floating_ips.py b/nova/tests/unit/api/openstack/compute/test_floating_ips.py index d184769fdbe..1cb214142dd 100644 --- a/nova/tests/unit/api/openstack/compute/test_floating_ips.py +++ b/nova/tests/unit/api/openstack/compute/test_floating_ips.py @@ -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) diff --git a/nova/tests/unit/api/openstack/compute/test_multinic.py b/nova/tests/unit/api/openstack/compute/test_multinic.py index 3ebb3cecf5c..148d8906ed7 100644 --- a/nova/tests/unit/api/openstack/compute/test_multinic.py +++ b/nova/tests/unit/api/openstack/compute/test_multinic.py @@ -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): @@ -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): @@ -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) diff --git a/nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py b/nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py index 96552341f0b..87a3b09fb4e 100644 --- a/nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py +++ b/nova/tests/unit/api/openstack/compute/test_virtual_interfaces.py @@ -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, @@ -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) diff --git a/releasenotes/notes/deprecates-multinic-floatingipaction-osvirtualinterface-api-73b24e5304635e9d.yaml b/releasenotes/notes/deprecates-multinic-floatingipaction-osvirtualinterface-api-73b24e5304635e9d.yaml new file mode 100644 index 00000000000..38a9aab25b6 --- /dev/null +++ b/releasenotes/notes/deprecates-multinic-floatingipaction-osvirtualinterface-api-73b24e5304635e9d.yaml @@ -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.