foreman_xen 0.7.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -1
- data/app/assets/javascripts/foreman_xen/xenserver/cache_refresh.js +31 -18
- data/app/controllers/foreman_xen/cache_controller.rb +8 -5
- data/app/helpers/xen_compute_helper.rb +8 -103
- data/app/models/concerns/fog_extensions/xenserver/host.rb +23 -0
- data/app/models/concerns/fog_extensions/xenserver/server.rb +21 -3
- data/app/models/concerns/fog_extensions/xenserver/storage_repository.rb +45 -0
- data/app/models/concerns/fog_extensions/xenserver/vdi.rb +11 -0
- data/app/models/concerns/foreman_xen/host_extensions.rb +17 -0
- data/app/models/foreman_xen/xenserver.rb +395 -172
- data/app/views/api/v1/compute_resources/xenserver.json.rabl +1 -1
- data/app/views/api/v2/compute_resources/xenserver.json.rabl +1 -1
- data/app/views/compute_resources/form/_xenserver.html.erb +2 -4
- data/app/views/compute_resources_vms/form/_hypervisors.html.erb +15 -11
- data/app/views/compute_resources_vms/form/_image_provisioning.html.erb +49 -0
- data/app/views/compute_resources_vms/form/_isos.html.erb +15 -0
- data/app/views/compute_resources_vms/form/_network_provisioning.html.erb +26 -0
- data/app/views/compute_resources_vms/form/_profile.html.erb +5 -0
- data/app/views/compute_resources_vms/form/_templates.html.erb +13 -34
- data/app/views/compute_resources_vms/form/xenserver/_base.html.erb +22 -178
- data/app/views/compute_resources_vms/form/xenserver/_network.html.erb +23 -0
- data/app/views/compute_resources_vms/form/xenserver/_volume.html.erb +15 -0
- data/app/views/compute_resources_vms/index/_xenserver.html.erb +1 -1
- data/app/views/images/form/_xenserver.html.erb +4 -0
- data/lib/foreman_xen/engine.rb +14 -3
- data/lib/foreman_xen/version.rb +1 -1
- data/test/test_helper.rb +1 -3
- metadata +14 -7
- data/app/assets/javascripts/foreman_xen/xenserver/populate_fields.js +0 -32
- data/app/views/compute_resources_vms/form/_network.html.erb +0 -20
- data/app/views/compute_resources_vms/form/_volume.html.erb +0 -18
- data/app/views/compute_resources_vms/form/_xenstore.html.erb +0 -119
@@ -1 +1 @@
|
|
1
|
-
attributes :user
|
1
|
+
attributes :user, :iso_library_mountpoint
|
@@ -1 +1 @@
|
|
1
|
-
attributes :user
|
1
|
+
attributes :user, :iso_library_mountpoint
|
@@ -1,11 +1,9 @@
|
|
1
1
|
<%= text_f f, :url, :class => "input-xlarge", :help_block => _("e.g. x.x.x.x") %>
|
2
2
|
<%= text_f f, :user %>
|
3
3
|
<%= password_f f, :password %>
|
4
|
-
|
4
|
+
<%= text_f f, :iso_library_mountpoint %>
|
5
5
|
<% hypervisor = f.object.hypervisor.uuid rescue nil %>
|
6
6
|
<% if hypervisor -%>
|
7
7
|
<%= f.hidden_field :uuid, :value => hypervisor %>
|
8
8
|
<% end -%>
|
9
|
-
<%=
|
10
|
-
|
11
|
-
<%= hidden_spinner('', :id => 'test_connection_indicator') %>
|
9
|
+
<%= test_connection_button_f(f, !hypervisor.nil?) %>
|
@@ -1,12 +1,16 @@
|
|
1
|
-
<div id='
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
<div id='hypervisor_selection'>
|
2
|
+
<%= selectable_f_with_cache_invalidation(f, :hypervisor_host,
|
3
|
+
options_from_collection_for_select(
|
4
|
+
compute_resource.available_hypervisors, :uuid, :display_name
|
5
|
+
),
|
6
|
+
{ include_blank: 'Automatic allocation' },
|
7
|
+
{ class: "span2",
|
8
|
+
disabled: (controller_name != 'hosts'),
|
9
|
+
label: _("Hypervisor"), },
|
10
|
+
{ title: 'Refresh available hypervisors',
|
11
|
+
url: url_for(controller: "foreman_xen/cache",
|
12
|
+
action: "refresh", only_path: true),
|
13
|
+
compute_resource_id: compute_resource.id,
|
14
|
+
attribute: 'available_hypervisors' }
|
15
|
+
) %>
|
12
16
|
</div>
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<div class="image_fields" style="display:none">
|
2
|
+
<div id='image_selection'>
|
3
|
+
<%= select_f f, :image_id, images, :uuid, :name,
|
4
|
+
{ :include_blank => (images.empty? || images.size == 1) ? false : _('Please select an image') },
|
5
|
+
{ :disabled => images.empty?, :label => _('Image'), :label_size => "col-md-2" } %>
|
6
|
+
</div>
|
7
|
+
<div id="target_sr_selection">
|
8
|
+
<%= selectable_f_with_cache_invalidation(f, :target_sr,
|
9
|
+
options_from_collection_for_select(
|
10
|
+
compute_resource.storage_pools, :uuid, :display_name
|
11
|
+
),
|
12
|
+
{},
|
13
|
+
{ class: "span2",
|
14
|
+
label: _("Target Repository"), },
|
15
|
+
{ title: 'Refresh available storage repositories',
|
16
|
+
url: url_for(controller: "foreman_xen/cache",
|
17
|
+
action: "refresh", only_path: true),
|
18
|
+
compute_resource_id: compute_resource.id,
|
19
|
+
attribute: 'storage_pools' }
|
20
|
+
) %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<% if compute_resource.iso_library_mountpoint %>
|
24
|
+
|
25
|
+
<div id="configdrive">
|
26
|
+
<%= checkbox_f(f, :configdrive,
|
27
|
+
{ checked: true, label: _('Metadata ISO'),
|
28
|
+
help_inline: 'Attach cloud-init compatible configdrive' }
|
29
|
+
)%>
|
30
|
+
</div>
|
31
|
+
<%= javascript_tag("
|
32
|
+
$(document).on('change', '#host_provision_method_image', function(){
|
33
|
+
if ($('#host_provision_method_image').is(':checked')) {
|
34
|
+
$('#configdrive').appendTo($('#image_provisioning'));
|
35
|
+
$('#configdrive').show();
|
36
|
+
}
|
37
|
+
});
|
38
|
+
") %>
|
39
|
+
|
40
|
+
<%end%>
|
41
|
+
</div>
|
42
|
+
<%= javascript_tag("
|
43
|
+
$(document).on('change', '#host_provision_method_image', function(){
|
44
|
+
if ($('#host_provision_method_image').is(':checked')) {
|
45
|
+
$('#target_sr_selection').appendTo($('#image_provisioning'));
|
46
|
+
$('#target_sr_selection').show();
|
47
|
+
}
|
48
|
+
});
|
49
|
+
"); %>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div id="iso_selection">
|
2
|
+
<%= selectable_f_with_cache_invalidation(f, :iso,
|
3
|
+
options_from_collection_for_select(
|
4
|
+
compute_resource.isos, :uuid, :name, compute_attributes.dig(:iso)
|
5
|
+
),
|
6
|
+
{ prompt: 'Select ISO to attach' },
|
7
|
+
{ class: "span2",
|
8
|
+
label: _('Attach ISO'), },
|
9
|
+
{ title: 'Refresh available storage repositories',
|
10
|
+
url: url_for(controller: "foreman_xen/cache",
|
11
|
+
action: "refresh", only_path: true),
|
12
|
+
compute_resource_id: compute_resource.id,
|
13
|
+
attribute: 'isos' }
|
14
|
+
) %>
|
15
|
+
</div>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<!-- VM Template -->
|
2
|
+
<div class="network_fields" style="display:none">
|
3
|
+
<div id="vm_template_selection">
|
4
|
+
<%= selectable_f_with_cache_invalidation(f, :builtin_template,
|
5
|
+
options_from_collection_for_select(
|
6
|
+
compute_resource.builtin_templates, :uuid, :name
|
7
|
+
),
|
8
|
+
{ selected: nil, #TODO
|
9
|
+
prompt: 'No Template'},
|
10
|
+
{ class: 'span2', label: 'VM Template' },
|
11
|
+
{ title: 'Refresh available builtin templates',
|
12
|
+
url: url_for(controller: "foreman_xen/cache",
|
13
|
+
action: "refresh", only_path: true),
|
14
|
+
compute_resource_id: compute_resource.id,
|
15
|
+
attribute: 'builtin_templates' }
|
16
|
+
) %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<%= javascript_tag("
|
20
|
+
$(document).ready(function(){
|
21
|
+
if (!$('#network_provisioning').has('#vm_template_selection').length) {
|
22
|
+
$('#vm_template_selection').appendTo($('#network_provisioning'));
|
23
|
+
$('#vm_template_selection').show();
|
24
|
+
}
|
25
|
+
});
|
26
|
+
") %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<div class="fields">
|
2
|
+
<%= counter_f f, :vcpus_max, :label => _('vCPUs'), :label_size => 'col-md-2', :'data-soft-max' => compute_resource.max_cpu_count %>
|
3
|
+
<%= byte_size_f f, :memory_min, :label => _('Memory Min'), :label_size => "col-md-2", :'data-soft-max' => compute_resource.max_memory %>
|
4
|
+
<%= byte_size_f f, :memory_max, :label => _('Memory Max'), :label_size => "col-md-2", :'data-soft-max' => compute_resource.max_memory %>
|
5
|
+
</div>
|
@@ -1,39 +1,18 @@
|
|
1
1
|
<div class="fields">
|
2
|
-
<div id='templates'
|
3
|
-
<div class="form-group">
|
4
|
-
<%= selectable_f_with_cache_invalidation f,
|
5
|
-
:custom_template_name,
|
6
|
-
[[_("No template"), ""]] + xen_custom_template_map(compute_resource),
|
7
|
-
{ :selected => attribute_map[:template_selected_custom] },
|
8
|
-
{ :class => 'form-control span2',
|
9
|
-
:label => 'Custom Template'
|
10
|
-
},
|
11
|
-
{
|
12
|
-
:callback => 'xenPopulateCustomTemplates',
|
13
|
-
:title => 'Refresh available custom templates',
|
14
|
-
:url => '/foreman_xen/cache/refresh',
|
15
|
-
:computer_resource_id => compute_resource.id,
|
16
|
-
:attribute => 'custom_templates'
|
17
|
-
}
|
18
|
-
%>
|
19
|
-
</div>
|
20
|
-
|
2
|
+
<div id='templates'>
|
21
3
|
<div class="form-group ">
|
22
|
-
<%= selectable_f_with_cache_invalidation
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
:attribute => 'builtin_templates'
|
35
|
-
}
|
36
|
-
%>
|
4
|
+
<%= selectable_f_with_cache_invalidation(f, :builtin_template,
|
5
|
+
options_from_collection_for_select(
|
6
|
+
compute_resource.builtin_templates, :uuid, :name
|
7
|
+
),
|
8
|
+
{ prompt: 'Select a Template'},
|
9
|
+
{ class: 'span2', label: 'Builtin Template' },
|
10
|
+
{ title: 'Refresh available builtin templates',
|
11
|
+
url: url_for(controller: "foreman_xen/cache",
|
12
|
+
action: "refresh", only_path: true),
|
13
|
+
compute_resource_id: compute_resource.id,
|
14
|
+
attribute: 'builtin_templates' }
|
15
|
+
) %>
|
37
16
|
</div>
|
38
17
|
</div>
|
39
18
|
</div>
|
@@ -1,196 +1,40 @@
|
|
1
|
-
<%
|
2
|
-
|
3
|
-
|
4
|
-
hide_raw = ''
|
5
|
-
if params && params['host'] && params['host']['compute_attributes'] && params['host']['compute_attributes']['custom_template_name'] != ''
|
6
|
-
hide_raw = 'display:none;'
|
7
|
-
end
|
8
|
-
|
9
|
-
if controller_name == 'hosts'
|
10
|
-
fields_enabled = true
|
11
|
-
start_enable = true
|
12
|
-
elsif controller_name == 'compute_attributes'
|
13
|
-
fields_enabled = true
|
14
|
-
compute_attributes = compute_resource.compute_profile_attributes_for(params['compute_profile_id'])
|
15
|
-
name = compute_attributes['name']
|
16
|
-
else
|
17
|
-
fields_enabled = false
|
18
|
-
end
|
19
|
-
|
20
|
-
-%>
|
1
|
+
<% compute_attributes = compute_attributes_from_params(compute_resource) -%>
|
2
|
+
<%= javascript_include_tag 'foreman_xen/xenserver/cache_refresh' %>
|
21
3
|
<%= javascript_tag("$(document).on('ContentLoad', tfm.numFields.initAll)"); %>
|
22
|
-
<!-- VM Initial Settings -->
|
23
|
-
<div class="children_fields">
|
24
|
-
<fieldset id="vm_profile">
|
25
|
-
<legend>VM Profile</legend>
|
26
|
-
<div class="fields">
|
27
|
-
<!--<%= text_f f, :name, :disabled => !fields_enabled, :value => name, :label => 'Name' if controller_name != 'hosts' %>-->
|
28
|
-
<%= counter_f f, :vcpus_max, :disabled => !fields_enabled, :label => _('vCPUs'), :label_size => 'col-md-2', :'data-soft-max' => compute_resource.max_cpu_count %>
|
29
|
-
<%= byte_size_f f, :memory_min, :disabled => !fields_enabled, :label => _('Memory Min'), :label_size => "col-md-2", :'data-soft-max' => compute_resource.max_memory %>
|
30
|
-
<%= byte_size_f f, :memory_max, :disabled => !fields_enabled, :label => _('Memory Max'), :label_size => "col-md-2", :'data-soft-max' => compute_resource.max_memory %>
|
31
|
-
</div>
|
32
|
-
</fieldset>
|
33
|
-
</div>
|
34
4
|
|
35
|
-
<!--
|
5
|
+
<!-- VM Profile -->
|
36
6
|
<div class="children_fields">
|
37
|
-
<%= field_set_tag 'VM
|
38
|
-
<%= render 'compute_resources_vms/form/
|
39
|
-
<% end -%>
|
40
|
-
</div>
|
41
|
-
|
42
|
-
<!-- XenStore Data -->
|
43
|
-
<div class="children_fields" id="xenserver-xenstore-data">
|
44
|
-
<%= field_set_tag 'Xen Store Data', :id => 'xen_store_data', :title => _('Xen Store Data') do -%>
|
45
|
-
<%= render 'compute_resources_vms/form/xenstore', :f => f, :compute_resource => compute_resource, :new => new, :attribute_map => attribute_map %>
|
46
|
-
<% end %>
|
47
|
-
</div>
|
48
|
-
|
49
|
-
<!-- Storage -->
|
50
|
-
<div class="children_fields xenserver-raw" id="xenserver-storage" style="<%= hide_raw %>">
|
51
|
-
<%= field_set_tag 'Storage', :id => 'storage_volumes', :title => _('Storage') do -%>
|
52
|
-
<%= f.fields_for :VBDs do |i| %>
|
53
|
-
<%= render 'compute_resources_vms/form/volume', :f => i, :compute_resource => compute_resource, :new => new, :attribute_map => attribute_map %>
|
54
|
-
<% end -%>
|
7
|
+
<%= field_set_tag 'VM Profile', :id => 'vm_profile', :title => _('VM Profile') do -%>
|
8
|
+
<%= render 'compute_resources_vms/form/profile', :f => f, :compute_resource => compute_resource %>
|
55
9
|
<% end -%>
|
56
|
-
<%= checkbox_f f, :xstools, :checked => false, :label => _('Insert XS Tools ISO Drive') %>
|
57
10
|
</div>
|
58
11
|
|
59
|
-
<!--
|
60
|
-
<div class="children_fields"
|
61
|
-
<%= field_set_tag '
|
62
|
-
<%= f
|
63
|
-
<%= render 'compute_resources_vms/form/network', :f => i, :compute_resource => compute_resource, :new => new, :attribute_map => attribute_map %>
|
64
|
-
<% end -%>
|
12
|
+
<!-- ISOs -->
|
13
|
+
<div class="children_fields">
|
14
|
+
<%= field_set_tag 'Attach ISO', :id => 'xen_isos', :title => _('ISOs') do -%>
|
15
|
+
<%= render 'compute_resources_vms/form/isos', :f => f, :compute_resource => compute_resource, compute_attributes: compute_attributes %>
|
65
16
|
<% end -%>
|
66
17
|
</div>
|
67
18
|
|
68
|
-
|
19
|
+
<!-- Hypervisor -->
|
20
|
+
<div class="children_fields" id="xenserver-hosts">
|
69
21
|
<%= field_set_tag 'Start on server', :id => 'xen_hypervisors', :title => _('Start on server') do -%>
|
70
|
-
<%= render 'compute_resources_vms/form/hypervisors', :f => f, :compute_resource => compute_resource
|
22
|
+
<%= render 'compute_resources_vms/form/hypervisors', :f => f, :compute_resource => compute_resource %>
|
71
23
|
<% end -%>
|
72
24
|
</div>
|
73
25
|
|
74
26
|
<!-- Startup -->
|
75
|
-
|
27
|
+
<% start_checked = compute_attributes.dig(:start) == '0' ? false : true -%>
|
28
|
+
<div class="children_fields" id="xenserver-vm-start">
|
76
29
|
<%= field_set_tag 'VM Startup Options', :id => 'vm_startup_options', :title => _('Power ON VM') do -%>
|
77
|
-
<%= checkbox_f f, :start, :checked =>
|
30
|
+
<%= checkbox_f f, :start, :checked => start_checked, :label => _("Power ON VM") %>
|
78
31
|
<% end -%>
|
79
32
|
</div>
|
80
33
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
// Check if custom template in use then do now show SR settings
|
89
|
-
if ($("#compute_attribute_vm_attrs_builtin_template_name").val() == "" && $("#compute_attribute_vm_attrs_custom_template_name").val() != "") {
|
90
|
-
$('.xenserver-raw').hide(1);
|
91
|
-
}
|
92
|
-
|
93
|
-
// Check which template are in use
|
94
|
-
if ($("#compute_attribute_vm_attrs_builtin_template_name").val() != "") {
|
95
|
-
$('#compute_attribute_vm_attrs_custom_template_name').val($("#compute_attribute_vm_attrs_custom_template_name option:contains('No template')").val());
|
96
|
-
// IE and Chrome
|
97
|
-
$('#compute_attribute_vm_attrs_custom_template_name').attr("disabled", 'disabled');
|
98
|
-
$('.custom_template_name').prop("disabled", true);
|
99
|
-
}
|
100
|
-
|
101
|
-
if ($("#compute_attribute_vm_attrs_custom_template_name").val() != "") {
|
102
|
-
$('#compute_attribute_vm_attrs_builtin_template_name').val($("#compute_attribute_vm_attrs_custom_template_name option:contains('No template')").val());
|
103
|
-
// IE and Chrome
|
104
|
-
$('#compute_attribute_vm_attrs_builtin_template_name').attr("disabled", 'disabled');
|
105
|
-
$('.builtin_templates').prop("disabled", true);
|
106
|
-
}
|
107
|
-
|
108
|
-
// Computer Profile Templates
|
109
|
-
$(document).off('change.xenserver', '#compute_attribute_vm_attrs_custom_template_name');
|
110
|
-
$(document).on('change.xenserver', '#compute_attribute_vm_attrs_custom_template_name', function (data) {
|
111
|
-
if ($('option:selected', data.target).val() == "") {
|
112
|
-
$('.xenserver-raw').show(1000);
|
113
|
-
// IE and Chrome
|
114
|
-
$('.builtin_templates').prop("disabled", false);
|
115
|
-
$('#compute_attribute_vm_attrs_builtin_template_name').removeAttr('disabled');
|
116
|
-
} else {
|
117
|
-
$('.xenserver-raw').hide(1000);
|
118
|
-
$('#compute_attribute_vm_attrs_builtin_template_name').val($("#compute_attribute_vm_attrs_builtin_template_name option:contains('No template')").val());
|
119
|
-
// IE and Chrome
|
120
|
-
$('#compute_attribute_vm_attrs_builtin_template_name').attr("disabled", 'disabled');
|
121
|
-
$('.builtin_templates').prop("disabled", true);
|
122
|
-
|
123
|
-
}
|
124
|
-
|
125
|
-
});
|
126
|
-
|
127
|
-
$(document).off('change.xenserver', '#compute_attribute_vm_attrs_builtin_template_name');
|
128
|
-
$(document).on('change.xenserver', '#compute_attribute_vm_attrs_builtin_template_name', function (data) {
|
129
|
-
if ($('option:selected', data.target).val() == "") {
|
130
|
-
// IE and Chrome
|
131
|
-
$('.builtin_templates').prop("disabled", false);
|
132
|
-
$('#compute_attribute_vm_attrs_custom_template_name').removeAttr('disabled');
|
133
|
-
} else {
|
134
|
-
$('#compute_attribute_vm_attrs_custom_template_name').val($("#compute_attribute_vm_attrs_custom_template_name option:contains('No template')").val());
|
135
|
-
// IE and Chrome
|
136
|
-
$('#compute_attribute_vm_attrs_custom_template_name').attr("disabled", 'disabled');
|
137
|
-
$('.custom_template_name').prop("disabled", true);
|
138
|
-
|
139
|
-
}
|
140
|
-
|
141
|
-
});
|
142
|
-
|
143
|
-
|
144
|
-
// Host Profile Forms
|
145
|
-
|
146
|
-
// Check which template are in use
|
147
|
-
if ($("#host_compute_attributes_custom_template_name").val() != "") {
|
148
|
-
$('#host_compute_attributes_builtin_template_name').val($("#host_compute_attributes_builtin_template_name option:contains('No template')").val());
|
149
|
-
// IE and Chrome
|
150
|
-
$('#host_compute_attributes_builtin_template_name').attr("disabled", 'disabled');
|
151
|
-
$('.builtin_templates').prop("disabled", true);
|
152
|
-
}
|
153
|
-
|
154
|
-
if ($("#host_compute_attributes_builtin_template_name").val() != "") {
|
155
|
-
$('#host_compute_attributes_custom_template_name').val($("#host_compute_attributes_custom_template_name option:contains('No template')").val());
|
156
|
-
// IE and Chrome
|
157
|
-
$('#host_compute_attributes_custom_template_name').attr("disabled", 'disabled');
|
158
|
-
$('.custom_template_name').prop("disabled", true);
|
159
|
-
}
|
160
|
-
|
161
|
-
$(document).off('change.xenserver', '#host_compute_attributes_custom_template_name');
|
162
|
-
$(document).on('change.xenserver', '#host_compute_attributes_custom_template_name', function (data) {
|
163
|
-
if ($('option:selected', data.target).val() == "") {
|
164
|
-
$('.xenserver-raw').show(1000);
|
165
|
-
// IE and Chrome
|
166
|
-
$('.builtin_templates').prop("disabled", false);
|
167
|
-
$('#host_compute_attributes_builtin_template_name').removeAttr('disabled');
|
168
|
-
} else {
|
169
|
-
$('.xenserver-raw').hide(1000);
|
170
|
-
$('#host_compute_attributes_builtin_template_name').val($("#host_compute_attributes_builtin_template_name option:contains('No template')").val());
|
171
|
-
// IE and Chrome
|
172
|
-
$('#host_compute_attributes_builtin_template_name').attr("disabled", 'disabled');
|
173
|
-
$('.builtin_templates').prop("disabled", true);
|
174
|
-
|
175
|
-
}
|
176
|
-
|
177
|
-
});
|
178
|
-
|
179
|
-
$(document).off('change.xenserver', '#host_compute_attributes_builtin_template_name');
|
180
|
-
$(document).on('change.xenserver', '#host_compute_attributes_builtin_template_name', function (data) {
|
181
|
-
if ($('option:selected', data.target).val() == "") {
|
182
|
-
// IE and Chrome
|
183
|
-
$('.builtin_templates').prop("disabled", false);
|
184
|
-
$('#host_compute_attributes_custom_template_name').removeAttr('disabled');
|
185
|
-
} else {
|
186
|
-
$('#host_compute_attributes_custom_template_name').val($("#host_compute_attributes_builtin_template_name option:contains('No template')").val());
|
187
|
-
// IE and Chrome
|
188
|
-
$('#host_compute_attributes_custom_template_name').attr("disabled", 'disabled');
|
189
|
-
$('.custom_template_name').prop("disabled", true);
|
190
|
-
|
191
|
-
}
|
192
|
-
})
|
193
|
-
</script>
|
194
|
-
|
195
|
-
<%= compute_specific_js(compute_resource, 'foreman_xen/cache_refresh') %>
|
196
|
-
<%= compute_specific_js(compute_resource, 'foreman_xen/populate_fields') %>
|
34
|
+
<!-- Provisioning -->
|
35
|
+
<%
|
36
|
+
arch ||= nil ; os ||= nil
|
37
|
+
images = possible_images(compute_resource, arch, os)
|
38
|
+
%>
|
39
|
+
<%= render 'compute_resources_vms/form/image_provisioning', f: f, compute_resource: compute_resource, images: images %>
|
40
|
+
<%= render 'compute_resources_vms/form/network_provisioning', f: f, compute_resource: compute_resource %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<div class="fields">
|
2
|
+
<div id='xenserver_network'>
|
3
|
+
<%= selectable_f_with_cache_invalidation f, :network,
|
4
|
+
options_from_collection_for_select(
|
5
|
+
compute_resource.networks, :uuid, :name
|
6
|
+
),
|
7
|
+
{ include_blank: compute_resource.networks.any? ? false : _('No networks') },
|
8
|
+
{ class: 'span2',
|
9
|
+
label: _('Network'),
|
10
|
+
label_size: 'col-md-3',
|
11
|
+
sizer: 'col-md-8',
|
12
|
+
disabled: (controller_name != 'hosts') },
|
13
|
+
{ title: 'Refresh available networks',
|
14
|
+
url: url_for(controller: "foreman_xen/cache",
|
15
|
+
action: "refresh", only_path: true),
|
16
|
+
compute_resource_id: compute_resource.id,
|
17
|
+
attribute: 'networks' }
|
18
|
+
%>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<%= javascript_tag("
|
22
|
+
$(document).ready(function(){ $('#network_interfaces').hide(); });
|
23
|
+
") if controller_name != 'hosts' %>
|