Return-Path: Delivered-To: apmail-incubator-deltacloud-commits-archive@minotaur.apache.org Received: (qmail 93868 invoked from network); 8 Apr 2011 12:14:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Apr 2011 12:14:03 -0000 Received: (qmail 82942 invoked by uid 500); 8 Apr 2011 12:14:03 -0000 Delivered-To: apmail-incubator-deltacloud-commits-archive@incubator.apache.org Received: (qmail 82920 invoked by uid 500); 8 Apr 2011 12:14:03 -0000 Mailing-List: contact deltacloud-commits-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-commits@incubator.apache.org Received: (qmail 82913 invoked by uid 99); 8 Apr 2011 12:14:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Apr 2011 12:14:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Apr 2011 12:14:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id B8E2A2388980; Fri, 8 Apr 2011 12:13:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1090218 - in /incubator/deltacloud/trunk/server/lib/deltacloud/drivers: ec2/ec2_driver.rb eucalyptus/eucalyptus_driver.rb Date: Fri, 08 Apr 2011 12:13:41 -0000 To: deltacloud-commits@incubator.apache.org From: mfojtik@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110408121341.B8E2A2388980@eris.apache.org> Author: mfojtik Date: Fri Apr 8 12:13:41 2011 New Revision: 1090218 URL: http://svn.apache.org/viewvc?rev=1090218&view=rev Log: dynamic driver switching for eucalyptus Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb incubator/deltacloud/trunk/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=1090218&r1=1090217&r2=1090218&view=diff ============================================================================== --- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original) +++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Fri Apr 8 12:13:41 2011 @@ -539,6 +539,8 @@ module Deltacloud end def endpoint_for_service(service) + ENV['EC2_URL']='' # unset endpoints that may have been set by eucalyptus; otherwise it can conflict with the EC2/S3 endpoints in aws gem. + ENV['S3_URL']='' endpoint = (Thread.current[:provider] || ENV['API_PROVIDER'] || DEFAULT_REGION) # return the endpoint if it does not map to a default endpoint, allowing # the endpoint to be a full hostname instead of a region. Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb?rev=1090218&r1=1090217&r2=1090218&view=diff ============================================================================== --- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb (original) +++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb Fri Apr 8 12:13:41 2011 @@ -141,13 +141,24 @@ module Deltacloud def eucalyptus_endpoint endpoint = (Thread.current[:provider] || ENV['API_PROVIDER']) - #parse endpoint string into server, port, service, and protocol - if endpoint - {:server => URI.parse(endpoint).host, - :port => URI.parse(endpoint).port, - :service => URI.parse(endpoint).path, - :protocol => URI.parse(endpoint).scheme, - :connection_mode => :per_thread} + if endpoint && (endpoint.include?('ec2') || endpoint.include?('s3')) # example endpoint: 'ec2=192.168.1.1; s3=192.168.1.2' + default_port=8773 + endpoint.split(';').each do |svc_addr| + addr = svc_addr.sub('ec2=','').sub('s3=','').strip + if addr.include?(':') + host = addr.split(':')[0] + port = addr.split(':')[1] + else + host = addr + port = default_port + end + if svc_addr.include?('ec2') + ENV['EC2_URL'] = "http://#{host}:#{port}/services/Eucalyptus" + elsif svc_addr.include?('s3') + ENV['S3_URL'] = "http://#{host}:#{port}/services/Walrus" + end + end + {} else #EC2_URL/S3_URL env variable will be used by AWS {:connection_mode => :per_thread}