[ocata] Logout on duplicated swift container name

Bug #1762347 reported by Crazik
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Won't Fix
Undecided
Unassigned

Bug Description

"Create new container" form is validating name of the new container by checking access on Swift backend with each character entered.

Lets create "new10" containter (when container with name "new" already exists in different project)

Swift backend gets:

GET /swift/v1/AUTH_xxxxx/n/ HTTP/1.1" 400 0 - python-swiftclient-3.3.0
GET /swift/v1/AUTH_xxxxx/ne/ HTTP/1.1" 400 0 - python-swiftclient-3.3.0
GET /swift/v1/AUTH_xxxxx/new/ HTTP/1.1" 401 0 - python-swiftclient-3.3.0

Horizon gets 401 on this check, and does user logout.

It shouldn't have a place...

ENV:
Ocata
openstack-dashboard 3:11.0.4-0ubuntu1~cloud1
python-swiftclient 1:3.3.0-0ubuntu1~cloud0

Tags: swift horizon
Revision history for this message
Ivan Kolodyazhny (e0ne) wrote :

Crazik, thanks for the bug report. If Swift returns 401 error, it's OK for Horizon to force user re-login

Changed in horizon:
status: New → Incomplete
assignee: nobody → Crazik (crazik)
Revision history for this message
Crazik (crazik) wrote :

After migrating to Queens with Ceph Luminous issue is solved.

Revision history for this message
Jared Baker (shubjero) wrote :

Im hitting this bug with Queens and Ceph Luminous.

Revision history for this message
Joab de Araújo Silva (joab.silva) wrote :

It's happening the same in Rocky

Revision history for this message
Joab de Araújo Silva (joab.silva) wrote :

Hi guys!

I solved this problem in my environment, editing the script connectionpool.py, that found in "/openstack/venvs/horizon-18.1.8.dev8/lib/python2.7/site-packages/urllib3/".

I observed on Horizon logs, that each charactere type in "Container Name" field, the Horizon did one GET query and when the query found container/bucket with same name, the query return 403 and so Horizon quit os session. For example, I have one container calling "tes" in project "x" and when I was try make one container in other project, with name "test", so typed "t","e","s", I leave of session. See the log:

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

So, I edited the script, before the follow function:

# AppEngine doesn't have a version attr.
        http_version = getattr(conn, '_http_vsn_str', 'HTTP/?')
        log.debug("%s://%s:%s \"%s %s %s\" %s %s", self.scheme, self.host, self.port,
                  method, url, http_version, httplib_response.status,
                  httplib_response.length)

I added the follow condition:

if httplib_response.status == 403 and self.port == 8080:
    httplib_response.status = 204

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

After this change, I not leave of session and "Container Name" field turns red, the same way when type a name of existing container in same project.

I hope I've helped

Revision history for this message
Akihiro Motoki (amotoki) wrote :

As of Victoria (Feb 2021), swift returns 204 for an existing container.
This means some fix has been done in the swift side.

2021-02-28 09:20:37.237383 DEBUG swiftclient REQ: curl -i http://192.168.50.24:8080/v1/AUTH_af0ef1a85f544dc9b2a46404fe1943ab/new-a/ -X GET -H "X-Auth-Token: gAAAAABgO13m5ujS..."
2021-02-28 09:20:37.237540 DEBUG swiftclient RESP STATUS: 204 No Content

I did not change stable branches, but if you still hit this issue you first need to consider backporting a swift fix rather than a workaround in horizon.

Consider this situation, I mark it as Won't Fix.

Changed in horizon:
status: Incomplete → Won't Fix
assignee: Crazik (crazik) → nobody
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.