foreman_xen 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e0a8037b7d50886ca41a1a27654908d86ba7248
4
- data.tar.gz: 530c4267118cbbc311220ec6bac82511eda39988
3
+ metadata.gz: bf86d445212406a7e6272d38901bbf3775dabae3
4
+ data.tar.gz: f8fcff62613110e76de79caebed200cb3b210293
5
5
  SHA512:
6
- metadata.gz: 8f46685f806d8c23c41313199e17b877adc1af6adc8f5ce6bc3840d44871cb8dd4f79dbf8c4b105072636d8dd5e7c1ec4e01a7038869f6531fc94c8f9236d845
7
- data.tar.gz: 74c808448e47efa80a67ab2e112c8bb648838303e3546e59d927bf273579b65ca8d10c77d4143be8771504331284ea6d85b622ecfae2b46d0d6cbed0d8e0a537
6
+ metadata.gz: 6baec9017286dbfcd59f5ed4a1a4bc9898ce5d0c4077748fc5e349c724481614b618d0126ddd4533d68b4d062ab2313d164b60b36aa1e2ac58f07c79069190f4
7
+ data.tar.gz: 3e6f83333a0912229e3ef87a2b1f9feb21be179f4b05e9843d7aeed82422cfd6a3125abcc47dbd297d6a852e4980dd9080c71e8bf708af158303bd4dbc22ff8e
data/README.md CHANGED
@@ -15,7 +15,8 @@ Please see the Foreman manual for further instructions:
15
15
  | Foreman Version | Plugin Version |
16
16
  |:--------------- |:-------------- |
17
17
  | >=1.5, <1.8 | 0.0.x |
18
- | >=1.8.1 | 0.1.x |
18
+ | >=1.8.1, <1.10 | 0.1.x |
19
+ | >=1.10 | 0.2.x |
19
20
 
20
21
  ## Support
21
22
 
