incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
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 GMT
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}



Mime
View raw message