From e4ad50563cc594f2648b1714039105d9bb3f4e7d Mon Sep 17 00:00:00 2001 From: John Griffith Date: Tue, 29 Jul 2014 09:41:06 -0600 Subject: [PATCH] Add return of updated object on update from DB 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index 67eafbac5..08b908482 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -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 #################### -- 2.45.2