@@ -0,0 +1,102 @@
1
+ module XenComputeHelper
2
+ def compute_attribute_map(params, compute_resource, new)
3
+ if controller_name == 'hosts'
4
+ attribute_map = hosts_controller_compute_attribute_map(params, compute_resource, new)
5
+ elsif controller_name == 'compute_attributes'
6
+ attribute_map = compute_resource_controller_attribute_map(params, compute_resource)
7
+ end
8
+ attribute_map
9
+ end
10
+
11
+ def init_vmdata()
12
+ vmdata = { :ifs =>
13
+ { '0' => {
14
+ :ip => '',
15
+ :gateway => '',
16
+ :netmask => ''
17
+ }
18
+ },
19
+ :nameserver1 => '',
20
+ :nameserver2 => '',
21
+ :environment => ''
22
+ }
23
+ end
24
+
25
+ private
26
+
27
+ def hosts_controller_compute_attribute_map(params, compute_resource, new)
28
+ attribute_map = empty_attribute_map
29
+ if new_host?(new)
30
+ compute_attributes = compute_resource.compute_profile_attributes_for(params['host']['compute_profile_id'])
31
+ if compute_attributes['VBDs']
32
+ attribute_map[:volume_size] = compute_attributes['VBDs']['physical_size'] ? compute_attributes['VBDs']['physical_size'] : nil
33
+ attribute_map[:volume_selected] = compute_attributes['VBDs']['sr_uuid'] ? compute_attributes['VBDs']['sr_uuid'] : nil
34
+ end
35
+ if compute_attributes['VIFs']
36
+ attribute_map[:network_selected] = compute_attributes['VIFs']['print'] ? compute_attributes['VIFs']['print'] : nil
37
+ end
38
+ attribute_map[:template_selected_custom] = compute_attributes['custom_template_name'] ? compute_attributes['custom_template_name'] : nil
39
+ attribute_map[:template_selected_builtin] = compute_attributes['builtin_template_name'] ? compute_attributes['custom_template_name'] : nil
40
+ attribute_map[:cpu_count] = compute_attributes['vcpus_max'] ? compute_attributes['vcpus_max'] : nil
41
+ attribute_map[:memory_min] = compute_attributes['memory_min'] ? compute_attributes['memory_min'] : nil
42
+ attribute_map[:memory_max] = compute_attributes['memory_max'] ? compute_attributes['memory_max'] : nil
43
+ attribute_map[:power_on] = compute_attributes['start'] ? compute_attributes['start'] : nil
44
+ elsif params && params['host'] && params['host']['compute_attributes']
45
+ if params['host']['compute_attributes']['VBDs']
46
+ attribute_map[:volume_size] = (params['host']['compute_attributes']['VBDs']['physical_size']) ? params['host']['compute_attributes']['VBDs']['physical_size'] : nil
47
+ attribute_map[:volume_selected] = (params['host']['compute_attributes']['VBDs']['sr_uuid']) ? params['host']['compute_attributes']['VBDs']['sr_uuid'] : nil
48
+ end
49
+ if params['host']['compute_attributes']['VIFs']
50
+ attribute_map[:network_selected] = params['host']['compute_attributes']['VIFs']['print'] ? params['host']['compute_attributes']['VIFs']['print'] : nil
51
+ end
52
+ attribute_map[:template_selected_custom] = params['host']['compute_attributes']['custom_template_name'] ? params['host']['compute_attributes']['custom_template_name'] : nil
53
+ attribute_map[:template_selected_builtin] = params['host']['compute_attributes']['builtin_template_name'] ? params['host']['compute_attributes']['builtin_template_name'] : nil
54
+ elsif new
55
+ if new.__vbds
56
+ attribute_map[:volume_selected] = new.__vbds['sr_uuid'] ? new.__vbds['sr_uuid'] : nil
57
+ attribute_map[:volume_size] = new.__vbds['physical_size'] ? new.__vbds['physical_size'] : nil
58
+ end
59
+ if new.__vifs
60
+ attribute_map[:network_selected] = new.__vifs['print'] ? new.__vifs['print'] : nil
61
+ end
62
+ end
63
+ attribute_map
64
+ end
65
+
66
+ def compute_resource_controller_attribute_map(params, compute_resource)
67
+ attribute_map = empty_attribute_map
68
+ if params && params['compute_profile_id']
69
+ compute_attributes = compute_resource.compute_profile_attributes_for(params['compute_profile_id'])
70
+ elsif params && params['host'] && params['host']['compute_profile_id']
71
+ compute_attributes = compute_resource.compute_profile_attributes_for(params['host']['compute_profile_id'])
72
+ end
73
+ if compute_attributes
74
+ if compute_attributes['VBDs']
75
+ attribute_map[:volume_size] = compute_attributes['VBDs']['physical_size'] ? compute_attributes['VBDs']['physical_size'] : nil
76
+ attribute_map[:volume_selected] = compute_attributes['VBDs']['sr_uuid'] ? compute_attributes['VBDs']['sr_uuid'] : nil
77
+ end
78
+ if compute_attributes['VIFs']
79
+ attribute_map[:network_selected] = compute_attributes['VIFs']['print'] ? compute_attributes['VIFs']['print'] : nil
80
+ end
81
+ attribute_map[:template_selected_custom] = compute_attributes['custom_template_name'] ? compute_attributes['custom_template_name'] : nil
82
+ attribute_map[:template_selected_builtin] = compute_attributes['builtin_template_name'] ? compute_attributes['builtin_template_name'] : nil
83
+ attribute_map[:cpu_count] = compute_attributes['vcpus_max'] ? compute_attributes['vcpus_max'] : nil
84
+ attribute_map[:memory_min] = compute_attributes['memory_min'] ? compute_attributes['memory_min'] : nil
85
+ attribute_map[:memory_max] = compute_attributes['memory_max'] ? compute_attributes['memory_max'] : nil
86
+ attribute_map[:power_on] = compute_attributes['start'] ? compute_attributes['start'] : nil
87
+ end
88
+ attribute_map
89
+ end
90
+
91
+ def empty_attribute_map
92
+ {:volume_size => nil,
93
+ :volume_selected => nil,
94
+ :network_selected => nil,
95
+ :template_selected_custom => nil,
96
+ :template_selected_builtin => nil,
97
+ :cpu_count => nil,
98
+ :memory_min => nil,
99
+ :memory_max => nil,
100
+ :power_on => nil}
101
+ end
102
+ end
@@ -48,7 +48,7 @@ module ForemanXen
48
48
 
49
49
  def test_connection(options = {})
50
50
  super
51
- errors[:url].empty? and hypervisor
51
+ errors[:url].empty? and errors[:user].empty? and errors[:password].empty? and hypervisor
52
52
  rescue => e
