You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:15:36 UTC

svn commit: r961994 - in /incubator/deltacloud/trunk/framework: app/controllers/instances_controller.rb app/views/instances/new.html.erb lib/drivers.rb

Author: lutter
Date: Thu Jul  8 23:15:36 2010
New Revision: 961994

URL: http://svn.apache.org/viewvc?rev=961994&view=rev
Log:
Start work on flavor selection for instance spinup.

Modified:
    incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb
    incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb
    incubator/deltacloud/trunk/framework/lib/drivers.rb

Modified: incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb?rev=961994&r1=961993&r2=961994&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb (original)
+++ incubator/deltacloud/trunk/framework/app/controllers/instances_controller.rb Thu Jul  8 23:15:36 2010
@@ -43,6 +43,8 @@ class InstancesController < ApplicationC
                   :id=>params[:id],
                   :image_id=>params[:image_id],
                 } 
+    @image   = driver.image( credentials, params[:image_id] )
+    @flavors = driver.flavors_by_architecture( credentials, @image[:architecture] )
   end
 
   def create

Modified: incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb?rev=961994&r1=961993&r2=961994&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb (original)
+++ incubator/deltacloud/trunk/framework/app/views/instances/new.html.erb Thu Jul  8 23:15:36 2010
@@ -4,5 +4,8 @@
 
 <% form_tag instances_url do %>
   <%= hidden_field_tag :image_id, @instance[:image_id] %>
+  <select>
+    <%= options_for_select @flavors, nil %>
+  </select>
   <%= submit_tag 'create' %>
 <% end %>

Modified: incubator/deltacloud/trunk/framework/lib/drivers.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/framework/lib/drivers.rb?rev=961994&r1=961993&r2=961994&view=diff
==============================================================================
--- incubator/deltacloud/trunk/framework/lib/drivers.rb (original)
+++ incubator/deltacloud/trunk/framework/lib/drivers.rb Thu Jul  8 23:15:36 2010
@@ -12,6 +12,11 @@ module Drivers
       nil
     end
 
+    def flavors_by_architecture(credentials, architecture)
+      flavors(credentials).select{|f| f[:architecture] == architecture}
+    end
+
+
     def image(credentials, id)
       images = images(credentials, [id])
       return images.first unless images.empty?