On the 'new instance' form, the template is chosen on the first step. On the 
second page, filter out any hardware profiles that don't match the architecture 
of the chosen template.

Signed-off-by: Scott Seago <[email protected]>
---
 src/app/controllers/instance_controller.rb |    9 +++++++++
 src/app/views/instance/configure.haml      |    2 +-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/app/controllers/instance_controller.rb 
b/src/app/controllers/instance_controller.rb
index ad90404..a62a32e 100644
--- a/src/app/controllers/instance_controller.rb
+++ b/src/app/controllers/instance_controller.rb
@@ -82,6 +82,15 @@ class InstanceController < ApplicationController
   def configure
     @instance = Instance.new(params[:instance])
     require_privilege(Privilege::INSTANCE_MODIFY, @instance.pool)
+    # FIXME: change template.architecture to match expected HWP arch strings
+    if (@instance.template.architecture == "64-bit")
+      arch_value = "x86_64"
+    else
+      arch_value = "i386"
+    end
+    @hardware_profiles = HardwareProfile.find(:all, :include => :architecture,
+                                   :conditions => {:provider_id => nil,
+                                   "hardware_profile_properties.value" => 
arch_value})
   end
 
   def create
diff --git a/src/app/views/instance/configure.haml 
b/src/app/views/instance/configure.haml
index 20929b4..809c044 100644
--- a/src/app/views/instance/configure.haml
+++ b/src/app/views/instance/configure.haml
@@ -14,7 +14,7 @@
       = text_field_tag :pool_name, @instance.pool ? @instance.pool.name : '', 
:disabled => true
     %li
       = label :instance, :hardware_profile
-      = select :instance, :hardware_profile_id, 
@instance.pool.hardware_profiles.map {|p| [ p.name, p.id ]}, { :include_blank 
=> true }
+      = select :instance, :hardware_profile_id, @hardware_profiles.map {|p| [ 
p.name, p.id ]}, { :include_blank => false }
     %li
       = label :instance, :realm
       = select :instance, :realm_id, @instance.pool.realms.map {|r| [ r.name, 
r.id ]}, { :include_blank => true }
-- 
1.7.2.3

_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to