Clean up db.volume_create()

Bug #1052176 reported by Mark McLoughlin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Wishlist
John Griffith

Bug Description

As observed by bcwaldon here: https://review.openstack.org/10461

Rather than doing:

 def volume_create(context, values):
     ...
     meta = volume_metadata_get(context, volume_ref.id)
     volume_ref.metadata = meta

     result = model_query(context, models.Volume, read_deleted="no").\
                          options(joinedload('volume_metadata')).\
                          filter_by(id=volume_ref['id']).first()
     if not result:
         raise exception.VolumeNotFound(volume_id=volume_ref['id'])

     return result

we can just do:

 def volume_create(context, values):
     ...
     return volume_get(context, volume_ref['id'])

Changed in cinder:
assignee: nobody → John Griffith (john-griffith)
status: New → Triaged
milestone: none → folsom-rc1
importance: Undecided → High
Changed in cinder:
status: Triaged → In Progress
Revision history for this message
Thierry Carrez (ttx) wrote :
Revision history for this message
Thierry Carrez (ttx) wrote :

Not sure that one is RC-critical, sounds like a cleanup rather than a bugfix

Thierry Carrez (ttx)
Changed in cinder:
milestone: folsom-rc1 → none
importance: High → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/13161
Committed: http://github.com/openstack/cinder/commit/58dd2385365e7f5b79dc0c151092795d02bfe802
Submitter: Jenkins
Branch: master

commit 58dd2385365e7f5b79dc0c151092795d02bfe802
Author: John Griffith <email address hidden>
Date: Mon Sep 17 15:36:10 2012 -0600

    Clean up db.volume_create()

     Adding the metadata return to db.volume_create() introduced some
     messy and unnecessary repitition in the code. This patch
     cleans that up and makes use of existing volume_get functions rather
     than duplicating the code in volume_create.

     This syncs cinder up with the patch as it's been submitted for nova
     in https://review.openstack.org/#/c/10461/

     Addresses bug #1052176

    Change-Id: I17aca069fbb0240770613f176430a1b2fcf2b25a

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → folsom-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: folsom-rc1 → 2012.2
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.