commit 3f3a8f11571a71770f08bc2ef48562300b44d9f7
Author: John Griffith <email address hidden>
Date: Sat Dec 12 18:32:57 2015 +0000
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.
Reviewed: https:/ /review. openstack. org/256966 /git.openstack. org/cgit/ openstack/ cinder/ commit/ ?id=3f3a8f11571 a71770f08bc2ef4 8562300b44d9f7
Committed: https:/
Submitter: Jenkins
Branch: master
commit 3f3a8f11571a717 70f08bc2ef48562 300b44d9f7
Author: John Griffith <email address hidden>
Date: Sat Dec 12 18:32:57 2015 +0000
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: Ieda40c1111d4d4 d69488944eb3329 62eb9658266
Closes-Bug: #1525452