cinder upload-to-image broken with v2 glance api

Bug #1210467 reported by Edward Hope-Morley
14
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Edward Hope-Morley

Bug Description

If I set glance_api_version=2 I get the following in cinder-volume.log when I do a upload-to-image:

2013-08-09 11:41:14.333 ERROR cinder.openstack.common.rpc.amqp [req-5e1cd5b0-18df-4ab6-a7bd-0a2050558be4 7680199f420d4e2a9c9527896b2550fe 5f827bafd54145959c7ea00f4eeae47a] Exception during message handling
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp Traceback (most recent call last):
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/openstack/common/rpc/amqp.py", line 433, in _process_data
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp **args)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/openstack/common/rpc/dispatcher.py", line 148, in dispatch
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp return getattr(proxyobj, method)(ctxt, **kwargs)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/manager.py", line 458, in copy_volume_to_image
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp payload['message'] = unicode(error)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp self.gen.next()
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/manager.py", line 452, in copy_volume_to_image
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp image_meta)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/volume/drivers/rbd.py", line 569, in copy_volume_to_image
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp image_meta, tmp_file)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/image/image_utils.py", line 294, in upload_volume
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp image_service.update(context, image_id, {}, image_file)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/image/glance.py", line 276, in update
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp _reraise_translated_image_exception(image_id)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/image/glance.py", line 274, in update
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp **image_meta)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/cinder/cinder/image/glance.py", line 149, in call
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp return getattr(client.images, method)(*args, **kwargs)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/opt/stack/python-glanceclient/glanceclient/v2/images.py", line 133, in update
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp setattr(image, key, value)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/usr/local/lib/python2.7/dist-packages/warlock/model.py", line 72, in __setattr__
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp self.__setitem__(key, value)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp File "/usr/local/lib/python2.7/dist-packages/warlock/model.py", line 48, in __setitem__
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp raise exceptions.InvalidOperation(msg)
2013-08-09 11:41:14.333 TRACE cinder.openstack.common.rpc.amqp InvalidOperation: Unable to set 'purge_props' to 'True'

This operation works fine with glance_api_ver=1

description: updated
Revision history for this message
Edward Hope-Morley (hopem) wrote :

ok so having now looked into this, it looks like the problem is that the Glance V2 image schema does not contain purge_props. I think this is actually a bug in Glance since as a result, there is now no way to purge properties (actually default in Glance is True so there is no way to disable pure_properties). I think we should disable this property for v2 call in cinder for now and I will raise a separate issue on Glance.

Changed in cinder:
assignee: nobody → Edward Hope-Morley (hopem)
status: New → In Progress
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/41082

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Ok so looks like there are two problems here:

1. purge_props is ot included in v2 image schema hence the above error.
2. glanceclient v2/images.py seperates update() from upload() so need to call upload if using v2 api

Hopefully fixed these in submitted patch above.

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

Reviewed: https://review.openstack.org/41082
Committed: http://github.com/openstack/cinder/commit/0f70282b78ece51e2e18c51c15aca7c89b7ebc23
Submitter: Jenkins
Branch: master

commit 0f70282b78ece51e2e18c51c15aca7c89b7ebc23
Author: Edward Hope-Morley <email address hidden>
Date: Fri Aug 9 13:06:46 2013 +0100

    Ignore purge_props for v2 Glance api and fix upload

    The V2 Glance API image schema does not contain
    purge_props. While this may be a bug in Glance,
    we will ignore this property in cinder when
    glance_api_version=2. This will not change behaviour
    since Glance defaults this property to True, Cinder
    never sets it to False and the v2 client appears to
    ignore it anyway.

    Also fixed image upload which is a seperate client
    call to update in v2 (v1 update does both).

    Change-Id: I0ba1d7d920984cface57795ace160ec300ff75e2
    Fixes: bug #1210467

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: havana-3 → 2013.2
Revision history for this message
Abel Lopez (al592b) wrote :

Shouldn't this also exist in nova? Seeing a similar issue where nova image-create fails, but cinder works fine

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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