diff --git a/app/models/concerns/fog_extensions/xenserver/server.rb b/app/models/concerns/fog_extensions/xenserver/server.rb
index 191cfd2..c57f4fd 100644
--- a/app/models/concerns/fog_extensions/xenserver/server.rb
+++ b/app/models/concerns/fog_extensions/xenserver/server.rb
@@ -2,6 +2,8 @@ module FogExtensions
module Xenserver
module Server
+ attr_accessor :memory_min, :memory_max, :custom_template_name, :builtin_template_name
+
def to_s
name
end
@@ -10,14 +12,6 @@ def nics_attributes=(attrs); end
def volumes_attributes=(attrs); end
- def memory_min
- memory_static_min.to_i
- end
-
- def memory_max
- memory_static_max.to_i
- end
-
def memory
memory_static_max.to_i
end
@@ -38,14 +32,6 @@ def state
power_state
end
- def custom_template_name
- template_name
- end
-
- def builtin_template_name
- template_name
- end
-
end
end
end
diff --git a/app/views/compute_resources_vms/form/_network.html.erb b/app/views/compute_resources_vms/form/_network.html.erb
index f7ee2bf..b98310f 100644
--- a/app/views/compute_resources_vms/form/_network.html.erb
+++ b/app/views/compute_resources_vms/form/_network.html.erb
@@ -4,6 +4,8 @@
selected = ""
if params && params['host'] && params['host']['compute_attributes']
selected = params['host']['compute_attributes']['VIFs']['print']
+ elsif new.__vifs
+ selected = new.__vifs['print']
end
-%>
diff --git a/app/views/compute_resources_vms/form/_templates.html.erb b/app/views/compute_resources_vms/form/_templates.html.erb
index 0d44aee..78f6770 100644
--- a/app/views/compute_resources_vms/form/_templates.html.erb
+++ b/app/views/compute_resources_vms/form/_templates.html.erb
@@ -9,29 +9,12 @@
%>
\ No newline at end of file
diff --git a/app/views/compute_resources_vms/form/_volume.html.erb b/app/views/compute_resources_vms/form/_volume.html.erb
index 732177c..a1d8cb2 100644
--- a/app/views/compute_resources_vms/form/_volume.html.erb
+++ b/app/views/compute_resources_vms/form/_volume.html.erb
@@ -2,9 +2,12 @@
<%
selected = ""
size = ""
- if params && params['host'] && params['host']['compute_attributes']
+ if params && params['host'] && params['host']['compute_attributes'] && params['host']['compute_attributes']['VBDs']['physical_size'] != ""
selected = params['host']['compute_attributes']['VBDs']['print']
size = params['host']['compute_attributes']['VBDs']['physical_size']
+ elsif new.__vbds
+ selected = new.__vbds['print']
+ size = new.__vbds['physical_size']
end
-%>
<%= selectable_f f, :print, compute_resource.storage_pools.map(&:name), { :selected => selected }, :class => "span2", :label => _("Storage Repository") %>
diff --git a/app/views/compute_resources_vms/form/_xenserver.html.erb b/app/views/compute_resources_vms/form/_xenserver.html.erb
index d7cddc9..bba92ab 100644
--- a/app/views/compute_resources_vms/form/_xenserver.html.erb
+++ b/app/views/compute_resources_vms/form/_xenserver.html.erb
@@ -3,65 +3,72 @@
if params && params['host'] && params['host']['compute_attributes'] && params['host']['compute_attributes']['custom_template_name'] != ''
hide_raw = 'display:none;'
end
+
+ if controller_name == 'hosts'
+ fields_enabled = true
+ elsif controller_name == 'compute_attributes'
+ fields_enabled = true
+ else
+ fields_enabled = false
+ end
-%>
<%= field_set_tag 'VM Template', :id => 'xen_templates', :title => _('Template') do -%>
- <%= render 'compute_resources_vms/form/templates', :f => f, :compute_resource => compute_resource %>
+ <%= render 'compute_resources_vms/form/templates', :f => f, :compute_resource => compute_resource, :new => new %>
<% end -%>
<%= field_set_tag 'Xen Store Data', :id => 'xen_store_data', :title => _('Xen Store Data') do -%>
- <%= render 'compute_resources_vms/form/xenstore', :f => f, :compute_resource => compute_resource, :new => new %>
+ <%= render 'compute_resources_vms/form/xenstore', :f => f, :compute_resource => compute_resource, :new => new %>
<% end %>
-
<%= new_child_fields_template(f, :VBDs, {
- :object => compute_resource.new_volume,
- :partial => 'compute_resources_vms/form/volume', :form_builder_attrs => { :compute_resource => compute_resource } }) %>
+ :object => compute_resource.new_volume,
+ :partial => 'compute_resources_vms/form/volume', :form_builder_attrs => { :compute_resource => compute_resource, :new => new } }) %>
<%= field_set_tag 'Storage', :id => 'storage_volumes', :title => _('Storage') do -%>
- <%= f.fields_for :VBDs do |i| %>
- <%= render 'compute_resources_vms/form/volume', :f => i, :compute_resource => compute_resource %>
- <% end -%>
+ <%= f.fields_for :VBDs do |i| %>
+ <%= render 'compute_resources_vms/form/volume', :f => i, :compute_resource => compute_resource, :new => new %>
+ <% end -%>
<% end -%>
<%= field_set_tag 'Network interfaces', :id => 'network_interfaces', :title => _('Networks') do -%>
- <%= f.fields_for :VIFs do |i| %>
- <%= render 'compute_resources_vms/form/network', :f => i, :compute_resource => compute_resource %>
- <% end -%>
+ <%= f.fields_for :VIFs do |i| %>
+ <%= render 'compute_resources_vms/form/network', :f => i, :compute_resource => compute_resource, :new => new %>
+ <% end -%>
<% end -%>
<%= field_set_tag 'VM Startup Options', :id => 'vm_starup_options', :title => _('Power ON this machine') do -%>
-
+
<% end -%>
@@ -69,18 +76,18 @@
diff --git a/app/views/compute_resources_vms/form/_xenstore.html.erb b/app/views/compute_resources_vms/form/_xenstore.html.erb
index dc113b5..b90ecf8 100644
--- a/app/views/compute_resources_vms/form/_xenstore.html.erb
+++ b/app/views/compute_resources_vms/form/_xenstore.html.erb
@@ -1,11 +1,11 @@
<%
vmdata = { :ifs =>
- { '0' => {
- :ip => '',
- :gateway => '',
- :netmask => ''
- }
- },
+ { '0' => {
+ :ip => '',
+ :gateway => '',
+ :netmask => ''
+ }
+ },
:nameserver1 => '',
:nameserver2 => '',
:environment => ''
@@ -31,100 +31,100 @@