]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Fix invalid cache image-volume creation
authorJohn Griffith <john.griffith@solidfire.com>
Sat, 12 Dec 2015 18:32:57 +0000 (18:32 +0000)
committerJohn Griffith <john.griffith8@gmail.com>
Mon, 14 Dec 2015 05:24:30 +0000 (22:24 -0700)
commit3f3a8f11571a71770f08bc2ef48562300b44d9f7
tree1ae4a902dd56a431bc9cff720edfc72df343a995
parentef0bfc288d6513a868e0e25b1f7effd13fccb754
Fix invalid cache image-volume creation

During the volume ref creation in clone_image_volume
we were including a _name_id attribute which is invalid
in the base olso object.  The result is silent failure
for a key error. Note that the comments for the column
in the db specifcally state "do not call directly".
The variable is also denoted as private by the _ prefix.

Fix this by just popping the "_name_id' attribute.

In addition there were a number of things that needed
some cleanup:
1. Don't iterate over list of tuples to get K/V for dict
   Just use Dict(xxxx)
2. Don't use delete dict.key
   This isn't safe, because if the key DNE you'll get a key exception
   Instead use pop which is safe if key DNE
3. Add an error message when this fails, because currently the logs
   don't give an operation a chance of knowing it failed, let alone
   an opportunity to debug it

Finally the cache volume creation is still calling the db
directly and doing a resource create as opposed to
using the new volume object create handler.  I went ahead
and converted this to use objects, however that resulted in
breaking two of the volume-->image unit tests that use cinder
as a glance backend.

I've opened bug 1525773 for those issues and added a skip
to the tests in question.

Change-Id: Ieda40c1111d4d4d69488944eb332962eb9658266
Closes-Bug: #1525452
cinder/tests/unit/test_volume.py
cinder/volume/manager.py