53
53
  disconnect rescue nil
54
54
  errors[:base] << e.message
@@ -200,20 +200,17 @@ module ForemanXen
200
200
  end
201
201
 
202
202
  def create_vm_from_custom(args)
203
-
204
- hypervisor_host = args[:hypervisor_host]
205
- hypervisor_host = hypervisor_host.to_s
206
203
 
207
204
  mem_max = args[:memory_max]
208
205
  mem_min = args[:memory_min]
209
206
 
210
- if args[:hypervisor_host]
207
+ if args[:hypervisor_host] != ''
211
208
  host = client.hosts.find { |host| host.name == args[:hypervisor_host] }
212
- logger.info "create_vm_from_builtin: host : #{ hypervisor_host }"
213
- elsif
209
+ logger.info "create_vm_from_builtin: host : #{ host.name }"
210
+ elsif
214
211
  host = client.hosts.first
215
- logger.info "create_vm_from_builtin: host : #{ host }"
216
- end
212
+ logger.info "create_vm_from_builtin: host : #{ host.name }"
213
+ end
217
214
 
218
215
  raise 'Memory max cannot be lower than Memory min' if mem_min.to_i > mem_max.to_i
219
216
  vm = client.servers.new :name => args[:name],
@@ -255,20 +252,17 @@ module ForemanXen
255
252
  end
256
253
 
257
254
  def create_vm_from_builtin(args)
258
-
259
- hypervisor_host = args[:hypervisor_host]
260
- hypervisor_host = hypervisor_host.to_s
261
-
255
+
262
256
  builtin_template_name = args[:builtin_template_name]
263
257
  builtin_template_name = builtin_template_name.to_s
264
258
 
265
- if args[:hypervisor_host]
259
+ if args[:hypervisor_host] != ''
266
260
  host = client.hosts.find { |host| host.name == args[:hypervisor_host] }
267
- logger.info "create_vm_from_builtin: host : #{ hypervisor_host }"
268
- elsif
261
+ logger.info "create_vm_from_builtin: host : #{ host.name }"
262
+ elsif
269
263
  host = client.hosts.first
270
- logger.info "create_vm_from_builtin: host : #{ host }"
271
- end
264
+ logger.info "create_vm_from_builtin: host : #{ host.name }"
265
+ end
272
266
 
273
267
  storage_repository = client.storage_repositories.find { |sr| sr.uuid == "#{args[:VBDs][:sr_uuid]}" }
274
268
 
@@ -6,6 +6,8 @@
6
6
  <% if hypervisor -%>
7
7
  <%= f.hidden_field :uuid, :value => hypervisor %>
8
8
  <% end -%>
9
- <%= link_to_function _("Test Connection"), "testConnection(this)", :class => "btn + #{hypervisor.nil? ? "" : "btn-success"}", :'data-url' => test_connection_compute_resources_path %>
9
+ <%= link_to_function _("Test Connection"), "testConnection(this)", :class => "btn + #{hypervisor.nil? ? "btn-default" : "btn-success"}", :'data-url' => test_connection_compute_resources_path %>
10
10
 
11
11
  <%= image_tag('/assets/spinner.gif', :id => 'test_connection_indicator', :class => 'hide') %>
12
+
13
+
@@ -1,29 +1,12 @@
1
1
  <div class="fields">
2
2
  <%
3
3
  nat = compute_resource.networks
4
- selected = ""
5
-
6
- if controller_name == 'hosts'
7
- compute_attributes = compute_resource.compute_profile_attributes_for(params['host']['compute_profile_id'])
8
- if params && params['host']['compute_profile_id'] != ""
9
- selected = compute_attributes['VIFs']['print']
10
- elsif params && params['host'] && params['host']['compute_attributes']
11
- selected = params['host']['compute_attributes']['VIFs']['print']
12
- elsif new.__vifs
13
- selected = new.__vifs['print']
14
- end
15
- elsif controller_name == 'compute_attributes'
16
- compute_attributes = compute_resource.compute_profile_attributes_for(params['compute_profile_id'])
17
- if compute_attributes['VIFs'] && compute_attributes['VIFs']['print']
18
- selected = compute_attributes['VIFs']['print']
19
- end
20
- end
21
4
  -%>
22
5
 
23
6
  <div id='nat' class=''>
24
7
  <%= selectable_f f, :print, nat.map(&:name),
