Permalink
Browse files

sm vol driver: Fix regression in sm_backend_conf_update

Fixes bug 915108

Change-Id: Iffa9a1a51f6e9da0cba9fdae373135ea6a70990f
  • Loading branch information...
Renuka Apte authored and vishvananda committed Jan 12, 2012
1 parent 73dfd4e commit e65045855920aeaa60032ea5f4e823a9a2e856a6
Showing with 9 additions and 6 deletions.
  1. +9 −6 nova/db/sqlalchemy/api.py
View
@@ -4141,17 +4141,20 @@ 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").\
+ 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(
+ if not backend_conf:
+ raise exception.NotFound(
_("No backend config with id %(sm_backend_id)s") % locals())
- backend_conf.update(values)
- backend_conf.save()
+ backend_conf.update(values)
+ backend_conf.save(session=session)
return backend_conf

0 comments on commit e650458

Please sign in to comment.