Volume creation from image fails if allowed_direct_url_schemes = file

Bug #1437477 reported by Tomoki Sekiyama
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Tomoki Sekiyama
Kilo
Fix Released
Undecided
Unassigned

Bug Description

Volume creation fails under the conditions below:

  - cinder-volume and glance-api are on the same host
  - In cinder.conf, allowed_direct_url_schemes = file
  - In cinder.conf, glance_api_version = 2
  - In glance-api.conf, show_image_direct_url = True and/or show_multiple_locations = True

 $ export OS_IMAGE_API_VERSION=2
 $ glance image-show 6de702f1-f3b0-47f4-8616-3011a9025510
 +------------------+------------------------------------------+
 | Property | Value |
 +------------------+------------------------------------------+
 | checksum | 4eada48c2843d2a262c814ddc92ecf2c |
 | container_format | ami |
 | created_at | 2015-03-10T21:53:34Z |
 | direct_url | swift+http://service%3Aglance-swift:xxxx |
 | | xx@10.xx.xx.xx:5000/v2.0/glance/6de |
 | | 702f1-f3b0-47f4-8616-3011a9025510 |
 | disk_format | ami |
 | id | 6de702f1-f3b0-47f4-8616-3011a9025510 |
 | kernel_id | 3e9e090e-7fcd-414e-843d-833c994443aa |
 | locations | [{"url": "swift+http://service%3Aglance- |
 | | swift:xxxxx@10.xx.xx.xx:5000/v2.0/ |
 | | glance/6de702f1-f3b0-47f4-8616-3011a9025 |
 | | 510", "metadata": {}}] |
 | min_disk | 0 |
 | min_ram | 0 |
 | name | cirros-0.3.2-x86_64-uec |
 | owner | c556336ce5a34c229930a15ce6496a99 |
 | protected | False |
 | ramdisk_id | fa7aee59-e0aa-48af-b63b-8aa7d68c1e0d |
 | size | 25165824 |
 | status | active |
 | tags | [] |
 | updated_at | 2015-03-10T21:53:35Z |
 | virtual_size | None |
 | visibility | public |
 +------------------+------------------------------------------+

 $ cinder create --image-id 6de702f1-f3b0-47f4-8616-3011a9025510 1

  2015-03-27 15:45:58.135 ERROR oslo_messaging.rpc.dispatcher [req-64442a0c-c7a0-4f3b-915f-51f8a9e034ec 6a8b95f3b2094287a2970e8572a94010 ecc6f4aea07745239127085d117e1842] Exception during message handling: Failed to copy image to volume: unhashable type: 'list'
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher Traceback (most recent call last):
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher executor_callback))
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher executor_callback)
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 130, in _do_dispatch
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher result = func(ctxt, **new_args)
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 105, in wrapper
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher return f(*args, **kwargs)
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 449, in create_volume
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher _run_flow()
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/manager.py", line 437, in _run_flow
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher flow_engine.run()
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 96, in run
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher for _state in self.run_iter():
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/taskflow/engines/action_engine/engine.py", line 153, in run_iter
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher failure.Failure.reraise_if_any(failures.values())
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/taskflow/types/failure.py", line 244, in reraise_if_any
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher failures[0].reraise()
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/taskflow/types/failure.py", line 251, in reraise
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher six.reraise(*self._exc_info)
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/usr/lib/python2.7/site-packages/taskflow/engines/action_engine/executor.py", line 67, in _execute_task
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher result = task.execute(**arguments)
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/flows/manager/create_volume.py", line 657, in execute
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher **volume_spec)
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/flows/manager/create_volume.py", line 609, in _create_from_image
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher image_id, image_location, image_service)
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher File "/opt/stack/cinder/cinder/volume/flows/manager/create_volume.py", line 520, in _copy_image_to_volume
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher raise exception.ImageCopyFailure(reason=ex)
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher ImageCopyFailure: Failed to copy image to volume: unhashable type: 'list'
  2015-03-27 15:45:58.135 TRACE oslo_messaging.rpc.dispatcher

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/168477

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

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

commit 181be53a2b0a54f7b4cd33dacbaa560e124e9421
Author: Tomoki Sekiyama <email address hidden>
Date: Fri Mar 27 15:35:05 2015 -0400

    Fix volume creation from image with allowed_direct_url_schemes

    When CONF.allowed_direct_url_schemes is set to ['file'] and
    Glance image has direct_url or locations metadata with 'file:///'
    scheme, cinder tries to directly read the image data from the
    local file. However, currently the code is broken because return
    value from get_location() has been changed to a tuple.
    This fixes the code so that it can handle the metadata correctly.

    Change-Id: I39a12a31fbfbd3a9824c67391096f74406d8a749
    Closes-Bug: #1437477

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → liberty-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/221743

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

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/221747

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (stable/juno)

Change abandoned by Dirk Mueller (<email address hidden>) on branch: stable/juno
Review: https://review.openstack.org/221747
Reason: Alright then

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

Reviewed: https://review.openstack.org/221743
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=5d86fcb763485cb6d38434f7ad5632c5e4724bcd
Submitter: Jenkins
Branch: stable/kilo

commit 5d86fcb763485cb6d38434f7ad5632c5e4724bcd
Author: Tomoki Sekiyama <email address hidden>
Date: Fri Mar 27 15:35:05 2015 -0400

    Fix volume creation from image with allowed_direct_url_schemes

    When CONF.allowed_direct_url_schemes is set to ['file'] and
    Glance image has direct_url or locations metadata with 'file:///'
    scheme, cinder tries to directly read the image data from the
    local file. However, currently the code is broken because return
    value from get_location() has been changed to a tuple.
    This fixes the code so that it can handle the metadata correctly.

    Change-Id: I39a12a31fbfbd3a9824c67391096f74406d8a749
    Closes-Bug: #1437477
    (cherry picked from commit 181be53a2b0a54f7b4cd33dacbaa560e124e9421)

tags: added: in-stable-kilo
Thierry Carrez (ttx)
Changed in cinder:
milestone: liberty-1 → 7.0.0
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.