yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #05580
[Bug 1224429] Re: Don't use ModelBase.save() inside of block session.begin()
** Changed in: nova
Status: Fix Committed => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1224429
Title:
Don't use ModelBase.save() inside of block session.begin()
Status in OpenStack Compute (Nova):
Fix Released
Status in Savanna project:
Fix Released
Bug description:
Current code use ModelBase.save() always submit a commit even inside a block fo with session.begin().
this is not purpose of using session.begin() to organize some operations in one transaction
1)session.begin() will return a SessionTransaction instance, then call SessionTransaction.__enter__()
and do something in with block, then call SessionTransaction.__exit__(), in method __exit__() will commit or rollback automatically. See https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/orm/session.py#L451
2) There is also suggestion metioned in https://github.com/openstack/nova/blob/master/nova/openstack/common/db/sqlalchemy/session.py#L76
3) ModelBase.save() begin another transaction see https://github.com/openstack/nova/blob/master/nova/openstack/common/db/sqlalchemy/models.py#L51
so we'd better don't use ModelBase.save() inside of block
session.begin()
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1224429/+subscriptions