usage of volume objects break cinder as glance backend unit tests

Bug #1525773 reported by John Griffith
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Ryan McNair

Bug Description

While working on bug #1525452, I noticed that the code in manager:_clone_image_volume was doing a direct create call to the database which we shouldn't be doing anymore. Upon converting this to use the new cinder Volume Object for the reference creation this exposed a number of problems with the CopyVolumetoImageTestCase.

The following tests make there way into the _clone_iamge_volume call, however there's a number of fields that aren't set properly in the test. It appears these fields are being populated somewhere by a direct db.update call, however this results in circumventing the object create and thus we don't have valid fields when we try and create the object itself. I'm not sure if/how this impacts the actual code but it breaks the following unit tests:
    cinder.tests.unit.test_volume.CopyVolumeToImageTestCase.test_copy_volume_to_image_with_image_volume
    cinder.tests.unit.test_volume.CopyVolumeToImageTestCase.test_copy_volume_to_image_with_image_volume_failure

These tests fail with a KeyError and an incorrect assertion because the _clone_image_volume fails when it tries to create the Volume object due to a number of attributes not being specified or specified incorrectly, including at least (maybe others):
  availability_zone, consistencygroup, volume_attachment

For now I'm proposing a skip of these tests, as I've spent a bit of time and haven't been able to unravel the issue. I'd prefer to get the caching issue fixed properly and submitted and get some help figuring out the object issues.

This also points out that we seem to have a number of places circumventing the new object implementation and we should probably get that all fixed up quickly.

Tags: tests
Revision history for this message
John Griffith (john-griffith) wrote :

Additional note:
I believe the case that's broken here is upload volume to image, IFF using Cinder as a backend for Glance. The normal upload volume to image case should work still.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.openstack.org/298971

Changed in cinder:
assignee: nobody → Ryan McNair (rdmcnair)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/298971
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=c8cff0a3a78708d015d5f1d109fc1180638d0a29
Submitter: Jenkins
Branch: master

commit c8cff0a3a78708d015d5f1d109fc1180638d0a29
Author: Ryan McNair <email address hidden>
Date: Tue Mar 29 20:26:10 2016 +0000

    Re-enable image to volume with failure test

    The unit test test_copy_volume_to_image_with_image_volume_failure
    was being skipped because the volume availability_zone attribute
    (and a few others) were non-nullable and were not getting set. As of
    7a158ac4488ac86c742e15c714dda7dd76772366 these attributes are nullable
    and the tests now succeed.

    The remaining tests were fixed to use valid id's for the volumes so
    that warnings aren't emitted when running the test case.

    Closes-Bug: #1525773
    Change-Id: I6ee4f878d70d12e64f0c01807c58900bc48c0173

Changed in cinder:
status: In Progress → Fix Released
Eric Harney (eharney)
tags: added: tests
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/cinder 9.0.0.0b1

This issue was fixed in the openstack/cinder 9.0.0.0b1 development milestone.

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.