You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by mf...@apache.org on 2011/01/27 11:28:00 UTC
svn commit: r1064070 - in /incubator/deltacloud/trunk/server:
lib/deltacloud/base_driver/features.rb
lib/deltacloud/drivers/ec2/ec2_driver.rb views/instances/new.html.haml
Author: mfojtik
Date: Thu Jan 27 10:28:00 2011
New Revision: 1064070
URL: http://svn.apache.org/viewvc?rev=1064070&view=rev
Log:
Added 'instance_count' feature for EC2 driver
Modified:
incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb
incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
incubator/deltacloud/trunk/server/views/instances/new.html.haml
Modified: incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb?rev=1064070&r1=1064069&r2=1064070&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/base_driver/features.rb Thu Jan 27 10:28:00 2011
@@ -197,5 +197,12 @@ module Deltacloud
end
end
+ declare_feature :instances, :instance_count do
+ description "Number of instances to be launch with at once"
+ operation :create do
+ param :instance_count, :string, :optional
+ end
+ end
+
end
end
Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb?rev=1064070&r1=1064069&r2=1064070&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/ec2/ec2_driver.rb Thu Jan 27 10:28:00 2011
@@ -41,6 +41,7 @@ module Deltacloud
feature :instances, :user_data
feature :instances, :authentication_key
feature :instances, :security_group
+ feature :instances, :instance_count
feature :images, :owner_id
feature :buckets, :bucket_location
feature :instances, :register_to_load_balancer
@@ -132,12 +133,12 @@ module Deltacloud
convert_image(image)
end
end
- else
- owner_id = opts[:owner_id] || "amazon"
- safely do
- img_arr = ec2.describe_images_by_owner(owner_id, "machine").collect do |image|
- convert_image(image)
- end
+ return img_arr
+ end
+ owner_id = opts[:owner_id] || "amazon"
+ safely do
+ img_arr = ec2.describe_images_by_owner(owner_id, "machine").collect do |image|
+ convert_image(image)
end
end
img_arr = filter_on( img_arr, :architecture, opts )
@@ -184,6 +185,10 @@ module Deltacloud
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]
+ instance_options.merge!(
+ :min_count => opts[:instance_count],
+ :max_count => opts[:instance_count]
+ ) if opts[:instance_count] and opts[:instance_count].length!=0
safely do
new_instance = convert_instance(ec2.launch_instances(image_id, instance_options).first)
# TODO: Rework this to use client_id for name instead of tag
Modified: incubator/deltacloud/trunk/server/views/instances/new.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/instances/new.html.haml?rev=1064070&r1=1064069&r2=1064070&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/instances/new.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/instances/new.html.haml Thu Jan 27 10:28:00 2011
@@ -1,27 +1,35 @@
-%h1 New Instance
+%h1 Launch new Instance
+%h3{:class => "description"}= @image.description
%h2= @image.id
-%h3= @image.description
-%form{ :action => instances_url, :method => :post }
+%form{ :action => instances_url, :method => :post, :class => :new_instance }
%input{ :name => :image_id, :type => :hidden, :value => @instance.image_id }/
%p
%label
- Instance Name:
- %input{ :name => 'name', :size => 30 }/
+ Name:
+ %input{ :name => 'name', :size => 30, :type => :text }/
+ -if driver_has_feature?(:instance_count)
+ %p
+ %label
+ Number of instances:
+ %input{ :type => :text, :value => "1", :name => :instance_count }
-if driver_has_feature?(:register_to_load_balancer)
%p
%label
- Assign to load balancer:
- %select{:name => 'load_balancer_id'}
- %option{:value => ""}
- - @load_balancers.each do |load_balancer|
- %option{:value => load_balancer.id} #{load_balancer.id}
+ Load balancer to assign:
+ %select{:name => 'load_balancer_id'}
+ %option
+ - @load_balancers.each do |load_balancer|
+ %option{:value => load_balancer.id} #{load_balancer.id}
-if driver_has_feature?(:authentication_key)
%p
%label
Instance Keyname:
- %input{:name => 'keyname', :size => 30 }
+ %select{:name => 'keyname'}
+ %option
+ - @keys.each do |key|
+ %option{ :value => key.id } #{key.id}
- if !@hardware_profiles.empty?
%h3 What size machine?
- for hwp in @hardware_profiles