Swift client can't reauthenticate even if login and password are provided

Bug #1517447 reported by Mike Fedosin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
glance_store
Opinion
Undecided
Tim Burke
python-swiftclient
Invalid
Undecided
Mike Fedosin

Bug Description

Swift client supports retries, but it seems it doesn't work when token is expired.

The normal expected workflow is: If we get 401 code and users credentials are provided, then swiftclient sets flag 'retried_auth', tries to re-authenticate and sends the request again with new user token https://github.com/openstack/python-swiftclient/blob/master/swiftclient/client.py#L1441-L1448.

But it seems like there is a bug in the code, because we provide a reset function https://github.com/openstack/python-swiftclient/blob/master/swiftclient/client.py#L1530-L1533, that raises an exception, and call it before the client resends the request https://github.com/openstack/python-swiftclient/blob/master/swiftclient/client.py#L1460

Steps to reproduce on devstack:
0. Deploy devstack with Swift backend.
1. Set 'expiration' option in /etc/keystone/keystone.conf to '40' seconds and restart apache2 server.
2. Try to upload a big file (>5,5G) to glance with command 'glance image-create --name cool_name --disk-format qcow2 --container-format bare --file <big_file>'

Expected result: image is successfully created.

Actual result:

http://paste.openstack.org/show/479241/

Mike Fedosin (mfedosin)
Changed in python-swiftclient:
assignee: nobody → Mike Fedosin (mfedosin)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-swiftclient (master)

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

Changed in python-swiftclient:
status: New → In Progress
Revision history for this message
Tim Burke (1-tim-z) wrote :
Revision history for this message
Tim Burke (1-tim-z) wrote :

I take that back; I thought swiftclient was handling the chunking. Seems like a glance_store bug, to me; swiftclient has no way to know how much of the body may have been read by the requests library, so we need some sort of reset function. This is (currently) handled using seek/tell methods, such as appear on normal file objects. Without the ability to reset the data stream, there isn't much else we *can* do but raise an exception.

I submitted a patch for glance_store to implement seek/tell methods on the ChunkReader it's using for uploads: https://review.openstack.org/#/c/247310/

Changed in glance-store:
assignee: nobody → Tim Burke (1-tim-z)
status: New → In Progress
Changed in python-swiftclient:
status: In Progress → Invalid
Revision history for this message
Nikhil Komawar (nikhil-komawar) wrote :

This bug is a duplicate of the blueprint proposed here https://blueprints.launchpad.net/glance/+spec/buffered-reader-for-swift-driver

Changed in glance-store:
status: In Progress → Opinion
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on glance_store (master)

Change abandoned by Tim Burke (<email address hidden>) on branch: master
Review: https://review.openstack.org/247310
Reason: Better resolved by https://review.openstack.org/#/c/120866/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-swiftclient (master)

Change abandoned by Mike Fedosin (<email address hidden>) on branch: master
Review: https://review.openstack.org/246943

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.