diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-01-13 01:47:43 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-01-13 01:47:43 +0000 |
commit | 48f30a663fcca893c20b20bb077d54ef131c5191 (patch) | |
tree | 72d40d3d855f55eb4edfc47db4f3c8a64a5488fd | |
parent | 47e75c9d57626c853c03fbde942b6d85b1905a9e (diff) | |
parent | ac8b949706b8d0eb0a83193e0187f63dd7ee3225 (diff) | |
download | nova-48f30a663fcca893c20b20bb077d54ef131c5191.tar.gz nova-48f30a663fcca893c20b20bb077d54ef131c5191.tar.xz nova-48f30a663fcca893c20b20bb077d54ef131c5191.zip |
Merge "Fix error in NovaBase.save() method"
-rw-r--r-- | nova/db/sqlalchemy/models.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index 95fa6313f..52985a3eb 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -48,8 +48,17 @@ class NovaBase(object): """Save this object.""" if not session: session = get_session() - session.add(self) - session.flush() + # NOTE(boris-42): This part of code should be look like: + # sesssion.add(self) + # session.flush() + # But there is a bug in sqlalchemy and eventlet that + # raises NoneType exception if there is no running + # transaction and rollback is called. As long as + # sqlalchemy has this bug we have to create transaction + # explicity. + with session.begin(subtransactions=True): + session.add(self) + session.flush() def soft_delete(self, session=None): """Mark this object as deleted.""" |