25
8
  { :include_blank => nat.any? ? false : _("No networks"),
26
- :selected => selected },
9
+ :selected => attribute_map[:network_selected] },
27
10
  { :class => "span2", :label => _("Network") } %>
28
11
  </div>
29
12
  </div>
@@ -1,36 +1,11 @@
1
1
  <div class="fields">
2
- <%
3
- selected_item_c = ''
4
- selected_item_b = ''
5
-
6
- if controller_name == 'hosts'
7
- compute_attributes = compute_resource.compute_profile_attributes_for(params['host']['compute_profile_id'])
8
- if params && params['host']['compute_profile_id'] != ""
9
- selected_item_c = compute_attributes['custom_template_name']
10
- selected_item_b = compute_attributes['builtin_template_name']
11
- elsif params && params['host'] && params['host']['compute_attributes']
12
- selected_item_c = params['host']['compute_attributes']['custom_template_name']
13
- selected_item_b = params['host']['compute_attributes']['builtin_template_name']
14
- end
15
-
16
- elsif controller_name == 'compute_attributes'
17
- compute_attributes = compute_resource.compute_profile_attributes_for(params['compute_profile_id'])
18
- if compute_attributes['custom_template_name']
19
- selected_item_c = compute_attributes['custom_template_name']
20
- end
21
- if compute_attributes['builtin_template_name']
22
- selected_item_b = compute_attributes['builtin_template_name']
23
- end
24
- end
25
- -%>
26
-
27
2
  <div id='templates' class=''>
28
3
  <div class="form-group">
29
- <%= selectable_f f, :custom_template_name,[[_("No template"), ""]] + compute_resource.custom_templates.map { |t| [t.name, t.name] }, { :selected => selected_item_c }, :class => 'form-control span2', :label => 'Custom Template' %>
4
+ <%= selectable_f f, :custom_template_name,[[_("No template"), ""]] + compute_resource.custom_templates.map { |t| [t.name, t.name] }, { :selected => attribute_map[:template_selected_custom] }, :class => 'form-control span2', :label => 'Custom Template' %>
30
5
  </div>
31
6
 
32
7
  <div class="form-group ">
33
- <%= selectable_f f, :builtin_template_name,[[_("No template"), ""]] + compute_resource.builtin_templates.map { |t| [t.name, t.name] }, { :selected => selected_item_b }, :class => 'form-control span2', :label => 'Builtin Template' %>
8
+ <%= selectable_f f, :builtin_template_name,[[_("No template"), ""]] + compute_resource.builtin_templates.map { |t| [t.name, t.name] }, { :selected => attribute_map[:template_selected_builtin] }, :class => 'form-control span2', :label => 'Builtin Template' %>
34
9
  </div>
35
10
  </div>
36
11
  </div>
@@ -1,34 +1,6 @@
1
1
  <div class="fields">
2
- <%
3
- selected = ""
4
- size = ""
5
-
6
- if controller_name == 'hosts'
7
- compute_attributes = compute_resource.compute_profile_attributes_for(params['host']['compute_profile_id'])
8
- if params && params['host']['compute_profile_id'] != ""
9
- size = compute_attributes['VBDs']['physical_size']
10
- selected = compute_attributes['VBDs']['sr_uuid']
11
- elsif params && params['host'] && params['host']['compute_attributes'] && params['host']['compute_attributes']['VBDs']['physical_size'] != ""
12
- selected = params['host']['compute_attributes']['VBDs']['print']
13
- size = params['host']['compute_attributes']['VBDs']['physical_size']
14
- elsif new.__vbds
15
- selected = new.__vbds['print']
16
- size = new.__vbds['physical_size']
17
- end
18
- elsif controller_name == 'compute_attributes'
19
- compute_attributes = compute_resource.compute_profile_attributes_for(params['compute_profile_id'])
20
- if compute_attributes['VBDs'] && compute_attributes['VBDs']['physical_size']
21
- size = compute_attributes['VBDs']['physical_size']
22
- end
23
- if compute_attributes['VBDs'] && compute_attributes['VBDs']['sr_uuid']
24
- selected = compute_attributes['VBDs']['sr_uuid']
25
- end
26
2
 
