neutronclient should raise generic per-code exceptions

Bug #1296148 reported by Akihiro Motoki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Medium
Akihiro Motoki
python-neutronclient
Fix Released
High
Akihiro Motoki

Bug Description

Neutronclient now raises known exceptions (such as NetworkNotFound, PortNotFound,...) or generic NeutronClientException, and library users (like Horizon) cannot catch generic NotFound exception without checking the detail of NeutronClientException.
Obviously neutronclient should raise individual exceptions based on response status code (400, 404, 409 and so on).

By doing so, Horizon exception handling will be much simpler and I believe it brings the similar merits to other library users.
In Horizon it is targeted to Icehouse release.

It is related to bug 1284317, which is specific to Router Not Found exception, and this bug is intended to address the issue in more generic way.

Akihiro Motoki (amotoki)
Changed in horizon:
milestone: none → icehouse-rc1
importance: Undecided → Medium
assignee: nobody → Akihiro Motoki (amotoki)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-neutronclient (master)

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

Changed in python-neutronclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

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

Changed in horizon:
status: New → In Progress
Revision history for this message
Akihiro Motoki (amotoki) wrote :

I think this does not hit any issues reported, so I would like to re-target it to Juno.

Changed in horizon:
milestone: icehouse-rc1 → juno-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-neutronclient (master)

Reviewed: https://review.openstack.org/82319
Committed: https://git.openstack.org/cgit/openstack/python-neutronclient/commit/?id=ecad086e5964cc67c8c261861bcc988fe2a3bffb
Submitter: Jenkins
Branch: master

commit ecad086e5964cc67c8c261861bcc988fe2a3bffb
Author: Akihiro Motoki <email address hidden>
Date: Sat Mar 22 19:50:08 2014 +0900

    Rearrange neutronclient exceptions for more easy use

    - Map exceptions from neutron server into corresponding client
      exceptions automatically (without exception mapping dict).
      An exception from Neutron server 'SomeException' will be
      mapped to an exception 'SomeExceptionClient' ('Client' suffix)
      if it is defined.

    - If no corresponding exception is defined in client side,
      an exception per response code will be used. Previously
      NeutronClientException was used for all cases and a user
      of client library cannot know exception type without
      checking exception.status_code. It allows client lib users
      (such as Horizon) to handle exceptions more easily.

    - All exceptions from client libarry inherit NeutronClientException
      and all CLI related exceptions inherits NeutronCLIError now.

    - Remove unused exceptions (including Quantum v1 related)
    - MalformedRequestBody is renamed to MalformedResponseBody
      because it is raised in deserializer and deserializer is
      used to parse not request but response.

    Closes-Bug: #1296148
    Change-Id: I99b9560b3afaf5884fd00353323267da450338fa

Changed in python-neutronclient:
status: In Progress → Fix Committed
Revision history for this message
Julie Pichon (jpichon) wrote :

The Horizon patch was ready but waiting for a new neutron client release, has this happened yet?

Changed in horizon:
milestone: juno-1 → juno-2
Changed in horizon:
milestone: juno-2 → juno-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/82320
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=a1fdb4709c8fa2a1766732b65d28462a3bf6eb4a
Submitter: Jenkins
Branch: master

commit a1fdb4709c8fa2a1766732b65d28462a3bf6eb4a
Author: Akihiro Motoki <email address hidden>
Date: Sun Mar 23 06:46:05 2014 +0900

    Update exception map based on neutronclient exception rearrange

    Change-Id: I59f31d269f97d86ce9b681dc7714c9a10892a3a2
    Closes-Bug: #1296148
    Related-Bug: #1284317

Changed in horizon:
status: In Progress → Fix Committed
Kyle Mestery (mestery)
Changed in python-neutronclient:
milestone: none → 2.3.5
Akihiro Motoki (amotoki)
Changed in python-neutronclient:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: juno-3 → 2014.2
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.