You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Tobias Crawley <tc...@redhat.com> on 2010/11/01 20:34:32 UTC

Small change to allow passing security groups through to ec2_driver on create_instance

This lets the security group pass through from the client create_instance call as :security_group.

Tobias Crawley (1):
  Allow setting of security group when creating an ec2 instance.

 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

-- 
1.7.2.3


[PATCH] Allow setting of security group when creating an ec2 instance.

Posted by Tobias Crawley <tc...@redhat.com>.
From: Tobias Crawley <tc...@gmail.com>

---
 server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
index 9b37069..279efc8 100644
--- a/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
+++ b/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
@@ -192,7 +192,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


Re: Small change to allow passing security groups through to ec2_driver on create_instance

Posted by Toby Crawley <tc...@redhat.com>.
On 11/01/2010 07:27 PM, David Lutterkort wrote:
> at a minimum, this needs to be also advertised as a feature in the
> top-level API XML (have a look at how the user-data parameter is
> advertised there)
>

David:

Thanks for the feedback - I'll rework this and send a new patch soon.

Toby

Re: Small change to allow passing security groups through to ec2_driver on create_instance

Posted by David Lutterkort <lu...@redhat.com>.
On Mon, 2010-11-01 at 15:34 -0400, Tobias Crawley wrote:
> This lets the security group pass through from the client create_instance call as :security_group.
> 
> Tobias Crawley (1):
>   Allow setting of security group when creating an ec2 instance.
> 
>  server/lib/deltacloud/drivers/ec2/ec2_driver.rb |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Hi Tobias,

at a minimum, this needs to be also advertised as a feature in the
top-level API XML (have a look at how the user-data parameter is
advertised there)

The reason to do that is so that applications do not have to contain
logic like

        driver = get_driver_from_dcloud_xml()
        if driver == 'ec2'
          yay .. we can use security_group
        else
          cry, no security groups
        end
        
since logic like the above makes users very brittle. Imagine an
implementation of the EC2 API that doesn't support security groups, or
that another API grows a feature equivalent to security groups; in
either of these cases, client code will become more and more complex to
determine if security groups can be used.

By advertising features, the API makes it possible for clients to ask
about very specific things, and adapt their behavior accordingly.

David