27
- end
28
- -%>
29
-
3
+ <%= selectable_f f, :sr_uuid, compute_resource.storage_pools.map{ |item| [item[:display_name], item[:uuid]]}, { :selected => attribute_map[:volume_selected] }, :class => "span2", :label => _("Storage Repository") %>
30
4
 
31
- <%= selectable_f f, :sr_uuid, compute_resource.storage_pools.map{ |item| [item[:display_name], item[:uuid]]}, { :selected => selected }, :class => "span2", :label => _("Storage Repository") %>
32
-
33
- <%= text_f f, :physical_size, :class => "input-mini", :label => _("Size (GB)"), :value => size %>
5
+ <%= text_f f, :physical_size, :class => "input-mini", :label => _("Size (GB)"), :value => attribute_map[:volume_size] %>
34
6
  </div>
@@ -1,28 +1,11 @@
1
1
  <%
2
- vmdata = { :ifs =>
3
- { '0' => {
4
- :ip => '',
5
- :gateway => '',
6
- :netmask => ''
7
- }
8
- },
9
- :nameserver1 => '',
10
- :nameserver2 => '',
11
- :environment => ''
12
- }
13
-
14
2
 
15
3
  if params[:host] && params[:host][:compute_attributes] && params[:host][:compute_attributes][:xenstore]
16
4
  vmdata = params[:host][:compute_attributes][:xenstore]['vm-data']
5
+ else
6
+ vmdata = init_vmdata
17
7
  end
18
8
 
19
- ip = vmdata[:ifs]['0'][:ip]
20
- gateway = vmdata[:ifs]['0'][:gateway]
21
- netmask = vmdata[:ifs]['0'][:netmask]
22
- nameserver1 = vmdata[:nameserver1]
23
- nameserver2 = vmdata[:nameserver2]
24
- environment = vmdata[:environment]
25
-
26
9
  disabled = 'readonly'
27
10
 
28
11
  %>
@@ -35,7 +18,7 @@
35
18
  <label class="col-md-2 control-label" for="xenstore-vm-data-ifs-0-ip">vm-data/ifs/0/ip</label>
36
19
  <div class="col-md-4">
37
20
  <div class="controls">
38
- <input <%= disabled %> id="xenstore-vm-data-ifs-0-ip" type="text" name="host[compute_attributes][xenstore][vm-data][ifs][0][ip]" class="form-control input-mini" value="<%= ip %>">
21
+ <input <%= disabled %> id="xenstore-vm-data-ifs-0-ip" type="text" name="host[compute_attributes][xenstore][vm-data][ifs][0][ip]" class="form-control input-mini" value="<%= vmdata[:ifs]['0'][:ip] %>">
39
22
  </div>
40
23
  </div>
41
24
  </div>
@@ -44,7 +27,7 @@
44
27
  <label class="col-md-2 control-label" for="xenstore-vm-data-ifs-0-gateway">vm-data/ifs/0/gateway</label>
45
28
  <div class="col-md-4">
46
29
  <div class="controls">
47
- <input <%= disabled %> id="xenstore-vm-data-ifs-0-gateway" type="text" name="host[compute_attributes][xenstore][vm-data][ifs][0][gateway]" class="form-control input-mini" value="<%= gateway %>">
30
+ <input <%= disabled %> id="xenstore-vm-data-ifs-0-gateway" type="text" name="host[compute_attributes][xenstore][vm-data][ifs][0][gateway]" class="form-control input-mini" value="<%= vmdata[:ifs]['0'][:gateway] %>">
48
31
  </div>
49
32
  </div>
50
33
  </div>
@@ -53,7 +36,7 @@
53
36
  <label class="col-md-2 control-label" for="xenstore-vm-data-ifs-0-netmask">vm-data/ifs/0/netmask</label>
54
37
  <div class="col-md-4">
55
38
  <div class="controls">
56
- <input <%= disabled %> id="xenstore-vm-data-ifs-0-netmask" type="text" name="host[compute_attributes][xenstore][vm-data][ifs][0][netmask]" class="form-control input-mini" value="<%= netmask %>">
39
+ <input <%= disabled %> id="xenstore-vm-data-ifs-0-netmask" type="text" name="host[compute_attributes][xenstore][vm-data][ifs][0][netmask]" class="form-control input-mini" value="<%= vmdata[:ifs]['0'][:netmask] %>">
57
40
  </div>
58
41
  </div>
59
42
  </div>
@@ -61,21 +44,21 @@
61
44
  <div class="form-group">
