wrong messages returned when using curl in version 1.5.1

Bug #1026908 reported by Alan LQC
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Invalid
Undecided
Unassigned

Bug Description

Referring to os-objectstorage-devguide-1.0.pdf, I tried to make a curl test, however, it turned to be something wrong.

First paste my environment:
swift -V 2 -A http://192.168.1.173:5000/v2.0 -U adminTenant:admin -K openstack stat -v
===============================================================================
StorageURL: https://192.168.1.173:8080/v1/AUTH_9e7357d5ab4545b49a8ae68e068ddbd8
Auth Token: 9e579fe05f1b4c1f87e098bf71917cfa
   Account: AUTH_9e7357d5ab4545b49a8ae68e068ddbd8
Containers: 2
   Objects: 0
     Bytes: 0
Accept-Ranges: bytes
X-Timestamp: 1342127815.07385
X-Trans-Id: txcf3d0dd4b6374058ac5bb07f63646d35
===============================================================================
OK, let's start.

1. Authentication
curl -i -H "X-Auth-Key:openstack" -H "X-Auth-User:admin" http://192.168.1.173:5000/v2.0
return: 501 Not Implemented

2. Determining Storage Usage
Firstly, here shows my account usage.
curl -k -H "X-Auth-Token:9e579fe05f1b4c1f87e098bf71917cfa" https://192.168.1.173:8080/v1/AUTH_9e7357d5ab4545b49a8ae68e068ddbd8
return:
China_Telecom.png
photos
('photos' is a container, which has an object in it, and 'China_Telecom.png' is an object, too.)

However, when use the following curl, it come wrong!
curl -k -X HEAD -i -H "X-Auth-Token:9e579fe05f1b4c1f87e098bf71917cfa" https://192.168.1.173:8080/v1/AUTH_9e7357d5ab4545b49a8ae68e068ddbd8
return:
==============================================
HTTP/1.1 204 No Content
X-Account-Object-Count: 0
X-Timestamp: 1342127815.07647
X-Account-Bytes-Used: 0
X-Account-Container-Count: 2
Accept-Ranges: bytes
Content-Length: 0
X-Trans-Id: tx55a0b4fb5f3f4dea87dfad12d5d044b2
==============================================

It should be:
X-Account-Object-Count: 1
X-Account-Container-Count: 1
X-Account-Bytes-Used: not 0 and it should be the sum of the whole account bytes used!

Revision history for this message
gholt (gholt) wrote :

I'm having a little trouble following but...

1) How did you get past this? Is this a Keystone issue, doesn't seem like a Swift-specific thing (v2.0)?

2) That listing is of containers, so it shows you having two containers: China_Telecom.png and photos. Perhaps you had previously accidentally created a China_Telecom.png container?

Lastly, the stats (X-Account-Container-Count, X-Account-Object-Count, and X-Account-Bytes-Used) are all "delayed" stats, in that they will eventually reflect what is in the account, but it may take some time.

In a very controlled situation:

First, just start up proxy, account, container, and object servers:
$ sudo swift-init main start

Check the account is empty:
$ curl -i http://127.0.0.1:8080/v1/AUTH_test -Hx-auth-token:AUTH_tk8c663f1dd7364e48a5f64ccdc6954cb3
HTTP/1.1 204 No Content
X-Account-Container-Count: 0
X-Account-Object-Count: 0
X-Account-Bytes-Used: 0

Now, create a new container:
$ curl -XPUT http://127.0.0.1:8080/v1/AUTH_test/test_container -Hx-auth-token:AUTH_tk8c663f1dd7364e48a5f64ccdc6954cb3
201 Created

Check what the account's listing of containers shows (this update is *almost* always immediate, but might be delayed):
$ curl -i http://127.0.0.1:8080/v1/AUTH_test -Hx-auth-token:AUTH_tk8c663f1dd7364e48a5f64ccdc6954cb3
HTTP/1.1 200 OK
X-Account-Container-Count: 1
X-Account-Object-Count: 0
X-Account-Bytes-Used: 0

test_container

Next, create an object in that container:
$ curl -XPUT http://127.0.0.1:8080/v1/AUTH_test/test_container/test_object --data-binary test_value -Hx-auth-token:AUTH_tk8c663f1dd7364e48a5f64ccdc6954cb3
201 Created

Check what the account's listing of containers shows again (object stats to the account level are *always* delayed):
$ curl -i http://127.0.0.1:8080/v1/AUTH_test -Hx-auth-token:AUTH_tk8c663f1dd7364e48a5f64ccdc6954cb3
HTTP/1.1 200 OK
X-Account-Container-Count: 1
X-Account-Object-Count: 0
X-Account-Bytes-Used: 0

test_container

Check what the container's listing of objects shows (this is *almost* always immediate, but may be delayed):
$ curl -i http://127.0.0.1:8080/v1/AUTH_test/test_container -Hx-auth-token:AUTH_tk8c663f1dd7364e48a5f64ccdc6954cb3
HTTP/1.1 200 OK
X-Container-Object-Count: 1
X-Container-Bytes-Used: 10

test_object

Run the background updaters manually (these run on set intervals in a production system):
$ sudo swift-init object-updater once
$ sudo swift-init container-updater once

Check what the account's listing of containers shows now (the updaters sent the updated stats):
$ curl -i http://127.0.0.1:8080/v1/AUTH_test -Hx-auth-token:AUTH_tk8c663f1dd7364e48a5f64ccdc6954cb3
HTTP/1.1 200 OK
X-Account-Container-Count: 1
X-Account-Object-Count: 1
X-Account-Bytes-Used: 10

test_container

Hopefully this helps explains things a bit.

Revision history for this message
Xingchao Yu (yuxcer) wrote :

I think the first problem is not swift's problem but keystone's , this problem also affects me when I use curl http://0.0.0.0:35357 for get version, you can check the keystone log

Tom Fifield (fifieldt)
Changed in swift:
status: New → Incomplete
Changed in swift:
status: Incomplete → Invalid
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.