incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core 8/9] Fixed storage_volume state to be amazon-ec2 compatible Added valid_credentials? to EC2 driver Removed public_ip feature from EC2 Fixed client when mounting storage_volume
Date Wed, 01 Dec 2010 13:17:47 GMT
From: Michal Fojtik <mfojtik@redhat.com>

---
 client/lib/deltacloud.rb                        |    2 +-
 server/lib/deltacloud/base_driver/features.rb   |    6 ------
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |   18 ++++++++++++++----
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/client/lib/deltacloud.rb b/client/lib/deltacloud.rb
index c632594..30e0a1d 100644
--- a/client/lib/deltacloud.rb
+++ b/client/lib/deltacloud.rb
@@ -167,7 +167,7 @@ module DeltaCloud
         end
 
         if attribute.name == 'mount'
-          obj.add_link!("instance", (attribute/"./instance/@id").first)
+          obj.add_link!("instance", (attribute/"./instance/@id").first.value)
           obj.add_text!("device", (attribute/"./device/@name").first.value)
           next
         end
diff --git a/server/lib/deltacloud/base_driver/features.rb b/server/lib/deltacloud/base_driver/features.rb
index f229fe6..de055de 100644
--- a/server/lib/deltacloud/base_driver/features.rb
+++ b/server/lib/deltacloud/base_driver/features.rb
@@ -185,11 +185,5 @@ module Deltacloud
       end
     end
 
-    declare_feature :instances, :public_ip do
-      operation :create do
-        param :public_ip, :string, :optional
-      end
-    end
-
   end
 end
diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index e2a6087..ef6e20f 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -41,7 +41,6 @@ module Deltacloud
 
         feature :instances, :user_data
         feature :instances, :authentication_key
-        feature :instances, :public_ip
         feature :instances, :security_group
         feature :images, :owner_id
         feature :buckets, :bucket_location
@@ -180,7 +179,7 @@ module Deltacloud
           instance_options = {}
           instance_options.merge!(:user_data => opts[:user_data]) if opts[:user_data]
           instance_options.merge!(:key_name => opts[:key_name]) if opts[:key_name]
-          instance_options.merge!(:availability_zone => opts[:availability_zone]) if opts[:availability_zone]
+          instance_options.merge!(:availability_zone => opts[:realm_id]) if opts[:realm_id]
           instance_options.merge!(:instance_type => opts[:hwp_id]) if opts[:hwp_id]
           instance_options.merge!(:group_ids => opts[:security_group]) if opts[:security_group]
           safely do
@@ -408,6 +407,16 @@ module Deltacloud
           end
         end
 
+        def valid_credentials?(credentials)
+          retval = true
+          begin
+            realms(credentials)
+          rescue Deltacloud::BackendError
+            retval = false
+          end
+          retval
+        end
+
         private
 
         def new_client(credentials, type = :ec2)
@@ -494,7 +503,7 @@ module Deltacloud
             :instance_profile => InstanceProfile.new(instance[:aws_instance_type]),
             :realm_id => instance[:aws_availability_zone],
             :private_addresses => instance[:private_dns_name],
-            :public_addresses => instance[:public_addresses]
+            :public_addresses => instance[:dns_name]
           )
         end
 
@@ -512,7 +521,8 @@ module Deltacloud
           StorageVolume.new(
             :id => volume[:aws_id],
             :created => volume[:aws_created_at],
-            :state => volume[:aws_status] ? volume[:aws_status].upcase : 'unknown',
+            # Fix IN_USE to be IN-USE 
+            :state => volume[:aws_status] ? volume[:aws_status].tr('_', '-').upcase :
'unknown',
             :capacity => volume[:aws_size],
             :instance_id => volume[:aws_instance_id],
             :realm_id => volume[:zone],
-- 
1.7.3.2


Mime
View raw message