62
45
  <label class="col-md-2 control-label" for="xenstore-vm-data-nameserver1">vm-data/nameserver1</label>
63
46
  <div class="col-md-4">
64
- <input <%= disabled %> id="xenstore-vm-data-nameserver1" type="text" name="host[compute_attributes][xenstore][vm-data][nameserver1]" class="form-control input-mini" value="<%= nameserver1 %>">
47
+ <input <%= disabled %> id="xenstore-vm-data-nameserver1" type="text" name="host[compute_attributes][xenstore][vm-data][nameserver1]" class="form-control input-mini" value="<%= vmdata[:nameserver1] %>">
65
48
  </div>
66
49
  </div>
67
50
 
68
51
  <div class="form-group">
69
52
  <label class="col-md-2 control-label" for="xenstore-vm-data-nameserver2">vm-data/nameserver2</label>
70
53
  <div class="col-md-4">
71
- <input <%= disabled %> id="xenstore-vm-data-nameserver2" type="text" name="host[compute_attributes][xenstore][vm-data][nameserver2]" class="form-control input-mini" value="<%= nameserver2 %>">
54
+ <input <%= disabled %> id="xenstore-vm-data-nameserver2" type="text" name="host[compute_attributes][xenstore][vm-data][nameserver2]" class="form-control input-mini" value="<%= vmdata[:nameserver2] %>">
72
55
  </div>
73
56
  </div>
74
57
 
75
58
  <div class="form-group">
76
59
  <label class="col-md-2 control-label" for="xenstore-vm-data-environment">vm-data/environment</label>
77
60
  <div class="col-md-4">
78
- <input <%= disabled %> id="xenstore-vm-data-environment" type="text" name="host[compute_attributes][xenstore][vm-data][environment]" class="form-control input-mini" value="<%= environment %>">
61
+ <input <%= disabled %> id="xenstore-vm-data-environment" type="text" name="host[compute_attributes][xenstore][vm-data][environment]" class="form-control input-mini" value="<%= vmdata[:environment] %>">
79
62
  </div>
80
63
  </div>
81
64
  </div>
@@ -1,4 +1,6 @@
1
1
  <% new = f.object
2
+ attribute_map = compute_attribute_map(params, compute_resource, new)
3
+
2
4
  hide_raw = ''
3
5
  if params && params['host'] && params['host']['compute_attributes'] && params['host']['compute_attributes']['custom_template_name'] != ''
4
6
  hide_raw = 'display:none;'
@@ -12,9 +14,6 @@
12
14
  fields_enabled = true
13
15
  compute_attributes = compute_resource.compute_profile_attributes_for(params['compute_profile_id'])
14
16
  name = compute_attributes['name']
15
- vcpus_max = compute_attributes['vcpus_max']
16
- memory_min = compute_attributes['memory_min']
17
- memory_max = compute_attributes['memory_max']
18
17
  else
19
18
  fields_enabled = false
20
19
  end
@@ -27,9 +26,9 @@
27
26
  <legend>VM Profile</legend>
28
27
  <div class="fields">
29
28
  <!--<%= text_f f, :name, :disabled => !fields_enabled, :value => name, :label => 'Name' if controller_name != 'hosts' %>-->
30
- <%= selectable_f f, :vcpus_max, 1..compute_resource.max_cpu_count, {:selected => vcpus_max}, :class => 'input-mini', :disabled => !fields_enabled, :label => 'vCPUs' %>
31
- <%= selectable_f f, :memory_min, memory_options(compute_resource.max_memory), {:selected => memory_min}, :class => 'form-control span2', :disabled => !fields_enabled, :label => 'Memory Min' %>
32
- <%= selectable_f f, :memory_max, memory_options(compute_resource.max_memory), {:selected => memory_max}, :class => 'form-control span2', :disabled => !fields_enabled, :label => 'Memory Max' %>
29
+ <%= selectable_f f, :vcpus_max, 1..compute_resource.max_cpu_count, {:selected => attribute_map[:cpu_count]}, :class => 'input-mini', :disabled => !fields_enabled, :label => 'vCPUs' %>
30
+ <%= selectable_f f, :memory_min, memory_options(compute_resource.max_memory), {:selected => attribute_map[:memory_min]}, :class => 'form-control span2', :disabled => !fields_enabled, :label => 'Memory Min' %>
31
+ <%= selectable_f f, :memory_max, memory_options(compute_resource.max_memory), {:selected => attribute_map[:memory_max]}, :class => 'form-control span2', :disabled => !fields_enabled, :label => 'Memory Max' %>
33
32
  </div>
