Comment 5 for bug 1224429

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/78141
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=13387c01390e70c9d7811760e603e6306d6d7ea7
Submitter: Jenkins
Branch: master

commit 13387c01390e70c9d7811760e603e6306d6d7ea7
Author: ChangBo Guo(gcb) <email address hidden>
Date: Wed Mar 5 17:00:58 2014 +0800

    Don't use ModelBase.save() inside of transaction

    'with session.begin()' makes some operations in one transaction.
    session.begin() returns a transaction instance, then does some operations,
    and will commit or rollback automatically before leaving the block.
    ModelBase.save() always submit a commit, and that is not expected.
    When we get a persistent object from database, we just modify the
    object inside of block 'with session.begin()' and sqlalchemy will
    update it, don't need method session.add() or ModelBase.save().

    Closes-Bug: #1224429
    Change-Id: I4af58e98b2783d3945d92e57680d58e7ae356a67