deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: [PATCH] Expose security_group feature for ec2.
Date Thu, 25 Nov 2010 14:41:12 GMT
On 02/11/10 07:33 -0400, Tobias Crawley wrote:
>---
> server/lib/deltacloud/base_driver/features.rb   |    8 ++++++++
> server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    4 +++-
> 2 files changed, 11 insertions(+), 1 deletions(-)

ACK. This patch is safe to go (work for me, security group is applied
correctly). Please rebase this patch against master and I'll push it.

   -- Michal

>
>diff --git a/server/lib/deltacloud/base_driver/features.rb b/server/lib/deltacloud/base_driver/features.rb
>index 3b19ca2..fd4f92d 100644
>--- a/server/lib/deltacloud/base_driver/features.rb
>+++ b/server/lib/deltacloud/base_driver/features.rb
>@@ -143,6 +143,14 @@ module Deltacloud
>       end
>     end
>
>+    declare_feature :instances, :security_group do
>+      description "Put instance in one or more security groups on launch"
>+      operation :create do
>+        param :security_group, :array, :optional, nil,
>+        "Array of security group names"
>+      end
>+    end
>+
>     declare_feature :instances, :authentication_key do
>       operation :create do
>         param :keyname, :string,  :optional, nil
>diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
>index 9b37069..d843df8 100644
>--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
>+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
>@@ -43,6 +43,7 @@ class EC2Driver < Deltacloud::BaseDriver
>
>   feature :instances, :user_data
>   feature :instances, :authentication_key
>+  feature :instances, :security_group
>   feature :images, :owner_id
>   feature :buckets, :bucket_location
>
>@@ -192,7 +193,8 @@ class EC2Driver < Deltacloud::BaseDriver
>         :monitoring_enabled => true,
>         :instance_type => hwp.name,
>         :disable_api_termination => false,
>-        :instance_initiated_shutdown_behavior => 'terminate'
>+        :instance_initiated_shutdown_behavior => 'terminate',
>+        :security_group => opts[:security_group]
>       )
>       return convert_instance( ec2_instances.instancesSet.item.first, 'pending' )
>     end
>--
>1.7.2.3
>

-- 
--------------------------------------------------------
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
--------------------------------------------------------

Mime
View raw message