[ovirt-devel] [VDSM] exceptions cleanup

Nir Soffer nsoffer at redhat.com
Sun Jan 10 23:06:44 UTC 2016


Hi all,

I started the exceptions topic[1], trying to:
- gather all exceptions in vdsm.exception
- make all exceptions inherit from same base class
- add exceptions for virt errors, currently managed in vdsm.define (unfinished)
- add missing tests for the exception logic

Having exceptions for all api errors, we can simplify error handling
in virt so you can raise an exception in any level, and have one top
level error handler that knows how to create an error response.
See Piotr patch [2] adding such handler.

One issue raised by Pitor was ensuring that we don't have duplicate error
codes. We have tests/main.py, checking that storage exceptions and gluster
exceptions use unique error codes.

Another issue raised by Pitor is having single location for vdsm error codes,
instead of duplicating the information in both vdsm and engine. Actually this
info is duplicated also in hosted engine setup and agent, and maybe in other
places.

I think the best solution for this is to generate the java module used by engine
from vdsm.exception. Python applications can depend on vdsm-api package,
and import vdsm.exception.

Future changes:

- Merge storage_exception, into vdsm.exception
- Move vdsm.exception into api pacakge
- Cover all exceptions in the unique error code tests
- Replace the error response dict in all verbs with raising an exception
- Dropping the error handler in vdsm.storage.dispatcher.

The first 4 patches in [1] should be ready for merge.

Thoughts?

[1] https://gerrit.ovirt.org/#/q/status:open+project:vdsm+branch:master+topic:exceptions
[2] https://gerrit.ovirt.org/#/c/51549/2/vdsm/rpc/Bridge.py

Nir



More information about the Devel mailing list