You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by ma...@apache.org on 2013/01/28 18:55:35 UTC

git commit: Fix for DTACLOUD-423 - override realms method for euca (no vpc/subnets)

Updated Branches:
  refs/heads/master a62a0d3d6 -> e626bb61f


Fix for DTACLOUD-423 - override realms method for euca (no vpc/subnets)

https://issues.apache.org/jira/browse/DTACLOUD-423


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/e626bb61
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/e626bb61
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/e626bb61

Branch: refs/heads/master
Commit: e626bb61f5c939769d6204b69d307458ce23f486
Parents: a62a0d3
Author: marios <ma...@redhat.com>
Authored: Mon Jan 28 11:30:01 2013 +0200
Committer: marios <ma...@redhat.com>
Committed: Mon Jan 28 19:53:42 2013 +0200

----------------------------------------------------------------------
 .../drivers/eucalyptus/eucalyptus_driver.rb        |   24 +++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/e626bb61/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
index 7586052..a68b3cb 100644
--- a/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
+++ b/server/lib/deltacloud/drivers/eucalyptus/eucalyptus_driver.rb
@@ -118,6 +118,30 @@ module Deltacloud
                   "Loadbalancer not supported in Eucalyptus", "")
         end
 
+        #override ec2 driver realms - euca API doesn't support vpc/subnet concepts
+        #http://docs.aws.amazon.com/AWSEC2/2009-04-04/DeveloperGuide/
+        def realms(credentials, opts={})
+          ec2 = new_client(credentials)
+          realms = []
+          safely do
+            if opts[:id] and !opts[:id].empty?
+              begin
+                ec2.describe_availability_zones([opts[:id]]).collect do |realm|
+                  realms << convert_realm(realm) unless realm.empty?
+              rescue => e
+                raise e unless e.message =~ /Invalid availability zone/
+                realms = []
+              end
+            else
+              realms = ec2.describe_availability_zones.collect do |realm|
+                convert_realm(realm) unless realm.empty?
+              end
+            end
+          end
+          realms
+        end
+
+
 	# override EC2 implementation; Eucalyptus implements the older definition of EC2 security group;
 	# http://docs.amazonwebservices.com/AWSEC2/2009-07-15/APIReference/index.html?ApiReference-query-AuthorizeSecurityGroupIngress.html
         # if the rule specifies a source group, port&protocol will be ignored. And source group and cidr range can't be mixed in a request