Handle all the exception types defined by senlin

Registered by Haiwei Xu

Currently some exceptions defined by senlin are not or not correctly mapped to standard http exception, which will cause a internal error. These exceptions should be properly handled.
* Fix the exception types which are wrongly mapped to standard http exception(not internal error).
* Check the exception types created by senlin which are not mapping to standard http exception(not internal error), and correctly map them.
* Check the use of HTTPInternalServerError.

* Handling the exception from openstackSDK

** First, implement a parse_exception method to parse the exception type from openstackSDK. (Refer to http://git.openstack.org/cgit/stackforge/python-senlinclient/tree/senlinclient/common/exc.py#n228)
** Then catch the SDK exceptions wherever they happen, and use parse_exception to parse them.
The code is like:
  try:
      self.conn.do_something()
  except Exception as ex:
      raise exutil.parse_exception(ex) # parse_exception method should return an InternalError.
** In the upper layer, catch the InternalError and translate it to the proper senlin exception type by checking the error code and error message.
  try:
     nova_driver.flavor_get(flavor_id)
  except InternalError as ex:
     LOG.exception(xxx)
     raise SenlinBadRequest()

Blueprint information

Status:
Complete
Approver:
Qiming Teng
Priority:
Medium
Drafter:
Haiwei Xu
Direction:
Approved
Assignee:
Haiwei Xu
Definition:
Approved
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Haiwei Xu
Completed by
Haiwei Xu

Related branches

Sprints

Whiteboard

Gerrit topic: https://review.openstack.org/#q,topic:bp/senlin-exception-handling,n,z

Addressed by: https://review.openstack.org/192950
    Fix exception mapping miss

Addressed by: https://review.openstack.org/193001
    Rename NotSupported exception to FeatureNotSupported

Addressed by: https://review.openstack.org/193021
    Rename PolicyExists to PolicyTypeConflict

Addressed by: https://review.openstack.org/193920
    Change PolicyInUse exception to ResourceBusyError

Addressed by: https://review.openstack.org/194046
    Change PolicyNotAttached to an internal exception and handle it

Addressed by: https://review.openstack.org/194531
    Change ProfileInUse exception to ResourceBusyError

Addressed by: https://review.openstack.org/195435
    Handle NodeStatusError exception

Addressed by: https://review.openstack.org/197573
    Handle exception which happens in node deleting and updating

Addressed by: https://review.openstack.org/210254
    Revise senlin senlin exception handling from SDK side

Addressed by: https://review.openstack.org/212441
    Handle exceptions which happen in heat driver

Addressed by: https://review.openstack.org/213569
    Handle exceptions in keystone_v3 driver

Addressed by: https://review.openstack.org/214431
    Fix some exception mapping miss

Addressed by: https://review.openstack.org/215051
    Handle exception in neutron_v2 module

Addressed by: https://review.openstack.org/218047
    Handle SDK exception of sdk module

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.