Return-Path: Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: (qmail 96584 invoked from network); 1 Dec 2010 13:18:27 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Dec 2010 13:18:27 -0000 Received: (qmail 26324 invoked by uid 500); 1 Dec 2010 13:18:27 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 26312 invoked by uid 500); 1 Dec 2010 13:18:27 -0000 Mailing-List: contact deltacloud-dev-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-dev@incubator.apache.org Received: (qmail 26304 invoked by uid 99); 1 Dec 2010 13:18:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Dec 2010 13:18:27 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=10.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Dec 2010 13:18:21 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB1DI1QG026967 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 1 Dec 2010 08:18:01 -0500 Received: from patashnik.brq.redhat.com (dhcp-2-138.brq.redhat.com [10.34.2.138]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB1DHofa004656 for ; Wed, 1 Dec 2010 08:18:00 -0500 From: mfojtik@redhat.com To: deltacloud-dev@incubator.apache.org 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, 1 Dec 2010 14:17:47 +0100 Message-Id: <1291209468-4622-9-git-send-email-mfojtik@redhat.com> In-Reply-To: <1291209468-4622-1-git-send-email-mfojtik@redhat.com> References: <1291209468-4622-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 From: Michal Fojtik --- 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