34
33
  </fieldset>
35
34
  </div>
@@ -37,14 +36,14 @@
37
36
  <!-- Templates -->
38
37
  <div class="children_fields">
39
38
  <%= field_set_tag 'VM Template', :id => 'xen_templates', :title => _('Template') do -%>
40
- <%= render 'compute_resources_vms/form/templates', :f => f, :compute_resource => compute_resource, :new => new %>
39
+ <%= render 'compute_resources_vms/form/templates', :f => f, :compute_resource => compute_resource, :new => new, :attribute_map => attribute_map %>
41
40
  <% end -%>
42
41
  </div>
43
42
 
44
43
  <!-- XenStore Data -->
45
44
  <div class="children_fields" id="xenserver-xenstore-data">
46
45
  <%= field_set_tag 'Xen Store Data', :id => 'xen_store_data', :title => _('Xen Store Data') do -%>
47
- <%= render 'compute_resources_vms/form/xenstore', :f => f, :compute_resource => compute_resource, :new => new %>
46
+ <%= render 'compute_resources_vms/form/xenstore', :f => f, :compute_resource => compute_resource, :new => new, :attribute_map => attribute_map %>
48
47
  <% end %>
49
48
  </div>
50
49
 
@@ -52,7 +51,7 @@
52
51
  <div class="children_fields xenserver-raw" id="xenserver-storage" style="<%= hide_raw %>">
53
52
  <%= field_set_tag 'Storage', :id => 'storage_volumes', :title => _('Storage') do -%>
54
53
  <%= f.fields_for :VBDs do |i| %>
55
- <%= render 'compute_resources_vms/form/volume', :f => i, :compute_resource => compute_resource, :new => new %>
54
+ <%= render 'compute_resources_vms/form/volume', :f => i, :compute_resource => compute_resource, :new => new, :attribute_map => attribute_map %>
56
55
  <% end -%>
57
56
  <% end -%>
58
57
  </div>
@@ -61,14 +60,14 @@
61
60
  <div class="children_fields" id="xenserver-network" style="<%= hide_raw %>">
62
61
  <%= field_set_tag 'Network interfaces', :id => 'network_interfaces', :title => _('Networks') do -%>
63
62
  <%= f.fields_for :VIFs do |i| %>
64
- <%= render 'compute_resources_vms/form/network', :f => i, :compute_resource => compute_resource, :new => new %>
63
+ <%= render 'compute_resources_vms/form/network', :f => i, :compute_resource => compute_resource, :new => new, :attribute_map => attribute_map %>
65
64
  <% end -%>
66
65
  <% end -%>
67
66
  </div>
68
67
 
69
68
  <div class="children_fields" id="xenserver-hosts" style="<%= hide_raw %>">
70
69
  <%= field_set_tag 'Start on server', :id => 'xen_hypervisors', :title => _('Start on server') do -%>
71
- <%= render 'compute_resources_vms/form/hypervisors', :f => f, :compute_resource => compute_resource, :new => new %>
70
+ <%= render 'compute_resources_vms/form/hypervisors', :f => f, :compute_resource => compute_resource, :new => new, :attribute_map => attribute_map %>
72
71
  <% end -%>
73
72
  </div>
74
73
 
@@ -1,3 +1,3 @@
1
1
  module ForemanXen
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_xen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Nemirovsky, Michal Piotrowski, Avi Israeli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-19 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -49,6 +49,7 @@ files:
49
49
  - README.md
50
50
  - Rakefile
51
51
  - app/controllers/foreman_xen/snapshots_controller.rb
52
+ - app/helpers/xen_compute_helper.rb
52
53
  - app/models/concerns/fog_extensions/xenserver/server.rb
53
54
  - app/models/concerns/foreman_xen/host_helper_extensions.rb
54
55
  - app/models/foreman_xen/xenserver.rb
@@ -97,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
98
  version: '0'
98
99
  requirements: []
99
100
  rubyforge_project:
100
- rubygems_version: 2.4.8
101
+ rubygems_version: 2.2.2
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: Provision and manage XEN Server from Foreman