config: Refactor exception handling and reporting

Bug #1452835 reported by Hampapur Ajay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Juniper Openstack
Status tracked in Trunk
R1.1
Won't Fix
Medium
Hampapur Ajay
R2.20
Won't Fix
Medium
Hampapur Ajay
Trunk
Fix Committed
Medium
Hampapur Ajay

Bug Description

There is scope for improvements in exception handling in api-server and vnc-openstack extension in following areas:

1. Raise exceptions but defer handling(abort etc.) from bottom of call stacks to upper-layers giving them a chance to handle gracefully if possible. (e.g. vnc_cfg_ifmap.py:dbe_read should raise NoIdError but not transform into error-message. In update notification context it is a valid situation and can be handled gracefully)
2. There are patterns of
      ok, result = <some-callable>()
      if not ok:
          <error handling>
      This should be enhanced to also catch exceptions that can be handled gracefully vs not with appropriate error message in latter case.
3. Currently api-server returns human-readable strings on exceptions. Enhance to also append a json part that can be used in machine invocation contexts to generate exceptions on the remote end.
4. It would be good to send exception information (gracefully handled or otherwise) to collector.
5. Chained exception reporting (not losing information if there is an exception in any complex handling itself) would be good too.

Tags: config
Hampapur Ajay (hajay)
Changed in juniperopenstack:
assignee: nobody → Hampapur Ajay (hajay)
Hampapur Ajay (hajay)
description: updated
Changed in juniperopenstack:
importance: Undecided → Medium
tags: added: config
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/11812
Submitter: Hampapur Ajay (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/11812
Committed: http://github.org/Juniper/contrail-generateDS/commit/788d7b5dd99062856df59b2fab5cac5ded201982
Submitter: Zuul
Branch: master

commit 788d7b5dd99062856df59b2fab5cac5ded201982
Author: Hampapur Ajay <email address hidden>
Date: Fri May 15 13:35:01 2015 -0700

config-errhdl: Handle NoIdError from dbe_read.

This commit is in prepartion for a follow-on to contrail-controller
where dbe_read will raise NoIdError and have caller decide on course
of action.

Partial-Bug: #1452835

Change-Id: Ib146e5fa00f09b3fc330bd793ddb0bb87d46d94b

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] master

Review in progress for https://review.opencontrail.org/11942
Submitter: Hampapur Ajay (<email address hidden>)

information type: Proprietary → Public
Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/11942
Committed: http://github.org/Juniper/contrail-controller/commit/c8744187390fec8118c80561cd2eed9ec9ee562b
Submitter: Zuul
Branch: master

commit c8744187390fec8118c80561cd2eed9ec9ee562b
Author: Hampapur Ajay <email address hidden>
Date: Mon Jun 22 11:24:17 2015 -0700

config-exception: Handle dbe_read raising NoIdError

dbe_read will raise this if object not available and caller
will determine if this can be gracefully handled.
Handled with 404 in GET/PUT/DEL for object in URL.
Handled with 500 if a parent/referred object is missing.

Database errors remapped to DatabaseUnavailable exception.

Partial-Bug: #1452835

Change-Id: I991e311c20d7020bc84cd571f6484349cdabcfaa

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R1.10

Review in progress for https://review.opencontrail.org/12049
Submitter: Édouard Thuleau (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.22-dev

Review in progress for https://review.opencontrail.org/12336
Submitter: Hampapur Ajay (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/12336
Committed: http://github.org/Juniper/contrail-generateDS/commit/538565e5923ef71a009e6cf4395822d5cd26120b
Submitter: Zuul
Branch: R2.22-dev

commit 538565e5923ef71a009e6cf4395822d5cd26120b
Author: Hampapur Ajay <email address hidden>
Date: Fri May 15 13:35:01 2015 -0700

config-errhdl: Handle NoIdError from dbe_read.

This commit is in prepartion for a follow-on to contrail-controller
where dbe_read will raise NoIdError and have caller decide on course
of action.

Partial-Bug: #1452835

Change-Id: Ib146e5fa00f09b3fc330bd793ddb0bb87d46d94b
(cherry picked from commit 788d7b5dd99062856df59b2fab5cac5ded201982)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.22-dev

Review in progress for https://review.opencontrail.org/12343
Submitter: Hampapur Ajay (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/12343
Committed: http://github.org/Juniper/contrail-controller/commit/a418f45a646b9e2b989d2a2f22ce6cea48a60c9a
Submitter: Zuul
Branch: R2.22-dev

commit a418f45a646b9e2b989d2a2f22ce6cea48a60c9a
Author: Hampapur Ajay <email address hidden>
Date: Mon Jun 22 11:24:17 2015 -0700

config-exception: Handle dbe_read raising NoIdError

dbe_read will raise this if object not available and caller
will determine if this can be gracefully handled.
Handled with 404 in GET/PUT/DEL for object in URL.
Handled with 500 if a parent/referred object is missing.

Database errors remapped to DatabaseUnavailable exception.

Partial-Bug: #1452835

Change-Id: I991e311c20d7020bc84cd571f6484349cdabcfaa

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.20

Review in progress for https://review.opencontrail.org/13590
Submitter: ?douard Thuleau (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/13590
Committed: http://github.org/Juniper/contrail-generateDS/commit/230718072c56af8d6a47d30d6e36ec0561ca72b2
Submitter: Zuul
Branch: R2.20

commit 230718072c56af8d6a47d30d6e36ec0561ca72b2
Author: Hampapur Ajay <email address hidden>
Date: Fri May 15 13:35:01 2015 -0700

config-errhdl: Handle NoIdError from dbe_read.

This commit is in prepartion for a follow-on to contrail-controller
where dbe_read will raise NoIdError and have caller decide on course
of action.

Partial-Bug: #1452835

Change-Id: Ib146e5fa00f09b3fc330bd793ddb0bb87d46d94b
(cherry picked from commit 788d7b5dd99062856df59b2fab5cac5ded201982)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : [Review update] R2.20

Review in progress for https://review.opencontrail.org/19420
Submitter: Praneet Bachheti (<email address hidden>)

Revision history for this message
OpenContrail Admin (ci-admin-f) wrote : A change has been merged

Reviewed: https://review.opencontrail.org/19420
Committed: http://github.org/Juniper/contrail-controller/commit/ea2951a950b020f391001897fc66eedc790288c4
Submitter: Zuul
Branch: R2.20

commit ea2951a950b020f391001897fc66eedc790288c4
Author: Hampapur Ajay <email address hidden>
Date: Mon Jun 22 11:24:17 2015 -0700

config-exception: Handle dbe_read raising NoIdError

dbe_read will raise this if object not available and caller
will determine if this can be gracefully handled.
Handled with 404 in GET/PUT/DEL for object in URL.
Handled with 500 if a parent/referred object is missing.

Database errors remapped to DatabaseUnavailable exception.

Partial-Bug: #1452835

Conflicts:
 src/config/api-server/tests/test_ip_alloc.py
 src/config/api-server/vnc_addr_mgmt.py
 src/config/api-server/vnc_cfg_api_server.py
 src/config/api-server/vnc_cfg_ifmap.py
 src/config/api-server/vnc_cfg_types.py
 src/config/common/tests/test_common.py

Change-Id: I991e311c20d7020bc84cd571f6484349cdabcfaa
(cherry picked from commit c8744187390fec8118c80561cd2eed9ec9ee562b)

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.