Comment 14 for bug 1370191

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/icehouse)

Reviewed: https://review.openstack.org/124515
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=cac6472fd2ad495d22fe6fad89a9485cf025c437
Submitter: Jenkins
Branch: stable/icehouse

commit cac6472fd2ad495d22fe6fad89a9485cf025c437
Author: Mike Bayer <email address hidden>
Date: Fri Sep 26 17:27:53 2014 -0400

    Add _wrap_db_error() support to SessionTransaction.commit()

    This patch adds _wrap_db_error() to the commit()
    and rollback() methods of sqlalchemy.orm.session.SessionTransaction,
    which is the object that is dealt with when one invokes
    code of the form "with session.begin():". The context manager
    form does not invoke the commit() method on the
    SQLAlchemy Session directly, and instead calls the one
    local to the SessionTransaction.

    In order to intercept this, we must build a subclass
    of SessionTransaction with the appropriate wrapping, and
    then patch it into the object that is returned by
    Session.begin(), ensuring that it is compatible with
    _wrap_db_error().

    This whole approach is legacy; newer oslo.db versions
    intercept errors at the point at which they occur
    via engine events.

    Tests are omitted here as we are relying upon the tests
    that were added to the corresponding oslo-incubator code.

    Closes-bug: #1370191

    Change-Id: Ie0456e6daa86c99cf6fbe56ca5dfd8a618f14232