OpenStack Object Storage (Swift)

swift3 return InvalidBucketName instead of NoSuchBucket

Reported by Chmouel Boudjnah on 2012-03-03
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Undecided
Chmouel Boudjnah

Bug Description

While testing euca-upload-bundle it seems that swift3 return InvalidBucketName for a 404 instead of a NoSuchBucket :

+ euca-upload-bundle -b testbucket -m /tmp/bundle.img.manifest.xml
Checking bucket: testbucket
S3ResponseError: 400 Bad Request
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>InvalidBucketName</Code>
  <Message>The specified bucket is not valid</Message>
</Error>

Swift Log

swift 212.64.151.104 212.64.151.104 03/Mar/2012/22/48/02 GET /v1/AUTH_26b42763d83b4bb690dbda8ff131358d/testbucket%3Fformat%3Djson%26limit%3D1 HTTP/1.0 404 - Boto/2.0%20%28linux2%29 91b999b9277a4bb88c5fee2fae4b0f55 - - - txd65aa3dcfb1f4c9f9ce423851ad5f1c3 - 0.0131 -

Changed in swift:
assignee: nobody → Chmouel Boudjnah (chmouel)
Chmouel Boudjnah (chmouel) wrote :

FYI: I am using this code :

        except S3ResponseError, s3error:
            s3error_string = '%s' % s3error
            if s3error_string.find('404') >= 0:
                try:
                    print 'Creating bucket:', self.bucket
                    bucket_instance = s3conn.create_bucket(self.bucket,
                                                           policy=acl,
                                                           location=location)
                except S3CreateError:
                    msg = 'Unable to create bucket %s' % self.bucket
                    self.display_error_and_exit(msg)
            elif s3error_string.find('403') >= 0:
                msg = 'You do not have permission to access bucket:', self.bucket
                self.display_error_and_exit(msg)

from euca2ools/commands/euca/uploadbundle.py , I don't have an AMAZON s3 account so can't test directly with whatever they implemented.

summary: - swift3: InvalidBucketName should come back with 404 not 400
+ swift3 return InvalidBucketName instead of NoSuchBucket
description: updated
Chmouel Boudjnah (chmouel) wrote :

Preliminary patch that may need more investigation:

http://pastie.org/private/f0wj13be2qvstgwqdwqvza

Changed in swift:
status: New → In Progress

Reviewed: https://review.openstack.org/4913
Committed: http://github.com/openstack/swift/commit/ac7634479a65cb303cc1e219ca8b8edc47986edf
Submitter: Jenkins
Branch: master

commit ac7634479a65cb303cc1e219ca8b8edc47986edf
Author: Chmouel Boudjnah <email address hidden>
Date: Mon Mar 5 13:43:00 2012 +0000

    Return NoSuchBucket/Key on 404.

    - Fixes bug 945937.

    Change-Id: If6dd53a716491a7d1a9ab4992224038ede4cb32a

Changed in swift:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-03-20
Changed in swift:
milestone: none → 1.4.8
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers