Return-Path: Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: (qmail 51320 invoked from network); 3 Dec 2010 11:40:54 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 3 Dec 2010 11:40:54 -0000 Received: (qmail 89159 invoked by uid 500); 3 Dec 2010 11:40:54 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 89082 invoked by uid 500); 3 Dec 2010 11:40:53 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 89074 invoked by uid 99); 3 Dec 2010 11:40:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Dec 2010 11:40:53 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=10.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Dec 2010 11:40:46 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB3BeOsX010972 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 3 Dec 2010 06:40:25 -0500 Received: from redhat.com (dhcp-2-138.brq.redhat.com [10.34.2.138]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB3BeL5Y014841 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 3 Dec 2010 06:40:24 -0500 Date: Fri, 3 Dec 2010 12:40:21 +0100 From: Michal Fojtik To: deltacloud-dev@incubator.apache.org Subject: Re: [PATCH] Adds create_blob and delete_blob for the Microsoft Azure driver Message-ID: <20101203114021.GA3470@redhat.com> References: <1291309735-15757-1-git-send-email-marios@redhat.com> <1291309735-15757-2-git-send-email-marios@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1291309735-15757-2-git-send-email-marios@redhat.com> X-Operating-System: Linux patashnik 2.6.35.6-48.fc14.i686.PAE User-Agent: Mutt/1.5.20 (2009-06-14) X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Virus-Checked: Checked by ClamAV on apache.org On 02/12/10 19:08 +0200, marios@redhat.com wrote: Hi, I'm not going to test this with live Azure (don't have an Account ;) just 1 inline code comment: Otherwise code looks sane to me, ACK. -- Michal >From: marios > >--- > .../lib/deltacloud/drivers/azure/azure_driver.rb | 33 +++++++++++++++++++- > 1 files changed, 32 insertions(+), 1 deletions(-) > >diff --git a/server/lib/deltacloud/drivers/azure/azure_driver.rb b/server/lib/deltacloud/drivers/azure/azure_driver.rb >index c197214..9342823 100644 >--- a/server/lib/deltacloud/drivers/azure/azure_driver.rb >+++ b/server/lib/deltacloud/drivers/azure/azure_driver.rb >@@ -17,8 +17,9 @@ > # under the License. > > #Windows Azure (WAZ) gem at http://github.com/johnnyhalife/waz-storage >-require 'waz-blobs' > require 'deltacloud/base_driver' >+require 'waz-blobs' >+ > module Deltacloud > module Drivers > module Azure >@@ -46,6 +47,9 @@ class AzureDriver < Deltacloud::BaseDriver > # Create bucket > #-- > def create_bucket(credentials, name, opts) >+ #for whatever reason, bucket names MUST be lowercase... >+ #http://msdn.microsoft.com/en-us/library/dd135715.aspx >+ name = name.downcase You can use name.downcase! here. > bucket = nil > azure_connect(credentials) > safely do >@@ -87,6 +91,33 @@ class AzureDriver < Deltacloud::BaseDriver > yield WAZ::Blobs::Container.find(bucket_id)[blob_id].value > end > >+#-- >+# Create Blob >+#-- >+ def create_blob(credentials, bucket_id, blob_id, blob_data, opts=nil) >+ azure_connect(credentials) >+ #get a handle to the bucket in order to put there >+ the_bucket = WAZ::Blobs::Container.find(bucket_id) >+ the_bucket.store(blob_id, blob_data[:tempfile], blob_data[:type]) >+ Blob.new( { :id => blob_id, >+ :bucket => bucket_id, >+ :content_lengh => blob_data[:tempfile].length, >+ :content_type => blob_data[:type], >+ :last_modified => '' >+ } ) >+ end >+ >+#-- >+# Delete Blob >+#-- >+ def delete_blob(credentials, bucket_id, blob_id, opts=nil) >+ azure_connect(credentials) >+ #get a handle to bucket and blob, and destroy! >+ the_bucket = WAZ::Blobs::Container.find(bucket_id) >+ the_blob = the_bucket[blob_id] >+ the_blob.destroy! >+ end >+ > private > > def azure_connect(credentials) >-- >1.7.2.3 > -- -------------------------------------------------------- Michal Fojtik, mfojtik@redhat.com Deltacloud API: http://deltacloud.org --------------------------------------------------------