Bug 960944
| Summary: | G4S: DELETE on container that does not exist returns 503 instead of 404 | ||
|---|---|---|---|
| Product: | [Community] Gluster-Swift | Reporter: | pushpesh sharma <psharma> |
| Component: | container-server | Assignee: | Nobody <nobody> |
| Status: | VERIFIED --- | QA Contact: | David J. Mac Donald <david.macdonald> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 0.1 | CC: | bugs, david.macdonald |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | Type: | Bug | |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
|
Description
pushpesh sharma
2013-05-08 10:58:34 UTC
Reproduced using: glusterfs-openstack-swift-1.8.0-27.noarch (Fedora 18) Commands: [root@heka-client-10 swift]# curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 * About to connect() to 127.0.0.1 port 8080 (#0) * Trying 127.0.0.1... * connected * Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0) > GET /auth/v1.0 HTTP/1.1 > User-Agent: curl/7.27.0 > Host: 127.0.0.1:8080 > Accept: */* > X-Storage-User: test:tester > X-Storage-Pass: testing > < HTTP/1.1 200 OK < X-Storage-Url: http://127.0.0.1:8080/v1/AUTH_test < X-Auth-Token: AUTH_tk37164f9de27641c68c35ff38f3e9b450 < Content-Type: text/html; charset=UTF-8 < X-Storage-Token: AUTH_tk37164f9de27641c68c35ff38f3e9b450 < Content-Length: 0 < Date: Tue, 11 Jun 2013 02:37:01 GMT < * Connection #0 to host 127.0.0.1 left intact * Closing connection #0 [root@heka-client-10 swift]# curl -i -X DELETE -H 'X-Auth-Token: AUTH_tk37164f9de27641c68c35ff38f3e9b450' http://127.0.0.1:8080/v1/AUTH_test/somecontainer HTTP/1.1 400 Bad Request Content-Length: 59 Content-Type: text/html; charset=UTF-8 Date: Tue, 11 Jun 2013 02:38:30 GMT It seems we raise an error, and it is not being caught. Here is the traceback for a container that does not exist:
container-server ERROR __call__ error with DELETE /test/0/AUTH_test/somecontainer :
Traceback (most recent call last):
File "/root/swift/swift/container/server.py", line 519, in __call__
res = method(req)
File "/root/swift/swift/common/utils.py", line 1558, in wrapped
return func(*a, **kw)
File "/root/swift/swift/common/utils.py", line 520, in _timing_stats
resp = func(ctrl, *args, **kwargs)
File "/root/swift/swift/container/server.py", line 196, in DELETE
if not broker.empty():
File "/usr/lib/python2.7/site-packages/gluster/swift/common/DiskDir.py", line 186, in empty
return dir_empty(self.datadir)
File "/usr/lib/python2.7/site-packages/gluster/swift/common/fs_utils.py", line 175, in dir_empty
raise FileOrDirNotFoundError()
FileOrDirNotFoundError (txn: tx3aa45464206a4df59bc1b4e314afbf78)
AFAIK, I think the issue is that DiskDir:186 is supposed to return that it is only empty when there are no containers in the volume. I think this is shown by the comments on swift/common/db.py.
Fix has been submitted (new unit test added): http://review.gluster.org/5201 Verified using functional test: [root@heka-client-10 swift]# nosetests --exe test/functional/tests.py:TestContainer.testDeleteOnContainerThatDoesNotExist testDeleteOnContainerThatDoesNotExist (test.functional.tests.TestContainer) ... ok ---------------------------------------------------------------------- Ran 1 test in 0.391s OK Verified using functional test:- nosetests --exe ~/gluster-swift/test/functional/tests.py:TestContainer.testDeleteOnContainerThatDoesNotExist . ---------------------------------------------------------------------- Ran 1 test in 1.312s OK Verified using curl :- # curl -v -X DELETE -H 'X-Auth-Token: AUTH_tk47831d366b06476a876a274b7a13da0b' http://localhost:8080/v1/AUTH_test/dirDoNotExist * About to connect() to localhost port 8080 (#0) * Trying ::1... Connection refused * Trying 127.0.0.1... connected * Connected to localhost (127.0.0.1) port 8080 (#0) > DELETE /v1/AUTH_test/dirDoNotExist HTTP/1.1 > User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2 > Host: localhost:8080 > Accept: */* > X-Auth-Token: AUTH_tk47831d366b06476a876a274b7a13da0b > < HTTP/1.1 404 Not Found < Content-Length: 70 < Content-Type: text/html; charset=UTF-8 < Date: Mon, 15 Jul 2013 08:55:13 GMT < * Connection #0 to host localhost left intact * Closing connection #0 <html><h1>Not Found</h1><p>The resource could not be found.</p></html>[root@dhcp207-210 ~]# Verified on:- #rpm -qa|grep gluster gluster-swift-object-1.8.0-6.3.el6rhs.noarch vdsm-gluster-4.10.2-22.7.el6rhs.noarch gluster-swift-plugin-1.8.0-2.el6rhs.noarch glusterfs-geo-replication-3.4.0.12rhs.beta3-1.el6rhs.x86_64 glusterfs-3.4.0.12rhs.beta3-1.el6rhs.x86_64 gluster-swift-1.8.0-6.3.el6rhs.noarch glusterfs-server-3.4.0.12rhs.beta3-1.el6rhs.x86_64 gluster-swift-proxy-1.8.0-6.3.el6rhs.noarch gluster-swift-account-1.8.0-6.3.el6rhs.noarch glusterfs-rdma-3.4.0.12rhs.beta3-1.el6rhs.x86_64 glusterfs-fuse-3.4.0.12rhs.beta3-1.el6rhs.x86_64 gluster-swift-container-1.8.0-6.3.el6rhs.noarch |