I started the exceptions topic, 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  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
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.
- 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  should be ready for merge.