Image GET TypeError: 'ImageTarget' object does not support item assignment

Bug #1664317 reported by Eric Harney
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
New
Undecided
Unassigned

Bug Description

Image GET TypeError: 'ImageTarget' object does not support item assignment

How to get here:

Deploy devstack w/ ceph:

[glance_store]
rbd_store_pool = images
rbd_store_user = glance
rbd_store_ceph_conf = /etc/ceph/ceph.conf
stores = file, http, rbd
default_store = rbd
filesystem_store_datadir = /opt/stack/data/glance/images/

$ cinder create --image 7d007552-9b2c-4231-bff7-1fbabb4445ec 1
(cirros image from devstack)

$ nova boot --poll --flavor m1.nano --block-device-mapping vda=<id>:::0 vm1

$ nova stop vm1

$ nova image-create vm1 vm1-snap

$ cinder create --image vm1-snap --display-name vol2 3
  fails due to another issue in Cinder/Glance

$ cinder create --image vm1-snap --display-name vol2 3
  now fails w/ Glance HTTP 500

2017-02-13 13:20:26.058 INFO eventlet.wsgi.server [req-6be93b6d-5248-44d7-a711-9d6966dd6ac1 f1e126d0378c47da9f74f8bfc19b7a33 00b4a870ac264e8d8778766dd7c13aee] 192.168.110.227 - - [13/Feb/2017 13:20:26] "GET /v2/schemas/image HTTP/1.1" 200 4361 0.048478
2017-02-13 13:20:26.139 DEBUG eventlet.wsgi.server [-] (15823) accepted ('192.168.110.227', 53262) from (pid=15823) server /usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py:868
2017-02-13 13:20:26.141 DEBUG glance.api.middleware.version_negotiation [-] Determining version of request: GET /v2/images/34ffff73-8467-4b2e-865b-685b0da33388/file Accept: */* from (pid=15823) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:46
2017-02-13 13:20:26.141 DEBUG glance.api.middleware.version_negotiation [-] Using url versioning from (pid=15823) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:58
2017-02-13 13:20:26.142 DEBUG glance.api.middleware.version_negotiation [-] Matched version: v2 from (pid=15823) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:70
2017-02-13 13:20:26.142 DEBUG glance.api.middleware.version_negotiation [-] new path /v2/images/34ffff73-8467-4b2e-865b-685b0da33388/file from (pid=15823) process_request /opt/stack/glance/glance/api/middleware/version_negotiation.py:71
/usr/local/lib/python2.7/dist-packages/keystoneauth1/adapter.py:135: UserWarning: Using keystoneclient sessions has been deprecated. Please update your software to use keystoneauth1.
  warnings.warn('Using keystoneclient sessions has been deprecated. '
2017-02-13 13:20:26.228 DEBUG glance.api.middleware.cache [req-d0f6f2ab-11e3-4f38-b954-686ec4448764 f1e126d0378c47da9f74f8bfc19b7a33 00b4a870ac264e8d8778766dd7c13aee] Cache hit for image '34ffff73-8467-4b2e-865b-685b0da33388' from (pid=15823) process_request /opt/stack/glance/glance/api/middleware/cache.py:166
2017-02-13 13:20:26.229 INFO eventlet.wsgi.server [req-d0f6f2ab-11e3-4f38-b954-686ec4448764 f1e126d0378c47da9f74f8bfc19b7a33 00b4a870ac264e8d8778766dd7c13aee] Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/eventlet/wsgi.py", line 481, in handle_one_response
    result = self.application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/oslo_middleware/base.py", line 126, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/oslo_middleware/base.py", line 126, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/oslo_middleware/base.py", line 126, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 804, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/osprofiler/web.py", line 108, in __call__
    return request.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/keystonemiddleware/auth_token/__init__.py", line 335, in __call__
    response = req.get_response(self._app)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 804, in __call__
    response = req.get_response(self.application)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1299, in send
    application, catch_exc_info=False)
  File "/usr/local/lib/python2.7/dist-packages/webob/request.py", line 1263, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 130, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/local/lib/python2.7/dist-packages/webob/dec.py", line 195, in call_func
    return self.func(req, *args, **kwargs)
  File "/opt/stack/glance/glance/common/wsgi.py", line 801, in __call__
    response = self.process_request(req)
  File "/opt/stack/glance/glance/api/middleware/cache.py", line 171, in process_request
    return method(request, image_id, image_iterator, image_metadata)
  File "/opt/stack/glance/glance/api/middleware/cache.py", line 226, in _process_v2_request
    self._verify_metadata(image_meta)
  File "/opt/stack/glance/glance/api/middleware/cache.py", line 75, in _verify_metadata
    image_meta['size'] = self.cache.get_image_size(image_meta['id'])
TypeError: 'ImageTarget' object does not support item assignment

2017-02-13 13:20:26.230 INFO eventlet.wsgi.server [req-d0f6f2ab-11e3-4f38-b954-686ec4448764 f1e126d0378c47da9f74f8bfc19b7a33 00b4a870ac264e8d8778766dd7c13aee] 192.168.110.227 - - [13/Feb/2017 13:20:26] "GET /v2/images/34ffff73-8467-4b2e-865b-685b0da33388/file HTTP/1.1" 500 139 0.089137

$ glance image-show 34ffff73-8467-4b2e-865b-685b0da33388
+----------------------+----------------------------------------------------------------------------------+
| Property | Value |
+----------------------+----------------------------------------------------------------------------------+
| base_image_ref | |
| bdm_v2 | True |
| block_device_mapping | [{"guest_format": null, "boot_index": 0, "delete_on_termination": false, |
| | "no_device": null, "snapshot_id": "cd8a5b21-50b6-4253-a42f-044856ef0a57", |
| | "device_name": "/dev/vda", "disk_bus": "virtio", "image_id": null, |
| | "source_type": "snapshot", "tag": null, "device_type": "disk", "volume_id": |
| | null, "destination_type": "volume", "volume_size": 1}] |
| checksum | d41d8cd98f00b204e9800998ecf8427e |
| container_format | bare |
| created_at | 2017-02-13T16:49:50Z |
| disk_format | qcow2 |
| id | 34ffff73-8467-4b2e-865b-685b0da33388 |
| kernel_id | 64ee5ed6-a0b1-4862-abb2-0afbda59cbc8 |
| locations | [{"url": "rbd://6c1d8b91-f42a-41ec-b780-4c49defce5e6/images/34ffff73-8467-4b2e- |
| | 865b-685b0da33388/snap", "metadata": {}}] |
| min_disk | 0 |
| min_ram | 0 |
| name | vm1-snap |
| owner | 00b4a870ac264e8d8778766dd7c13aee |
| protected | False |
| ramdisk_id | 7c7da0b4-0a2c-4888-8ad8-59e5254509f6 |
| root_device_name | /dev/vda |
| size | 0 |
| status | active |
| tags | [] |
| updated_at | 2017-02-13T16:49:51Z |
| virtual_size | None |
| visibility | private |
+----------------------+----------------------------------------------------------------------------------+

Revision history for this message
Eric Harney (eharney) wrote :

This was on master @ 33f943b2f.

Revision history for this message
Cyril Roelandt (cyril-roelandt) wrote :

Looking at the ImageTarget class, the error is easily understandable: there is no __setitem__ method defined there. I wonder whether this is on purpose? If not, adding one should be easy :)

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.