os-interface:show will not handle PortNotFoundClient exception from neutron

Bug #1378389 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matt Riedemann

Bug Description

The os-interface:show method in the v2/v3 compute API is catching a NotFound(NovaException):

http://git.openstack.org/cgit/openstack/nova/tree/nova/api/openstack/compute/contrib/attach_interfaces.py?id=2014.2.rc1#n67

But when using the neutronv2 API, if you get a port not found it's going to raise up a PortNotFoundClient(NeutronClientException), which won't be handled by the NotFound(NovaException) in the compute API since it's not the same type of exception.

http://git.openstack.org/cgit/openstack/nova/tree/nova/network/neutronv2/api.py?id=2014.2.rc1#n584

This bug has two parts:

1. The neutronv2 API show_port method needs to return nova exceptions, not neutron client exceptions.

2. The os-interfaces:show v2/v3 APIs need to handle the exceptions (404 is handled, but neutron can also raise Forbidden/Unauthorized which the compute API isn't handling).

Tags: api network
Matt Riedemann (mriedem)
Changed in nova:
status: New → In Progress
importance: Undecided → Medium
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/126617

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

Reviewed: https://review.openstack.org/125777
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=b7ffb49e2369913df0c6b7aeb72cbc0b1e42c947
Submitter: Jenkins
Branch: master

commit b7ffb49e2369913df0c6b7aeb72cbc0b1e42c947
Author: Matt Riedemann <email address hidden>
Date: Thu Oct 2 13:53:06 2014 -0700

    neutronv2: translate 401 and 404 neutron client errors in show_port

    This translates the PortNotFoundClient and Unauthorized exceptions from
    the neutron client's show_port call into the corresponding nova
    exceptions. This is useful in the case of a compute API calling
    network_api.show_port, e.g. the os-interface API. The compute API
    should expect a NovaException back from the network API rather than a
    NeutronClientException (since the compute API shouldn't know if it's
    talking to nova-network or neutron).

    Long-term we should refactor more of the neutronv2 API code to re-use
    the show_port method since there are several places where
    neutron.show_port is called directly with additional filtering, etc,
    but they potentially also have the same exception translation issues.

    Partial-Bug: #1378389

    Change-Id: Ic76d3af6b31e501d9ded5f60da9106d5ef88f4b7

Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Reviewed: https://review.openstack.org/126617
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=8299e80ad437d86925484366c29a01fa30c344ed
Submitter: Jenkins
Branch: master

commit 8299e80ad437d86925484366c29a01fa30c344ed
Author: Matt Riedemann <email address hidden>
Date: Tue Oct 7 09:32:57 2014 -0700

    Handle Forbidden error from network_api.show_port in os-interface:show

    We can get a 403 back from the neutronv2 API when calling
    network_api.show_port so handle that in the compute API extension.

    This also updates the v3 API code to match the v2 API code to put the
    original error message for the 404 into the HTTPNotFound error.

    Closes-Bug: #1378389

    Change-Id: I7afc832f26481dc44f1c500b6121e2060f36c63a

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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