foreman_xen 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/models/concerns/fog_extensions/xenserver/server.rb +2 -3
- data/app/models/foreman_xen/xenserver.rb +78 -35
- data/app/views/compute_resources_vms/form/_hypervisors.html.erb +5 -0
- data/app/views/compute_resources_vms/form/_network.html.erb +13 -4
- data/app/views/compute_resources_vms/form/_templates.html.erb +24 -8
- data/app/views/compute_resources_vms/form/_volume.html.erb +23 -8
- data/app/views/compute_resources_vms/form/xenserver/_base.html.erb +97 -24
- data/lib/foreman_xen/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e0a8037b7d50886ca41a1a27654908d86ba7248
|
4
|
+
data.tar.gz: 530c4267118cbbc311220ec6bac82511eda39988
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f46685f806d8c23c41313199e17b877adc1af6adc8f5ce6bc3840d44871cb8dd4f79dbf8c4b105072636d8dd5e7c1ec4e01a7038869f6531fc94c8f9236d845
|
7
|
+
data.tar.gz: 74c808448e47efa80a67ab2e112c8bb648838303e3546e59d927bf273579b65ca8d10c77d4143be8771504331284ea6d85b622ecfae2b46d0d6cbed0d8e0a537
|
@@ -3,11 +3,10 @@ module FogExtensions
|
|
3
3
|
module Server
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
|
-
|
7
6
|
include ActionView::Helpers::NumberHelper
|
8
7
|
|
9
|
-
|
10
|
-
|
8
|
+
attr_accessor :start
|
9
|
+
attr_accessor :memory_min, :memory_max, :custom_template_name, :builtin_template_name, :hypervisor_host
|
11
10
|
|
12
11
|
def to_s
|
13
12
|
name
|
@@ -23,7 +23,8 @@ module ForemanXen
|
|
23
23
|
|
24
24
|
# we default to destroy the VM's storage as well.
|
25
25
|
def destroy_vm(ref, args = {})
|
26
|
-
|
26
|
+
logger.info "destroy_vm: #{ ref } #{ args }"
|
27
|
+
find_vm_by_uuid(ref).destroy
|
27
28
|
rescue ActiveRecord::RecordNotFound
|
28
29
|
true
|
29
30
|
end
|
@@ -41,7 +42,7 @@ module ForemanXen
|
|
41
42
|
xenServerMaxDoc = 128*1024*1024*1024
|
42
43
|
[hypervisor.metrics.memory_total.to_i, xenServerMaxDoc].min
|
43
44
|
rescue => e
|
44
|
-
logger.
|
45
|
+
logger.error "unable to figure out free memory, guessing instead due to:#{e}"
|
45
46
|
16*1024*1024*1024
|
46
47
|
end
|
47
48
|
|
@@ -52,6 +53,11 @@ module ForemanXen
|
|
52
53
|
disconnect rescue nil
|
53
54
|
errors[:base] << e.message
|
54
55
|
end
|
56
|
+
|
57
|
+
def avalable_hypervisors
|
58
|
+
tmps = client.hosts rescue []
|
59
|
+
tmps.sort { |a, b| a.name <=> b.name }
|
60
|
+
end
|
55
61
|
|
56
62
|
def new_nic(attr={})
|
57
63
|
client.networks.new attr
|
@@ -62,36 +68,37 @@ module ForemanXen
|
|
62
68
|
end
|
63
69
|
|
64
70
|
def storage_pools
|
65
|
-
results = Array.new
|
66
71
|
|
67
|
-
|
68
|
-
hosts = client.hosts
|
69
|
-
|
70
|
-
storages.each do |sr|
|
71
|
-
subresults = Hash.new()
|
72
|
-
found = 0
|
73
|
-
hosts.each do |host|
|
74
|
-
|
75
|
-
if (sr.reference == host.suspend_image_sr)
|
76
|
-
found = 1
|
77
|
-
subresults[:name] = sr.name
|
78
|
-
subresults[:display_name] = sr.name + '(' + host.hostname + ')'
|
79
|
-
subresults[:uuid] = sr.uuid
|
80
|
-
break
|
81
|
-
end
|
82
|
-
|
83
|
-
end
|
72
|
+
results = Array.new
|
84
73
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
74
|
+
storages = client.storage_repositories.select { |sr| sr.type!= 'udev' && sr.type!= 'iso'} rescue []
|
75
|
+
hosts = client.hosts
|
76
|
+
|
77
|
+
storages.each do |sr|
|
78
|
+
subresults = Hash.new()
|
79
|
+
found = 0
|
80
|
+
hosts.each do |host|
|
81
|
+
|
82
|
+
if (sr.reference == host.suspend_image_sr)
|
83
|
+
found = 1
|
84
|
+
subresults[:name] = sr.name
|
85
|
+
subresults[:display_name] = sr.name + '(' + host.hostname + ')'
|
86
|
+
subresults[:uuid] = sr.uuid
|
87
|
+
break
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
if (found==0)
|
93
|
+
subresults[:name] = sr.name
|
94
|
+
subresults[:display_name] = sr.name
|
95
|
+
subresults[:uuid] = sr.uuid
|
96
|
+
end
|
97
|
+
results.push(subresults)
|
89
98
|
end
|
90
|
-
results.push(subresults)
|
91
|
-
end
|
92
99
|
|
93
|
-
|
94
|
-
|
100
|
+
results.sort_by!{|item| item[:display_name] }
|
101
|
+
return results
|
95
102
|
|
96
103
|
end
|
97
104
|
|
@@ -154,12 +161,22 @@ module ForemanXen
|
|
154
161
|
end
|
155
162
|
|
156
163
|
def create_vm(args = {})
|
157
|
-
|
164
|
+
|
165
|
+
custom_template_name = args[:custom_template_name]
|
158
166
|
builtin_template_name = args[:builtin_template_name]
|
159
|
-
|
167
|
+
custom_template_name = custom_template_name.to_s
|
168
|
+
builtin_template_name = builtin_template_name.to_s
|
169
|
+
|
170
|
+
if builtin_template_name!= '' and custom_template_name!=''
|
171
|
+
logger.info "custom_template_name: #{ custom_template_name }"
|
172
|
+
logger.info "builtin_template_name: #{ builtin_template_name }"
|
173
|
+
raise 'you can select at most one template type'
|
174
|
+
end
|
160
175
|
begin
|
161
176
|
vm = nil
|
162
|
-
|
177
|
+
logger.info "create_vm(): custom_template_name: #{ custom_template_name }"
|
178
|
+
logger.info "create_vm(): builtin_template_name: #{ builtin_template_name }"
|
179
|
+
if custom_template_name != ''
|
163
180
|
vm = create_vm_from_custom args
|
164
181
|
else
|
165
182
|
vm = create_vm_from_builtin args
|
@@ -183,11 +200,24 @@ module ForemanXen
|
|
183
200
|
end
|
184
201
|
|
185
202
|
def create_vm_from_custom(args)
|
186
|
-
mem_max = args[:memory_max]
|
187
|
-
mem_min = args[:memory_min]
|
188
203
|
|
204
|
+
hypervisor_host = args[:hypervisor_host]
|
205
|
+
hypervisor_host = hypervisor_host.to_s
|
206
|
+
|
207
|
+
mem_max = args[:memory_max]
|
208
|
+
mem_min = args[:memory_min]
|
209
|
+
|
210
|
+
if args[:hypervisor_host]
|
211
|
+
host = client.hosts.find { |host| host.name == args[:hypervisor_host] }
|
212
|
+
logger.info "create_vm_from_builtin: host : #{ hypervisor_host }"
|
213
|
+
elsif
|
214
|
+
host = client.hosts.first
|
215
|
+
logger.info "create_vm_from_builtin: host : #{ host }"
|
216
|
+
end
|
217
|
+
|
189
218
|
raise 'Memory max cannot be lower than Memory min' if mem_min.to_i > mem_max.to_i
|
190
219
|
vm = client.servers.new :name => args[:name],
|
220
|
+
:affinity => host,
|
191
221
|
:template_name => args[:custom_template_name]
|
192
222
|
|
193
223
|
vm.save :auto_start => false
|
@@ -225,8 +255,21 @@ module ForemanXen
|
|
225
255
|
end
|
226
256
|
|
227
257
|
def create_vm_from_builtin(args)
|
258
|
+
|
259
|
+
hypervisor_host = args[:hypervisor_host]
|
260
|
+
hypervisor_host = hypervisor_host.to_s
|
261
|
+
|
262
|
+
builtin_template_name = args[:builtin_template_name]
|
263
|
+
builtin_template_name = builtin_template_name.to_s
|
264
|
+
|
265
|
+
if args[:hypervisor_host]
|
266
|
+
host = client.hosts.find { |host| host.name == args[:hypervisor_host] }
|
267
|
+
logger.info "create_vm_from_builtin: host : #{ hypervisor_host }"
|
268
|
+
elsif
|
269
|
+
host = client.hosts.first
|
270
|
+
logger.info "create_vm_from_builtin: host : #{ host }"
|
271
|
+
end
|
228
272
|
|
229
|
-
host = client.hosts.first
|
230
273
|
storage_repository = client.storage_repositories.find { |sr| sr.uuid == "#{args[:VBDs][:sr_uuid]}" }
|
231
274
|
|
232
275
|
gb = 1073741824 #1gb in bytes
|
@@ -239,7 +282,7 @@ module ForemanXen
|
|
239
282
|
mem_max = args[:memory_max]
|
240
283
|
mem_min = args[:memory_min]
|
241
284
|
other_config = {}
|
242
|
-
if
|
285
|
+
if builtin_template_name != ''
|
243
286
|
template = client.servers.builtin_templates.find { |tmp| tmp.name == args[:builtin_template_name] }
|
244
287
|
other_config = template.other_config
|
245
288
|
other_config.delete 'disks'
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div id='templates' class=''>
|
2
|
+
<div class="form-group">
|
3
|
+
<%= selectable_f f, :hypervisor_host, [[_("Automatic allocation"), ""]] + compute_resource.avalable_hypervisors.map { |t| [t.name + " - " + (t.metrics.memory_free.to_f / t.metrics.memory_total.to_f * 100).round(2).to_s + "% free mem", t.name] }, {}, :class => 'form-control span2', :disabled => (controller_name != 'hosts'), :label => 'Hypervisor' %>
|
4
|
+
</div>
|
5
|
+
</div>
|
@@ -2,11 +2,20 @@
|
|
2
2
|
<%
|
3
3
|
nat = compute_resource.networks
|
4
4
|
selected = ""
|
5
|
-
|
6
|
-
|
7
|
-
|
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']
|
8
12
|
elsif new.__vifs
|
9
|
-
|
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']
|
10
19
|
end
|
11
20
|
end
|
12
21
|
-%>
|
@@ -1,20 +1,36 @@
|
|
1
1
|
<div class="fields">
|
2
2
|
<%
|
3
|
-
|
3
|
+
selected_item_c = ''
|
4
4
|
selected_item_b = ''
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
+
-%>
|
10
26
|
|
11
27
|
<div id='templates' class=''>
|
12
28
|
<div class="form-group">
|
13
|
-
<%= selectable_f f, :custom_template_name,[[_("No template"), ""]] + compute_resource.custom_templates.map { |t| [t.name, t.name] }, {}, :class => 'form-control span2', :label => 'Custom Template' %>
|
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' %>
|
14
30
|
</div>
|
15
31
|
|
16
32
|
<div class="form-group ">
|
17
|
-
<%= selectable_f f, :builtin_template_name,[[_("No template"), ""]] + compute_resource.builtin_templates.map { |t| [t.name, t.name] }, {}, :class => 'form-control span2', :label => 'Builtin Template' %>
|
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' %>
|
18
34
|
</div>
|
19
35
|
</div>
|
20
36
|
</div>
|
@@ -2,17 +2,32 @@
|
|
2
2
|
<%
|
3
3
|
selected = ""
|
4
4
|
size = ""
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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']
|
10
14
|
elsif new.__vbds
|
11
|
-
|
12
|
-
|
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']
|
13
25
|
end
|
14
|
-
|
26
|
+
|
27
|
+
end
|
15
28
|
-%>
|
29
|
+
|
30
|
+
|
16
31
|
<%= selectable_f f, :sr_uuid, compute_resource.storage_pools.map{ |item| [item[:display_name], item[:uuid]]}, { :selected => selected }, :class => "span2", :label => _("Storage Repository") %>
|
17
32
|
|
18
33
|
<%= text_f f, :physical_size, :class => "input-mini", :label => _("Size (GB)"), :value => size %>
|
@@ -3,28 +3,38 @@
|
|
3
3
|
if params && params['host'] && params['host']['compute_attributes'] && params['host']['compute_attributes']['custom_template_name'] != ''
|
4
4
|
hide_raw = 'display:none;'
|
5
5
|
end
|
6
|
-
|
6
|
+
|
7
7
|
if controller_name == 'hosts'
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
compute_attributes = compute_resource.compute_profile_attributes_for(params['host']['compute_profile_id'])
|
9
|
+
fields_enabled = true
|
10
|
+
start_enable = true
|
11
|
+
elsif controller_name == 'compute_attributes'
|
12
|
+
fields_enabled = true
|
13
|
+
compute_attributes = compute_resource.compute_profile_attributes_for(params['compute_profile_id'])
|
14
|
+
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']
|
11
18
|
else
|
12
19
|
fields_enabled = false
|
13
20
|
end
|
21
|
+
|
14
22
|
-%>
|
15
23
|
|
24
|
+
<!-- VM Initial Settings -->
|
16
25
|
<div class="children_fields">
|
17
26
|
<fieldset id="vm_profile">
|
18
27
|
<legend>VM Profile</legend>
|
19
28
|
<div class="fields">
|
20
|
-
|
21
|
-
<%= selectable_f f, :vcpus_max, 1..compute_resource.max_cpu_count, {}, :class => 'input-mini', :disabled => !fields_enabled, :label => 'vCPUs' %>
|
22
|
-
<%= selectable_f f, :memory_min, memory_options(compute_resource.max_memory), {}, :class => 'form-control span2', :disabled => !fields_enabled, :label => 'Memory Min' %>
|
23
|
-
<%= selectable_f f, :memory_max, memory_options(compute_resource.max_memory), {}, :class => 'form-control span2', :disabled => !fields_enabled, :label => 'Memory Max' %>
|
29
|
+
<!--<%= 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' %>
|
24
33
|
</div>
|
25
34
|
</fieldset>
|
26
35
|
</div>
|
27
|
-
|
36
|
+
|
37
|
+
<!-- Templates -->
|
28
38
|
<div class="children_fields">
|
29
39
|
<%= field_set_tag 'VM Template', :id => 'xen_templates', :title => _('Template') do -%>
|
30
40
|
<%= render 'compute_resources_vms/form/templates', :f => f, :compute_resource => compute_resource, :new => new %>
|
@@ -38,7 +48,7 @@
|
|
38
48
|
<% end %>
|
39
49
|
</div>
|
40
50
|
|
41
|
-
<!--Storage-->
|
51
|
+
<!-- Storage -->
|
42
52
|
<div class="children_fields xenserver-raw" id="xenserver-storage" style="<%= hide_raw %>">
|
43
53
|
<%= field_set_tag 'Storage', :id => 'storage_volumes', :title => _('Storage') do -%>
|
44
54
|
<%= f.fields_for :VBDs do |i| %>
|
@@ -47,6 +57,7 @@
|
|
47
57
|
<% end -%>
|
48
58
|
</div>
|
49
59
|
|
60
|
+
<!-- Network -->
|
50
61
|
<div class="children_fields" id="xenserver-network" style="<%= hide_raw %>">
|
51
62
|
<%= field_set_tag 'Network interfaces', :id => 'network_interfaces', :title => _('Networks') do -%>
|
52
63
|
<%= f.fields_for :VIFs do |i| %>
|
@@ -55,22 +66,47 @@
|
|
55
66
|
<% end -%>
|
56
67
|
</div>
|
57
68
|
|
58
|
-
<div class="children_fields" id="xenserver-
|
59
|
-
<%= field_set_tag '
|
60
|
-
|
69
|
+
<div class="children_fields" id="xenserver-hosts" style="<%= hide_raw %>">
|
70
|
+
<%= 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 %>
|
61
72
|
<% end -%>
|
62
73
|
</div>
|
63
74
|
|
64
|
-
|
75
|
+
<!-- Startup -->
|
76
|
+
<div class="children_fields" id="xenserver-vm-start" style="<%= hide_raw %>">
|
77
|
+
<%= field_set_tag 'VM Startup Options', :id => 'vm_starup_options', :title => _('Power ON VM') do -%>
|
78
|
+
<%= checkbox_f f, :start, :checked => (compute_attributes['start'] == '1' || start_enable), :label => _("Power ON VM") %>
|
79
|
+
<% end -%>
|
80
|
+
</div>
|
65
81
|
|
66
82
|
<script type="text/javascript">
|
67
83
|
|
68
84
|
// Check if its a computer resource template then just do not show the form of XenStore
|
69
|
-
|
70
85
|
if ($("#compute_attribute_compute_profile_id").length > 0){
|
71
|
-
|
86
|
+
$('#xenserver-xenstore-data').hide(1)
|
87
|
+
}
|
88
|
+
|
89
|
+
// Check if custom template in use then do now show SR settings
|
90
|
+
if ($("#compute_attribute_vm_attrs_builtin_template_name").val() == "" && $("#compute_attribute_vm_attrs_custom_template_name").val() != ""){
|
91
|
+
$('.xenserver-raw').hide(1);
|
92
|
+
}
|
93
|
+
|
94
|
+
// Check which template are in use
|
95
|
+
if ($("#compute_attribute_vm_attrs_builtin_template_name").val() != "" ){
|
96
|
+
$('#compute_attribute_vm_attrs_custom_template_name').val($("#compute_attribute_vm_attrs_custom_template_name option:contains('No template')").val());
|
97
|
+
// IE and Chrome
|
98
|
+
$('#compute_attribute_vm_attrs_custom_template_name').attr("disabled", 'disabled');
|
99
|
+
$('.custom_template_name').prop("disabled", true);
|
72
100
|
}
|
73
101
|
|
102
|
+
if ($("#compute_attribute_vm_attrs_custom_template_name").val() != "" ){
|
103
|
+
$('#compute_attribute_vm_attrs_builtin_template_name').val($("#compute_attribute_vm_attrs_custom_template_name option:contains('No template')").val());
|
104
|
+
// IE and Chrome
|
105
|
+
$('#compute_attribute_vm_attrs_builtin_template_name').attr("disabled", 'disabled');
|
106
|
+
$('.buildin_templates').prop("disabled", true);
|
107
|
+
}
|
108
|
+
|
109
|
+
// Computer Profile Templates
|
74
110
|
$(document).off('change.xenserver', '#compute_attribute_vm_attrs_custom_template_name');
|
75
111
|
$(document).on('change.xenserver', '#compute_attribute_vm_attrs_custom_template_name', function (data) {
|
76
112
|
if ($('option:selected', data.target).val() == "") {
|
@@ -91,13 +127,37 @@
|
|
91
127
|
|
92
128
|
$(document).off('change.xenserver', '#compute_attribute_vm_attrs_builtin_template_name');
|
93
129
|
$(document).on('change.xenserver', '#compute_attribute_vm_attrs_builtin_template_name', function (data) {
|
94
|
-
$('.
|
95
|
-
|
96
|
-
|
130
|
+
if ($('option:selected', data.target).val() == "") {
|
131
|
+
// IE and Chrome
|
132
|
+
$('.buildin_templates').prop("disabled", false);
|
133
|
+
$('#compute_attribute_vm_attrs_custom_template_name').removeAttr('disabled');
|
134
|
+
} else {
|
135
|
+
$('#compute_attribute_vm_attrs_custom_template_name').val($("#compute_attribute_vm_attrs_custom_template_name option:contains('No template')").val());
|
136
|
+
// IE and Chrome
|
137
|
+
$('#compute_attribute_vm_attrs_custom_template_name').attr("disabled", 'disabled');
|
138
|
+
$('.custom_template_name').prop("disabled", true);
|
139
|
+
|
140
|
+
}
|
141
|
+
|
97
142
|
})
|
98
143
|
|
99
144
|
|
100
|
-
//
|
145
|
+
// Host Profile Forms
|
146
|
+
|
147
|
+
// Check which template are in use
|
148
|
+
if ($("#host_compute_attributes_custom_template_name").val() != "" ){
|
149
|
+
$('#host_compute_attributes_builtin_template_name').val($("#host_compute_attributes_builtin_template_name option:contains('No template')").val());
|
150
|
+
// IE and Chrome
|
151
|
+
$('#host_compute_attributes_builtin_template_name').attr("disabled", 'disabled');
|
152
|
+
$('.buildin_templates').prop("disabled", true);
|
153
|
+
}
|
154
|
+
|
155
|
+
if ($("#host_compute_attributes_builtin_template_name").val() != "" ){
|
156
|
+
$('#host_compute_attributes_custom_template_name').val($("#host_compute_attributes_custom_template_name option:contains('No template')").val());
|
157
|
+
// IE and Chrome
|
158
|
+
$('#host_compute_attributes_custom_template_name').attr("disabled", 'disabled');
|
159
|
+
$('.custom_template_name').prop("disabled", true);
|
160
|
+
}
|
101
161
|
|
102
162
|
$(document).off('change.xenserver', '#host_compute_attributes_custom_template_name');
|
103
163
|
$(document).on('change.xenserver', '#host_compute_attributes_custom_template_name', function (data) {
|
@@ -119,8 +179,21 @@
|
|
119
179
|
|
120
180
|
$(document).off('change.xenserver', '#host_compute_attributes_builtin_template_name');
|
121
181
|
$(document).on('change.xenserver', '#host_compute_attributes_builtin_template_name', function (data) {
|
122
|
-
|
123
|
-
|
124
|
-
|
182
|
+
if ($('option:selected', data.target).val() == "") {
|
183
|
+
// IE and Chrome
|
184
|
+
$('.buildin_templates').prop("disabled", false);
|
185
|
+
$('#host_compute_attributes_custom_template_name').removeAttr('disabled');
|
186
|
+
} else {
|
187
|
+
$('#host_compute_attributes_custom_template_name').val($("#host_compute_attributes_builtin_template_name option:contains('No template')").val());
|
188
|
+
// IE and Chrome
|
189
|
+
$('#host_compute_attributes_custom_template_name').attr("disabled", 'disabled');
|
190
|
+
$('.custom_template_name').prop("disabled", true);
|
191
|
+
|
192
|
+
}
|
125
193
|
})
|
126
|
-
</script>
|
194
|
+
</script>
|
195
|
+
|
196
|
+
<!--
|
197
|
+
<%= debug params -%>
|
198
|
+
<%= debug compute_attributes -%>
|
199
|
+
-->
|
data/lib/foreman_xen/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.3
|
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-
|
11
|
+
date: 2015-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -58,6 +58,7 @@ files:
|
|
58
58
|
- app/views/api/v2/compute_resources/xenserver.json.rabl
|
59
59
|
- app/views/compute_resources/form/_xenserver.html.erb
|
60
60
|
- app/views/compute_resources/show/_xenserver.html.erb
|
61
|
+
- app/views/compute_resources_vms/form/_hypervisors.html.erb
|
61
62
|
- app/views/compute_resources_vms/form/_network.html.erb
|
62
63
|
- app/views/compute_resources_vms/form/_templates.html.erb
|
63
64
|
- app/views/compute_resources_vms/form/_volume.html.erb
|
@@ -96,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
97
|
version: '0'
|
97
98
|
requirements: []
|
98
99
|
rubyforge_project:
|
99
|
-
rubygems_version: 2.
|
100
|
+
rubygems_version: 2.4.8
|
100
101
|
signing_key:
|
101
102
|
specification_version: 4
|
102
103
|
summary: Provision and manage XEN Server from Foreman
|