incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <>
Subject Re: Blobstore functions - PUT and DELETE /api/containers
Date Mon, 23 Aug 2010 07:47:37 GMT
Hi Marios,

On 18/08/10 11:12 +0100, wrote:
>This patch implements the PUT /api/containers and DELETE /api/containers operations (create
and delete an empty container) for S3 and Cloudfiles. There is a feature/bug which has been
causing me problems: after the DELETE operation, for some reason Sinatra then tries to do
a GET on the deleted resource... not sure what I'm doing wrong so Michal/David anyone else
have you come across this before?

I tried your patch and it's working perfectly. After I delete container it
redirects me to a list of containers, which as I suppose is the correct way
how to do it.

Anyway I found a few issues:

1. When you want to create a container, with some common name (like 'Test')
    it throws 'Internal Server Error'. Please catch these exceptions using
    safely..end block.
    I know that I'm sharing my bucket names with other users, but we need to
    throw something 'useful' for a client.
    Also please consider using this block for all 'backend-specific' operations.
    For this case returning '409 - Conflict' should be fine. Something like:

     safely do
       if container_location
         container = RightAws::S3::Bucket.create(s3_client, name, true, nil, :location =>
         container = RightAws::S3::Bucket.create(s3_client, name, true)
       rescue RightAws::AwsError => e
         raise e unless e.message =~ /BucketAlreadyExists/
         raise, e.class.to_s, e.message, e.backtrace)

2. When I tried your patch for the first time I got 'no-method-error' when
    I accessed some blob item inside container. This error was caused by
    missing 'content_type' method in RightAws::S3::Key class.
    Workaround is to add 'require "mime/types"' on top of EC2 driver and  then
    instead of using:

481:   :content_type => s3_object.content_type,

481:   :content_type => "#{MIME::Types.type_for(}",

3. Create operation is always POST and not PUT. Should be great if we could
    use 'PUT' method for 'putting' new blobs inside container (but I'm not
    sure if this HTTP method like uploading ;)

>I have added a feature for the Amazon EC2/S3 driver so when you create a container you
can optionally specify its location. Valid values are: 'EU'|'us-west1'|'ap-southeast-1E' (europe,
US west coast, asia-pacific respectively). If you do not specify a location then the default
is used which is 'us-east' (though weirldy if you specify 'us-east' as a location things blow
up @ Amazon's end).

Nice! I tried it and it works as expected.

  -- Michal

Michal Fojtik,, +420 532 294 4307
Ruby / Ruby On Rails Developer
Deltacloud API:

View raw message