Nova API floating IP error code inconsistent between Nova-Net and Quantum

Bug #1160309 reported by Phil Day
32
This bug affects 6 people
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
High
Ala Rezmerita
Grizzly
Fix Released
High
Ionuț Arțăriși
tempest
Fix Released
High
Ala Rezmerita

Bug Description

If you ask for details of a floating IP address (GET .../os-floating-ips/<id>) that is not allocated to you, then on a system with Nova-networking the error code is 404 itemNotFound, whereas on a system with Quantum the error code is 500 computeFault.

The Nova Floating IP API code (api/openstack/compute/contrib/floating_ips.py) traps the NotFound exception raised by Nova-Net, but the quantum networking raises a QuantumClientException.

Not clear to me if the network/quantumv2/api code can just trap that exception in this case and translate it to NotFound. or if we need a seperate exception from the quantum client

Devstack with Nova-Net:
====================

$ curl -k -i http://10.2.1.79:8774/v2/7ac11f64dbf84c548f4161cf408b9799/os-floating-ips/1 -X GET -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: ...."
HTTP/1.1 200 OK
X-Compute-Request-Id: req-c16fdbbe-dcda-4c3b-be46-d70a4fdade5d
Content-Type: application/json
Content-Length: 103
Date: Tue, 26 Mar 2013 10:45:04 GMT

{"floating_ip": {"instance_id": null, "ip": "172.24.4.225", "fixed_ip": null, "id": 1, "pool": "nova"}}

$ nova floating-ip-delete 172.24.4.225

$ curl -k -i http://10.2.1.79:8774/v2/7ac11f64dbf84c548f4161cf408b9799/os-floating-ips/1 -X GET -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: ..,."TTP/1.1 404 Not Found
Content-Length: 76
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-61125f73-8989-4f00-9799-2d22e0ec4d51
Date: Tue, 26 Mar 2013 10:45:28 GMT

{"itemNotFound": {"message": "Floating ip not found for id 1", "code": 404}}ubuntu@server-1357841265-az-3-region-a-geo-1:/mnt/devstack$

DevStack with Quantum:
====================
$ curl -k -i http://10.2.2.114:8774/v2/18b18e535c6149b0bf71a42b46f2ab39/os-floating-ips/c7a3a81e-28c8-4b15-94f4-6ca55e9c437b -X GET -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: ..."HTTP/1.1 200 OK
X-Compute-Request-Id: req-77b52904-6cd9-402d-93a2-124cfdcc86b2
Content-Type: application/json
Content-Length: 180
Date: Tue, 26 Mar 2013 10:36:16 GMT

{"floating_ip": {"instance_id": "09ffe9c9-0138-4f2f-b11b-c92e8d099b63", "ip": "172.24.4.227", "fixed_ip": "10.0.0.5", "id": "c7a3a81e-28c8-4b15-94f4-6ca55e9c437b", "pool": "nova"}}

$ nova floating-ip-delete 172.24.4.227

$ curl -k -i http://10.2.2.114:8774/v2/18b18e535c6149b0bf71a42b46f2ab39/os-floating-ips/c7a3a81e-28c8-4b15-94f4-6ca55e9c437b -X GET -H "X-Auth-Project-Id: demo" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: ..."

HTTP/1.1 500 Internal Server Error
Content-Length: 128
Content-Type: application/json; charset=UTF-8
X-Compute-Request-Id: req-720eb948-ae3a-4837-ab95-958d70132aa5
Date: Tue, 26 Mar 2013 10:39:09 GMT

{"computeFault": {"message": "The server has either erred or is incapable of performing the requested operation.", "code": 500}}

