Created
January 11, 2012 23:30
-
-
Save vishvananda/1597460 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py | |
index 83a0222..bcb0574 100644 | |
--- a/nova/db/sqlalchemy/api.py | |
+++ b/nova/db/sqlalchemy/api.py | |
@@ -3876,18 +3876,21 @@ def sm_backend_conf_create(context, values): | |
@require_admin_context | |
def sm_backend_conf_update(context, sm_backend_id, values): | |
- backend_conf = model_query(context, models.SMBackendConf, | |
- read_deleted="yes").\ | |
- filter_by(id=sm_backend_id).\ | |
- first() | |
+ session = get_session() | |
+ with session.begin(): | |
+ backend_conf = model_query(context, models.SMBackendConf, | |
+ session=session, | |
+ read_deleted="yes").\ | |
+ filter_by(id=sm_backend_id).\ | |
+ first() | |
- if not backend_conf: | |
- raise exception.NotFound( | |
- _("No backend config with id %(sm_backend_id)s") % locals()) | |
+ if not backend_conf: | |
+ raise exception.NotFound( | |
+ _("No backend config with id %(sm_backend_id)s") % locals()) | |
- backend_conf.update(values) | |
- backend_conf.save(session=session) | |
- return backend_conf | |
+ backend_conf.update(values) | |
+ backend_conf.save(session=session) | |
+ return backend_conf | |
@require_admin_context |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment