You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by sa...@eucalyptus.com on 2011/04/07 08:57:43 UTC
dynamic driver switching for eucalyptus
This patch enables dynamic driver swiching to Eucalyptus.
The endpoints in the provider should be in the form 'ec2={ipaddress_Eucalyptus_compute};s3={ipaddress_Eucalyptus_storage}'
For instance, if endpoints for compute and Walrus are 'http://192.168.1.1:8773/services/Eucalyptus' and 'http://192.168.1.2:8773/services/Walrus',
the X-Deltacloud-Provider should be 'ec2=192.168.1.1;s3=192.168.1.2'.
Re: dynamic driver switching for eucalyptus
Posted by Michal Fojtik <mf...@redhat.com>.
On Apr 7, 2011, at 8:57 AM, sang-min.park@eucalyptus.com wrote:
Pushed to SVN. Thanks!
>
> This patch enables dynamic driver swiching to Eucalyptus.
> The endpoints in the provider should be in the form 'ec2={ipaddress_Eucalyptus_compute};s3={ipaddress_Eucalyptus_storage}'
> For instance, if endpoints for compute and Walrus are 'http://192.168.1.1:8773/services/Eucalyptus' and 'http://192.168.1.2:8773/services/Walrus',
> the X-Deltacloud-Provider should be 'ec2=192.168.1.1;s3=192.168.1.2'.
>
>
------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
Re: dynamic driver switching for eucalyptus
Posted by Sang-Min Park <sa...@eucalyptus.com>.
Yes, the service path will not be changed in the foreseeable future. I've
confirmed this internally.
Sang-min
On Fri, Apr 8, 2011 at 2:53 PM, David Lutterkort <lu...@redhat.com> wrote:
> On Wed, 2011-04-06 at 23:57 -0700, sang-min.park@eucalyptus.com wrote:
> > This patch enables dynamic driver swiching to Eucalyptus.
> > The endpoints in the provider should be in the form
> 'ec2={ipaddress_Eucalyptus_compute};s3={ipaddress_Eucalyptus_storage}'
> > For instance, if endpoints for compute and Walrus are '
> http://192.168.1.1:8773/services/Eucalyptus' and '
> http://192.168.1.2:8773/services/Walrus',
> > the X-Deltacloud-Provider should be 'ec2=192.168.1.1;s3=192.168.1.2'.
>
> Are we sure that the format for the Eucalyptus and Walrus URL's will
> always be http://$ip[:$port]/services/Eucalyptus ?
>
> It's safer to pass the full URL for these as the provider.
>
> David
>
>
>
Re: dynamic driver switching for eucalyptus
Posted by David Lutterkort <lu...@redhat.com>.
On Wed, 2011-04-06 at 23:57 -0700, sang-min.park@eucalyptus.com wrote:
> This patch enables dynamic driver swiching to Eucalyptus.
> The endpoints in the provider should be in the form 'ec2={ipaddress_Eucalyptus_compute};s3={ipaddress_Eucalyptus_storage}'
> For instance, if endpoints for compute and Walrus are 'http://192.168.1.1:8773/services/Eucalyptus' and 'http://192.168.1.2:8773/services/Walrus',
> the X-Deltacloud-Provider should be 'ec2=192.168.1.1;s3=192.168.1.2'.
Are we sure that the format for the Eucalyptus and Walrus URL's will
always be http://$ip[:$port]/services/Eucalyptus ?
It's safer to pass the full URL for these as the provider.
David
Re: [PATCH] dynamic driver switching for eucalyptus
Posted by Michal Fojtik <mf...@redhat.com>.
On Apr 7, 2011, at 8:57 AM, sang-min.park@eucalyptus.com wrote:
ACK.
-- Michal
> From: Sang-Min Park <sp...@eucalyptus.com>
>
> ---
> server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 2 +
> .../drivers/eucalyptus/eucalyptus_driver.rb | 25 ++++++++++++++-----
> 2 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> index 302aac2..2a2d092 100644
> --- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> +++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
> @@ -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.
> diff --git a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
> index 59db7e6..413f206 100644
> --- a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
> +++ b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
> @@ -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}
> --
> 1.7.1
>
------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
[PATCH] dynamic driver switching for eucalyptus
Posted by sa...@eucalyptus.com.
From: Sang-Min Park <sp...@eucalyptus.com>
---
server/lib/deltacloud/drivers/ec2/ec2_driver.rb | 2 +
.../drivers/eucalyptus/eucalyptus_driver.rb | 25 ++++++++++++++-----
2 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 302aac2..2a2d092 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -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.
diff --git a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
index 59db7e6..413f206 100644
--- a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
+++ b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
@@ -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}
--
1.7.1