]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Add return of updated object on update from DB
authorJohn Griffith <john.griffith8@gmail.com>
Tue, 29 Jul 2014 15:41:06 +0000 (09:41 -0600)
committerJohn Griffith <john.griffith8@gmail.com>
Tue, 29 Jul 2014 15:44:23 +0000 (09:44 -0600)
There are a number of update methods in db/sqla/api
that update objects but no longer return the updated
reference for said object.

This patch adds the missing returns which are already
expected in the calling cidner/db/api wrapper. At some
point a close look at usage in callers
(ie cinder/volume/manager) should be done to make sure
we're being efficient here and not doing another get after
every update.

Change-Id: I0464d1879571a0044a416d652a186b1462c57fa2
Closes-Bug: #1349912

cinder/db/sqlalchemy/api.py

index 67eafbac508ed4c1627f1ee3fda39496217856a3..08b9084829625f0869abc23176e34055ba7c5d19 100644 (file)
@@ -398,6 +398,7 @@ def service_update(context, service_id, values):
     with session.begin():
         service_ref = _service_get(context, service_id, session=session)
         service_ref.update(values)
+        return service_ref
 
 
 ###################
@@ -513,6 +514,7 @@ def quota_update(context, project_id, resource, limit):
     with session.begin():
         quota_ref = _quota_get(context, project_id, resource, session=session)
         quota_ref.hard_limit = limit
+        return quota_ref
 
 
 @require_admin_context
@@ -592,6 +594,7 @@ def quota_class_update(context, class_name, resource, limit):
         quota_class_ref = _quota_class_get(context, class_name, resource,
                                            session=session)
         quota_class_ref.hard_limit = limit
+        return quota_class_ref
 
 
 @require_admin_context
@@ -1647,6 +1650,7 @@ def snapshot_update(context, snapshot_id, values):
     with session.begin():
         snapshot_ref = _snapshot_get(context, snapshot_id, session=session)
         snapshot_ref.update(values)
+        return snapshot_ref
 
 ####################