From the API log:
2013-03-25 19:11:00.377 DEBUG nova.api.openstack.wsgi [req-eda934a2-549d-4954-99b9-9dac74df01db 64090786631639 40099433467163] Calling method <bound method FloatingIPController.show of <nova.api.openstack.compute.contrib.floating_ips.FloatingIPController object at 0x45c4ed0>> _process_stack /usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py:924
2013-03-25 19:11:00.510 ERROR nova.api.openstack [req-eda934a2-549d-4954-99b9-9dac74df01db 64090786631639 40099433467163] Caught error: Floating IP 8e9a5dfb-90f5-4fce-a82b-d814fe461d7b could not be found
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack Traceback (most recent call last):
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/__init__.py", line 81, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return req.get_response(self.application)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1296, in send
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack application, catch_exc_info=False)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/request.py", line 1260, in call_application
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack app_iter = application(self.environ, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return resp(environ, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/hp/middleware/cs_auth_token.py", line 137, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return super(CsAuthProtocol, self).__call__(env, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/keystoneclient/middleware/auth_token.py", line 348, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return self.app(env, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return resp(environ, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return resp(environ, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return resp(environ, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/routes/middleware.py", line 131, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack response = self.app(environ, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 144, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return resp(environ, start_response)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack resp = self.call_func(req, *args, **self.kwargs)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return self.func(req, *args, **kwargs)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 895, in __call__
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack content_type, body, accept)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 955, in _process_stack
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack action_result = self.dispatch(meth, request, action_args)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/wsgi.py", line 1035, in dispatch
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return method(req=request, **action_args)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/api/openstack/compute/contrib/floating_ips.py", line 130, in show
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack floating_ip = self.network_api.get_floating_ip(context, id)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/nova/network/quantumv2/api.py", line 600, in get_floating_ip
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack fip = client.show_floatingip(id)['floatingip']
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 105, in with_params
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack ret = self.function(instance, *args, **kwargs)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 409, in show_floatingip
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack return self.get(self.floatingip_path % (floatingip), params=_params)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 772, in get
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack headers=headers, params=params)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 757, in retry_request
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack headers=headers, params=params)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 702, in do_request
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack self._handle_fault_response(status_code, replybody)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 683, in _handle_fault_response
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack exception_handler_v20(status_code, des_error_body)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack File "/usr/lib/python2.7/dist-packages/quantumclient/v2_0/client.py", line 78, in exception_handler_v20
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack message=error_dict)
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack QuantumClientException: Floating IP 8e9a5dfb-90f5-4fce-a82b-d814fe461d7b could not be found
2013-03-25 19:11:00.510 65276 TRACE nova.api.openstack
2013-03-25 19:11:00.515 INFO nova.api.openstack [req-eda934a2-549d-4954-99b9-9dac74df01db 64090786631639 40099433467163] http://compute.systestb.hpcloud.net/v1.1/40099433467163/os-floating-ips/8e9a5dfb-90f5-4fce-a82b-d814fe461d7b returned with HTTP 500

Chuck Short (zulcss)
Changed in nova:
status: New → Triaged
Revision history for this message
Jordan Pittier (jordan-pittier) wrote :

A similiar "exception translation" seems to happen in _get_floating_ips_by_fixed_and_port of nova/network/quantumv2/api.py.

This bug makes two tempest tests from floating_ips:test_list_floating_ips.py to fail.

Revision history for this message
Jordan Pittier (jordan-pittier) wrote :

This also impact the test test_floating_ips_actions.py:FloatingIPsTestJSON.test_delete_floating_ip because client.wait_for_resource_deletion calls tempest/services/compute/json/floating_ips_client.py:is_resource_deleted which expects a exceptions.NotFound not a exceptions.computeFault

Sean Dague (sdague)
Changed in tempest:
status: New → Confirmed
importance: Undecided → High
Sean Dague (sdague)
Changed in nova:
importance: Undecided → High
Changed in tempest:
assignee: nobody → Ala Rezmerita (arezmerita)
Changed in nova:
assignee: nobody → Ala Rezmerita (arezmerita)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/33024

Changed in nova:
status: Triaged → In Progress
Revision history for this message
Attila Fazekas (afazekas) wrote :

@arezmerita:
Can you restore/rebase your change ?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/33024
Committed: http://github.com/openstack/nova/commit/4a2915b4e389bfba0ff25583369fd75b24e19118
Submitter: Jenkins
Branch: master

commit 4a2915b4e389bfba0ff25583369fd75b24e19118
Author: Ala Rezmerita <email address hidden>
Date: Thu Jul 18 11:48:36 2013 +0200

    Fix inconsistency between Nova-Net and Neutron

    The neutron client raises NeutronClientException (status_code 404)
    that is not unknown for nova, and is translated in 500 computeFault.
    Catching this exception in nova/nova/network/neutronv2/api.py and
    raising more generic exception as exception.NotFound solves the problem.

    Added also an unitary test to test neutronv2 api

    bug #1160309
    bug #1200175

    Change-Id: Ib2f1a0d49a12114b28f0cd5ce0bb7119f864d1a6

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/44445

Thierry Carrez (ttx)
Changed in nova:
milestone: none → havana-3
status: Fix Committed → Fix Released
Revision history for this message
Christopher Yeoh (cyeoh-0) wrote :

The nova fix references above means this is no longer an issue for tempest

Changed in tempest:
status: Confirmed → Fix Released
Sean Dague (sdague)
Changed in tempest:
milestone: none → havana-3
Thierry Carrez (ttx)
Changed in nova:
milestone: havana-3 → 2013.2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/grizzly)

Reviewed: https://review.openstack.org/44445
Committed: http://github.com/openstack/nova/commit/ae8842c66e6bac03717bed62c644b7c85708bf5a
Submitter: Jenkins
Branch: stable/grizzly

commit ae8842c66e6bac03717bed62c644b7c85708bf5a
Author: Ala Rezmerita <email address hidden>
Date: Thu Jul 18 11:48:36 2013 +0200

    Fix inconsistency between Nova-Net and Neutron

    The neutron client raises NeutronClientException (status_code 404)
    that is not unknown for nova, and is translated in 500 computeFault.
    Catching this exception in nova/nova/network/neutronv2/api.py and
    raising more generic exception as exception.NotFound solves the problem.

    Added also an unitary test to test neutronv2 api

    bug #1160309
    bug #1200175

    (cherry picked from commit 4a2915b4e389bfba0ff25583369fd75b24e19118)

    Conflicts:
     nova/network/quantumv2/api.py

    Change-Id: Ib2f1a0d49a12114b28f0cd5ce0bb7119f864d1a6

tags: added: in-stable-grizzly
Alan Pevec (apevec)
tags: removed: in-stable-grizzly
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.