Image download with multi tenant true fails

Bug #1511025 reported by Niall Bunting
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Invalid
Undecided
Unassigned
glance_store
Fix Released
Medium
Kairat Kushaev

Bug Description

Overview:
Trying to download an image while using multi tenant fails.

How to reproduce:
In the glance-api.conf set swift_store_multi_tenant = True.

Then upload an image
glance --os-image-api-version 1 image-create --name test --copy-from http://127.0.0.1:5321 --container-format bare --disk-format raw

Download image
glance image-download 965afb71-61f7-4834-b62b-6fc6e3a1d381 --file /tmp/file

Output:
'NoneType' object has no attribute 'close'
The server: http://paste.openstack.org/show/477571/

Expected:
Image to be downloaded.

Changed in glance:
assignee: nobody → dshakhray (dshakhray)
Revision history for this message
Darja Shakhray (dshakhray) wrote :

Bug occurs when you create image with multi_tenant.

When request "glance image-create --container-format bare --disk-format raw --file FILE --progress", swift creates container, glance uploads images http://paste.openstack.org/show/477803/,
swift returns an error http://paste.openstack.org/show/477801/,
glance it does not catch and raises 500 http://paste.openstack.org/show/477804/.

I think that the error in the Swift.

I reported another bug on 500 error in glance. https://bugs.launchpad.net/glance/+bug/1512416

Changed in glance:
assignee: Darja Shakhray (dshakhray) → nobody
Revision history for this message
Niall Bunting (niall-bunting) wrote :

@Darja is that not a duplication of this bug?

affects: glance → swift
Revision history for this message
Darja Shakhray (dshakhray) wrote :

@Niall, there are different problems. Glance does not catches exception from glance_store.

Mike Fedosin (mfedosin)
Changed in swift:
status: New → Confirmed
Revision history for this message
clayg (clay-gerrard) wrote :

This line doesn't make sense to me:

Container POST failed: http://172.18.66.81:5000/v3/glance_b6ee3b14-8b3a-4c98-a5d8-a211dd19f94e

That doesn't look anything like a swift container url? I mean *maybe* a service token *account* url - but I think to access those accounts you need to send the service token for glance & a token for tenant b6ee3b14-8b3a-4c98-a5d8-a211dd19f94e.

Either way - it should be /v1 - swift doesn't have a /v3 api.

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

Ok, myself and Niall looked at this.

Short story: we were able to make it work by updating our config, but it took a while to figure out.

 $ glance image-create --disk-format raw --container-format bare --name x1 --file /etc/fstab
 +------------------+--------------------------------------+
 | Property | Value |
 +------------------+--------------------------------------+
 | checksum | 9cb02fe7fcac26f8a25d6db3109063ae |
 | container_format | bare |
 | created_at | 2015-11-13T15:04:31Z |
 | disk_format | raw |
 | id | 2cb520a7-8bb0-411d-b40f-2a0c7b418314 |
 | min_disk | 0 |
 | min_ram | 0 |
 | name | x1 |
 | owner | 88cffb9c8aee457788066c97b359585b |
 | protected | False |
 | size | 145 |
 | status | active |
 | tags | [] |
 | updated_at | 2015-11-13T15:04:31Z |
 | virtual_size | None |
 | visibility | private |
 +------------------+--------------------------------------+

 $ swift list glance_2cb520a7-8bb0-411d-b40f-2a0c7b418314
 2cb520a7-8bb0-411d-b40f-2a0c7b418314
 2cb520a7-8bb0-411d-b40f-2a0c7b418314-00001

Basically -- like a lot of folks -- we were using a devstack install and trying to switch it from Single tenant mode to Multi tenant mode.

We switched on multi-tenant:

swift_store_multi_tenant = True

But saw failures.

The trick was to comment out the following lines:

# default_swift_reference = ref1
#swift_store_config_file = /etc/glance/glance-swift-store.conf

These were confusing some of the spagetti^H^H^H logic around the correct swift_url. (As Clay found, the keystone url was being used, not the swift one.)

I'll add some feedback to this documentation change: https://review.openstack.org/#/c/242583/

We could also look at not starting the server if the config is not self consistent.

Revision history for this message
Stuart McLaren (stuart-mclaren) wrote :

I marked the bug invalid -- but we should try to follow up to make the docs clearer/detect config mismatches on start up.

Changed in swift:
status: Confirmed → Invalid
Revision history for this message
Kairat Kushaev (kkushaev) wrote :

I think we can fix that in glance_store. Just need to get rid of dependency on swift_url when working with the image.
We have swift service enpoint in service catalog and that catalog is required for multi-tenant store AFAIK.

Changed in glance-store:
assignee: nobody → Kairat Kushaev (kkushaev)
Changed in glance-store:
status: New → In Progress
Changed in glance-store:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance_store (master)

Reviewed: https://review.openstack.org/252370
Committed: https://git.openstack.org/cgit/openstack/glance_store/commit/?id=68762058cc5d063f3a846b495af03150e648224f
Submitter: Jenkins
Branch: master

commit 68762058cc5d063f3a846b495af03150e648224f
Author: kairat_kushaev <email address hidden>
Date: Tue Jan 19 14:29:25 2016 +0300

    Change approach to request storage url for multi-tenant store

    Multi-tenant store doesn't need to fetch swift storage_url from
    store location because it can fetch it from service catalog
    in user context.
    That allows to avoid subtle errors when uploading/downloading
    with scheme = 'swift+config'. In the current implementation
    multi-tenant store uses location.swift_url to request swift
    endpoint but swift_url is keystone endpoint in that case.
    The change provides possibility to get rid of this dependency
    and consider context as primary source for swift store url.

    Closes-Bug: #1511025

    Change-Id: I7bc23dfc11900b55f45fe98144d14f883c381c9f

Changed in glance-store:
status: In Progress → Fix Released
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/glance_store 0.12.0

This issue was fixed in the openstack/glance_store 0.12.0 release.

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.