foreman_fog_proxmox 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of foreman_fog_proxmox might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +290 -0
- data/Rakefile +49 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_compute_resource.js +33 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +187 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_container.js +24 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_server.js +125 -0
- data/app/controllers/concerns/foreman_fog_proxmox/controller/parameters/compute_resource.rb +41 -0
- data/app/controllers/foreman_fog_proxmox/compute_resources_controller.rb +86 -0
- data/app/helpers/node_dashboard_helper.rb +35 -0
- data/app/helpers/proxmox_compute_selectors_helper.rb +184 -0
- data/app/helpers/proxmox_container_helper.rb +163 -0
- data/app/helpers/proxmox_form_helper.rb +70 -0
- data/app/helpers/proxmox_server_helper.rb +155 -0
- data/app/helpers/proxmox_vm_helper.rb +88 -0
- data/app/models/concerns/fog_extensions/proxmox/disk.rb +29 -0
- data/app/models/concerns/fog_extensions/proxmox/interface.rb +40 -0
- data/app/models/concerns/fog_extensions/proxmox/node.rb +41 -0
- data/app/models/concerns/fog_extensions/proxmox/server.rb +93 -0
- data/app/models/concerns/fog_extensions/proxmox/server_config.rb +71 -0
- data/app/models/concerns/fog_extensions/proxmox/volume.rb +29 -0
- data/app/models/concerns/host_ext/proxmox/interfaces.rb +52 -0
- data/app/models/concerns/orchestration/proxmox/compute.rb +42 -0
- data/app/models/foreman_fog_proxmox/options_select.rb +36 -0
- data/app/models/foreman_fog_proxmox/proxmox.rb +133 -0
- data/app/models/foreman_fog_proxmox/proxmox_compute_attributes.rb +67 -0
- data/app/models/foreman_fog_proxmox/proxmox_connection.rb +67 -0
- data/app/models/foreman_fog_proxmox/proxmox_console.rb +41 -0
- data/app/models/foreman_fog_proxmox/proxmox_images.rb +61 -0
- data/app/models/foreman_fog_proxmox/proxmox_interfaces.rb +103 -0
- data/app/models/foreman_fog_proxmox/proxmox_operating_systems.rb +49 -0
- data/app/models/foreman_fog_proxmox/proxmox_pools.rb +56 -0
- data/app/models/foreman_fog_proxmox/proxmox_token_expiration.rb +30 -0
- data/app/models/foreman_fog_proxmox/proxmox_version.rb +36 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb +116 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_new.rb +178 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_queries.rb +75 -0
- data/app/models/foreman_fog_proxmox/proxmox_volumes.rb +94 -0
- data/app/models/foreman_fog_proxmox/vms.rb +37 -0
- data/app/overrides/compute_resources_vms/form/add_clone_to_new_vm_compute_detail.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_from_profile_to_compute_attributes_form.rb +34 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_node_to_new_form.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_networks_form.rb +34 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_nic_provider_specific_form.rb +26 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_edit.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_new_volume.rb +25 -0
- data/app/overrides/compute_resources_vms/form/remove_new_vm_from_removable_layout.rb +25 -0
- data/app/services/foreman_fog_proxmox/node_dashboard/data.rb +37 -0
- data/app/views/api/v2/compute_resources/proxmox.json.rabl +3 -0
- data/app/views/compute_resources/form/_proxmox.html.erb +29 -0
- data/app/views/compute_resources/show/_proxmox.html.erb +37 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_attributes_form.html.erb +23 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_form.html.erb +23 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_hosts_compute_detail_form.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_node_to_new_form.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_form.html.erb +28 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_new_childs_form.html.erb +32 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_nic_provider_specific_form.html.erb +30 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_volumes_edit.html.erb +71 -0
- data/app/views/compute_resources_vms/form/proxmox/_base.html.erb +39 -0
- data/app/views/compute_resources_vms/form/proxmox/_general.html.erb +39 -0
- data/app/views/compute_resources_vms/form/proxmox/_network.html.erb +19 -0
- data/app/views/compute_resources_vms/form/proxmox/_removable_layout.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_advanced.html.erb +31 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_config.html.erb +41 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_extended.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_network.html.erb +33 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_volume_mp.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_volume_rootfs.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_advanced.html.erb +31 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_config.html.erb +60 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_network.html.erb +30 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_volume.html.erb +28 -0
- data/app/views/compute_resources_vms/index/_proxmox.html.erb +49 -0
- data/app/views/compute_resources_vms/show/_proxmox.html.erb +42 -0
- data/app/views/dashboard/_foreman_fog_proxmox_widget.erb +21 -0
- data/app/views/images/form/_proxmox.html.erb +21 -0
- data/config/routes.rb +30 -0
- data/lib/foreman_fog_proxmox.rb +23 -0
- data/lib/foreman_fog_proxmox/engine.rb +105 -0
- data/lib/foreman_fog_proxmox/semver.rb +102 -0
- data/lib/foreman_fog_proxmox/value.rb +26 -0
- data/lib/foreman_fog_proxmox/version.rb +22 -0
- data/lib/tasks/foreman_fog_proxmox_tasks.rake +37 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_fog_proxmox.po +401 -0
- data/locale/foreman_fog_proxmox.pot +627 -0
- data/locale/fr/foreman_fog_proxmox.po +401 -0
- data/locale/gemspec.rb +4 -0
- data/test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb +137 -0
- data/test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb +87 -0
- data/test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb +134 -0
- data/test/factories/proxmox_factory.rb +79 -0
- data/test/functional/compute_resources_controller_test.rb +48 -0
- data/test/test_plugin_helper.rb +19 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb +204 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb +149 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb +216 -0
- data/test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb +124 -0
- data/test/unit/foreman_fog_proxmox/proxmox_images_test.rb +52 -0
- data/test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb +117 -0
- data/test/unit/foreman_fog_proxmox/proxmox_test.rb +58 -0
- data/test/unit/foreman_fog_proxmox/proxmox_version_test.rb +94 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb +280 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb +110 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb +222 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_volumes_test.rb +308 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb +43 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb +71 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb +68 -0
- data/test/unit/foreman_fog_proxmox/semver_test.rb +111 -0
- metadata +249 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
<% if compute_resource.class == ForemanFogProxmox::Proxmox %>
|
18
|
+
<% vm_type = f.object.respond_to?('type') ? f.object.type : nil %>
|
19
|
+
<% node_id = f.object.respond_to?('node_id') ? f.object.node_id : nil %>
|
20
|
+
|
21
|
+
<%= render :partial => 'compute_resources_vms/form/networks', :locals => { :f => f, :compute_resource => @compute_resource, :new_host => true, :new_vm => true, :item_layout => 'removable', :vm_type => vm_type, :node_id => node_id } %>
|
22
|
+
<% else %>
|
23
|
+
<%= render :partial => 'compute_resources_vms/form/networks', :locals => { :f => f, :compute_resource => @compute_resource, :new_host => true, :new_vm => true, :item_layout => 'removable' } %>
|
24
|
+
<% end %>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
<% if compute_resource.class == ForemanFogProxmox::Proxmox %>
|
18
|
+
<% vm_type = f.object.respond_to?('type') ? f.object.type : nil %>
|
19
|
+
<% node_id = f.object.respond_to?('node_id') ? f.object.node_id : nil %>
|
20
|
+
|
21
|
+
<%= render :partial => provider_partial(compute_resource, 'network'),
|
22
|
+
:locals => { :f => i, :vm_type => vm_type, :node_id => node_id, :compute_resource => compute_resource, :new_host => new_host, :new_vm => new_vm, :remove_title => _('remove network interface'), :selected_cluster => selected_cluster },
|
23
|
+
:layout => 'compute_resources_vms/form/deletable_layout' %>
|
24
|
+
<% else %>
|
25
|
+
<%= render :partial => provider_partial(compute_resource, 'network'),
|
26
|
+
:locals => { :f => i, :compute_resource => compute_resource, :new_host => new_host, :new_vm => new_vm, :remove_title => _('remove network interface'), :selected_cluster => selected_cluster },
|
27
|
+
:layout => 'compute_resources_vms/form/deletable_layout' %>
|
28
|
+
<% end %>
|
data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_new_childs_form.html.erb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
<% if compute_resource.class == ForemanFogProxmox::Proxmox %>
|
18
|
+
<% vm_type = f.object.respond_to?('type') ? f.object.type : nil %>
|
19
|
+
<% node_id = f.object.respond_to?('node_id') ? f.object.node_id : nil %>
|
20
|
+
|
21
|
+
<%= new_child_fields_template(f, compute_resource.interfaces_attrs_name, {
|
22
|
+
:object => compute_resource.new_interface,
|
23
|
+
:partial => provider_partial(compute_resource, 'network'),
|
24
|
+
:form_builder_attrs => { :vm_type => vm_type, :node_id => node_id, :compute_resource => compute_resource, :new_host => new_host, :new_vm => new_vm, :remove_title => _('remove network interface') },
|
25
|
+
:layout => 'compute_resources_vms/form/deletable_layout' }) %>
|
26
|
+
<% else %>
|
27
|
+
<%= new_child_fields_template(f, compute_resource.interfaces_attrs_name, {
|
28
|
+
:object => compute_resource.new_interface,
|
29
|
+
:partial => provider_partial(compute_resource, 'network'),
|
30
|
+
:form_builder_attrs => { :compute_resource => compute_resource, :new_host => new_host, :new_vm => new_vm, :remove_title => _('remove network interface') },
|
31
|
+
:layout => 'compute_resources_vms/form/deletable_layout' }) %>
|
32
|
+
<% end %>
|
@@ -0,0 +1,30 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
<% if @host.compute_resource.class == ForemanFogProxmox::Proxmox %>
|
18
|
+
<% compute_attributes = f.object.compute_attributes %>
|
19
|
+
<% vm_type = f.object.respond_to?('type') ? f.object.type : nil %>
|
20
|
+
<% node_id = f.object.respond_to?('node_id') ? f.object.node_id : nil %>
|
21
|
+
|
22
|
+
<%= f.fields_for 'compute_attributes', OpenStruct.new(f.object.compute_attributes) do |f| %>
|
23
|
+
<%= render provider_partial(@host.compute_resource, 'network'), :f => f, :vm_type => vm_type, :node_id => node_id, :disabled => f.object.persisted?, :compute_resource => @host.compute_resource, :new_host => new_vm, :new_vm => new_vm %>
|
24
|
+
<% end %>
|
25
|
+
<% else %>
|
26
|
+
<%= f.fields_for 'compute_attributes', OpenStruct.new(f.object.compute_attributes) do |f| %>
|
27
|
+
<%= render provider_partial(@host.compute_resource, 'network'), :f => f, :disabled => f.object.persisted?, :compute_resource => @host.compute_resource, :new_host => new_vm, :new_vm => new_vm %>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
<% if compute_resource.class == ForemanFogProxmox::Proxmox %>
|
18
|
+
<% type = f.object.type %>
|
19
|
+
<% node_id = f.object.node_id %>
|
20
|
+
<% server = type == 'qemu' %>
|
21
|
+
<% container = type == 'lxc' %>
|
22
|
+
|
23
|
+
<%= new_child_fields_template_typed(f, :volumes, {
|
24
|
+
:type => 'server',
|
25
|
+
:object => compute_resource.new_volume_server,
|
26
|
+
:partial => provider_partial(compute_resource, 'server/volume'),
|
27
|
+
:form_builder_attrs => { :type => type, :node_id => node_id, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') },
|
28
|
+
:layout => "compute_resources_vms/form/#{item_layout}_layout" }) %>
|
29
|
+
<%= new_child_fields_template_typed(f, :volumes, {
|
30
|
+
:type => 'container',
|
31
|
+
:object => compute_resource.new_volume_container(id: 'mp0'),
|
32
|
+
:partial => provider_partial(compute_resource, 'container/volume_mp'),
|
33
|
+
:form_builder_attrs => { :type => type, :node_id => node_id, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') },
|
34
|
+
:layout => "compute_resources_vms/form/#{item_layout}_layout" }) %>
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
<%= f.fields_for :volumes do |i| %>
|
39
|
+
<% if i.object.rootfs? %>
|
40
|
+
<div id="container_volumes_rootfs" style="<%= 'display: ' + (container ? 'block' : 'none') + ';' %>">
|
41
|
+
<%= render :partial => provider_partial(compute_resource, 'container/volume_rootfs'), :locals => { :f => i, :type => type, :node_id => node_id, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume'), :disabled => !container }, :layout => "compute_resources_vms/form/#{item_layout}_layout" %>
|
42
|
+
</div>
|
43
|
+
<% elsif i.object.mount_point? %>
|
44
|
+
<div id="container_volumes_mp" style="<%= 'display: ' + (container ? 'block' : 'none') + ';' %>">
|
45
|
+
<%= render :partial => provider_partial(compute_resource, 'container/volume_mp'), :locals => { :f => i, :type => type, :node_id => node_id, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume'), :disabled => !container }, :layout => "compute_resources_vms/form/#{item_layout}_layout" %>
|
46
|
+
</div>
|
47
|
+
<% elsif i.object.controller? %>
|
48
|
+
<div id="server_volumes" style="<%= 'display: ' + (server ? 'block' : 'none') + ';' %>">
|
49
|
+
<%= render :partial => provider_partial(compute_resource, 'server/volume'), :locals => { :f => i, :type => type, :node_id => node_id, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume'), :disabled => !server }, :layout => "compute_resources_vms/form/#{item_layout}_layout" %>
|
50
|
+
</div>
|
51
|
+
<% end %>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<%= add_child_link_typed '+ ' + _("Add Volume"), :volumes, 'server', { :class => "info #{'hide' unless server}", :title => _('add new storage volume') } %>
|
55
|
+
<%= add_child_link_typed '+ ' + _("Add Volume"), :volumes, 'container', { :class => "info #{'hide' unless container}", :title => _('add new storage volume') } %>
|
56
|
+
<% else %>
|
57
|
+
<%= new_child_fields_template(f, :volumes, {
|
58
|
+
:object => volume,
|
59
|
+
:partial => provider_partial(compute_resource, 'volume'),
|
60
|
+
:form_builder_attrs => { :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') },
|
61
|
+
:layout => "compute_resources_vms/form/#{item_layout}_layout" }) %>
|
62
|
+
|
63
|
+
<%= f.fields_for :volumes do |i| %>
|
64
|
+
<%= render :partial => provider_partial(compute_resource, 'volume'), :locals => { :f => i, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :remove_title => _('remove storage volume') }, :layout => "compute_resources_vms/form/#{item_layout}_layout" %>
|
65
|
+
<% end %>
|
66
|
+
|
67
|
+
<% if new_vm %>
|
68
|
+
<%= add_child_link '+ ' + _("Add Volume"), :volumes, { :class => "info", :title => _('add new storage volume') } %>
|
69
|
+
<% end %>
|
70
|
+
<% end %>
|
71
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
|
18
|
+
<%= javascript_include_tag 'foreman_fog_proxmox/proxmox_vm', "data-turbolinks-track" => true %>
|
19
|
+
<%= javascript_tag("$(document).on('ContentLoad', tfm.numFields.initAll)"); %>
|
20
|
+
|
21
|
+
<%= select_f f, :type, proxmox_types_map, :id, :name, { }, :label => _('Type'), :label_size => "col-md-2", :required => true, :onchange => "vmTypeSelected()", :disabled => !new_vm %>
|
22
|
+
|
23
|
+
<!-- VM General Settings -->
|
24
|
+
<%= render :partial => "compute_resources_vms/form/proxmox/general", :locals => { :f => f, :compute_resource => compute_resource, :new_vm => new_vm, :from_profile => from_profile } %>
|
25
|
+
|
26
|
+
<!-- VM Extended Settings -->
|
27
|
+
<%= render :partial => "compute_resources_vms/form/proxmox/container/extended", :locals => { :f => f, :compute_resource => compute_resource, :new_vm => new_vm } %>
|
28
|
+
|
29
|
+
<!-- VM Advanced Settings -->
|
30
|
+
<%= render :partial => "compute_resources_vms/form/proxmox/server/advanced", :locals => { :f => f, :compute_resource => compute_resource, :new_vm => new_vm } %>
|
31
|
+
<%= render :partial => "compute_resources_vms/form/proxmox/container/advanced", :locals => { :f => f, :compute_resource => compute_resource, :new_vm => new_vm } %>
|
32
|
+
|
33
|
+
<!-- Config Options Settings-->
|
34
|
+
<%= f.fields_for :config, compute_resource.new_server_vm(object_to_config_hash(f.object)).config, include_id: false do |server_config|%>
|
35
|
+
<%= render :partial => "compute_resources_vms/form/proxmox/server/config", :locals => { :f => server_config, :compute_resource => compute_resource, :host => @host, :new_vm => new_vm, :item_layout => 'removable', :type => f.object.type, :node_id => f.object.node_id } %>
|
36
|
+
<% end %>
|
37
|
+
<%= f.fields_for :config, compute_resource.new_container_vm(object_to_config_hash(f.object)).config, include_id: false do |container_config|%>
|
38
|
+
<%= render :partial => "compute_resources_vms/form/proxmox/container/config", :locals => { :f => container_config, :compute_resource => compute_resource, :host => @host, :new_vm => new_vm, :item_layout => 'removable', :type => f.object.type, :node_id => f.object.node_id } %>
|
39
|
+
<% end %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
|
18
|
+
<% untemplatable = new_vm || f.object.templated? %>
|
19
|
+
|
20
|
+
<%= field_set_tag _("General"), :id => "general" do %>
|
21
|
+
<%= checkbox_f f, :templated, :label => _('Create image?'), :disabled => untemplatable, :class => ('hide' if untemplatable), :no_label => untemplatable %>
|
22
|
+
<%= counter_f f, :vmid, :label => _('VM ID'), :label_size => "col-md-2", :required => true, :disabled => (!new_vm || from_profile) %>
|
23
|
+
<%= select_f f, :node_id, compute_resource.nodes, :node, :node, { }, :label => _('Node'), :label_size => "col-md-2", :required => true, :onchange => 'nodeSelected(this)' %>
|
24
|
+
<%= checkbox_f f, :start_after_create, :label => _('Start after creation?'), :disabled => !new_vm, :class => ('hide' if !new_vm), :no_label => !new_vm %>
|
25
|
+
<% unless local_assigns[:hide_image] && !new_vm %>
|
26
|
+
<%
|
27
|
+
arch ||= nil ; os ||= nil
|
28
|
+
images = possible_images(compute_resource, arch, os)
|
29
|
+
-%>
|
30
|
+
<div id='image_selection'>
|
31
|
+
<%= select_f f, :image_id, images, :uuid, :name, { :include_blank => true },
|
32
|
+
:disabled => true,
|
33
|
+
:help_inline => :indicator,
|
34
|
+
:label => _('Image'),
|
35
|
+
:label_size => "col-md-2" %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
<%= select_f f, :pool, compute_resource.pools, :poolid, :poolid, { :include_blank => true }, :label => _('Pool'), :label_size => "col-md-2", :required => false %>
|
39
|
+
<% end %>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
|
18
|
+
<%= render :partial => "compute_resources_vms/form/proxmox/server/network", :locals => { :f => f, :vm_type => vm_type, :node_id => node_id, :compute_resource => compute_resource, :new_vm => new_vm } %>
|
19
|
+
<%= render :partial => "compute_resources_vms/form/proxmox/container/network", :locals => { :f => f, :vm_type => vm_type, :node_id => node_id, :compute_resource => compute_resource, :new_vm => new_vm } %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
<% if compute_resource.class == ForemanFogProxmox::Proxmox %>
|
18
|
+
<% volume_rootfs = f.object.respond_to?(:rootfs?) && f.object.rootfs? %>
|
19
|
+
|
20
|
+
<% unless volume_rootfs %>
|
21
|
+
<%= remove_child_link('X', f, { :method => :'_delete', :title => local_assigns[:remove_title], :class => 'label label-danger' }) %>
|
22
|
+
<% end %>
|
23
|
+
<% else %>
|
24
|
+
<% if new_vm %>
|
25
|
+
<%= remove_child_link('X', f, { :method => :'_delete', :title => local_assigns[:remove_title], :class => 'label label-danger' }) %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
|
18
|
+
<% container = f.object.type == 'lxc' %>
|
19
|
+
|
20
|
+
<%= field_set_tag _("Advanced"), :id => "container_config_advanced_options", :class => ('hide' unless container) do %>
|
21
|
+
<%= label_tag 'show_container_config_options', n_("Main option", "Main options", 2) %>
|
22
|
+
<%= check_box_tag 'show_container_config_options', '1', false, :onclick => "$('#container_config_options').toggle()" %>
|
23
|
+
<%= label_tag 'show_container_config_cpu', _("CPU") %>
|
24
|
+
<%= check_box_tag 'show_container_config_cpu', '1', false, :onclick => "$('#container_config_cpu').toggle()" %>
|
25
|
+
<%= label_tag 'show_container_config_memory', _("Memory") %>
|
26
|
+
<%= check_box_tag 'show_container_config_memory', '1', false, :onclick => "$('#container_config_memory').toggle()" %>
|
27
|
+
<%= label_tag 'show_container_config_dns', _("DNS") %>
|
28
|
+
<%= check_box_tag 'show_container_config_dns', '1', false, :onclick => "$('#container_config_dns').toggle()" %>
|
29
|
+
<%= label_tag 'show_container_config_os', _("OS") %>
|
30
|
+
<%= check_box_tag 'show_container_config_os', '1', false, :onclick => "$('#container_config_os').toggle()" %>
|
31
|
+
<% end %>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
|
18
|
+
<%= javascript_include_tag 'foreman_fog_proxmox/proxmox_vm_container', "data-turbolinks-track" => true %>
|
19
|
+
<% container = type == 'lxc' %>
|
20
|
+
<%= field_set_tag n_("Main option", "Main options", 2), :id => "container_config_options", :class => 'hide', :disabled => !container do %>
|
21
|
+
<%= textarea_f f, :description, :label => _('Description'), :label_size => "col-md-2" %>
|
22
|
+
<%= checkbox_f f, :onboot, :label => _('Start at boot') %>
|
23
|
+
<% end %>
|
24
|
+
<%= field_set_tag _("CPU"), :id => "container_config_cpu", :class => 'hide', :disabled => !container do %>
|
25
|
+
<%= select_f f, :arch, proxmox_archs_map, :id, :name, { }, :label => _('Architecture'), :label_size => "col-md-2" %>
|
26
|
+
<%= counter_f f, :cores, :class => "input-mini", :label => _('Cores'), :label_size => "col-md-2" %>
|
27
|
+
<%= counter_f f, :cpulimit, :class => "input-mini", :label => _('CPU limit'), :label_size => "col-md-2" %>
|
28
|
+
<%= counter_f f, :cpuunits, :class => "input-mini", :label => _('CPU units'), :label_size => "col-md-2" %>
|
29
|
+
<% end %>
|
30
|
+
<%= field_set_tag _("Memory"), :id => "container_config_memory", :class => 'hide', :disabled => !container do %>
|
31
|
+
<%= byte_size_f f, :memory, :class => "input-mini", :label => _('Memory'), :label_size => "col-md-2" %>
|
32
|
+
<%= byte_size_f f, :swap, :class => "input-mini", :label => _('Swap'), :label_size => "col-md-2" %>
|
33
|
+
<% end %>
|
34
|
+
<%= field_set_tag _("DNS"), :id => "container_config_dns", :class => 'hide', :disabled => !container do %>
|
35
|
+
<%= text_f f, :hostname, :label => _('Hostname'), :label_size => "col-md-2", :disabled => true %>
|
36
|
+
<%= text_f f, :nameserver, :label => _('DNS server'), :label_size => "col-md-2" %>
|
37
|
+
<%= text_f f, :searchdomain, :label => _('Search domain'), :label_size => "col-md-2" %>
|
38
|
+
<% end %>
|
39
|
+
<%= field_set_tag _("Operating System"), :id => "container_config_os", :class => 'hide', :disabled => !container do %>
|
40
|
+
<%= select_f f, :ostype, proxmox_ostypes_map, :id, :name, { }, :label => _('OS type'), :label_size => "col-md-2" %>
|
41
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
|
18
|
+
<% container = f.object.type == 'lxc' %>
|
19
|
+
<% node_id = f.object.node_id %>
|
20
|
+
|
21
|
+
<%= field_set_tag _("Extended"), :id => "container_config_ext", :class => ('hide' unless (new_vm && container)), :disabled => (!container || !new_vm) do %>
|
22
|
+
<div id="ostemplate_form">
|
23
|
+
<%= select_f f, :ostemplate_storage, compute_resource.storages(node_id,'vztmpl'), :storage, :storage, { :include_blank => true }, :disabled => !new_vm, :class => ('hide' unless new_vm), :label => _('Template storage'), :label_size => "col-md-2", :onchange => 'storageOstemplateSelected(this)' %>
|
24
|
+
<%= select_f f, :ostemplate_file, compute_resource.images_by_storage(node_id,f.object.ostemplate_storage, 'vztmpl'), :volid, :volid, { :include_blank => true }, :disabled => !new_vm, :class => ('hide' unless new_vm), :label => _('OS Template'), :label_size => "col-md-2", :required => true %>
|
25
|
+
</div>
|
26
|
+
<%= password_proxmox_f f, :password, :label => _("Root password"), :required => true %>
|
27
|
+
<% end %>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%# Copyright 2018 Tristan Robert
|
2
|
+
|
3
|
+
This file is part of ForemanFogProxmox.
|
4
|
+
|
5
|
+
ForemanFogProxmox is free software: you can redistribute it and/or modify
|
6
|
+
it under the terms of the GNU General Public License as published by
|
7
|
+
the Free Software Foundation, either version 3 of the License, or
|
8
|
+
(at your option) any later version.
|
9
|
+
|
10
|
+
ForemanFogProxmox is distributed in the hope that it will be useful,
|
11
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
GNU General Public License for more details.
|
14
|
+
|
15
|
+
You should have received a copy of the GNU General Public License
|
16
|
+
along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
|
17
|
+
|
18
|
+
<% container = vm_type == 'lxc' %>
|
19
|
+
<% index = f.index ? f.index.present? : 0 %>
|
20
|
+
|
21
|
+
<%= field_set_tag _("Nic"), :id => "container_network_#{index}", :style => ('display: none;' unless container), :disabled => !container do %>
|
22
|
+
<%= f.hidden_field :id if !new_vm %>
|
23
|
+
<%= text_f f, :name, :label => _('Name'), :label_size => "col-md-2" %>
|
24
|
+
<%= checkbox_f f, :dhcpv4, :label => _('DHCP IPv4') %>
|
25
|
+
<%= text_f f, :cidrv4_prefix, :label => _('CIDR IPv4 prefix'), :label_size => "col-md-2" %>
|
26
|
+
<%= text_f f, :gwv4, :label => _('Gateway IPv4'), :label_size => "col-md-2" %>
|
27
|
+
<%= checkbox_f f, :dhcpv6, :label => _('DHCP IPv6') %>
|
28
|
+
<%= text_f f, :cidrv6_prefix, :label => _('CIDR IPv6 prefix'), :label_size => "col-md-2" %>
|
29
|
+
<%= text_f f, :gwv6, :label => _('Gateway IPv6'), :label_size => "col-md-2" %>
|
30
|
+
<%= counter_f f, :tag, :class => "input-mini", :label => _('VLAN tag'), :label_size => "col-md-2" %>
|
31
|
+
<%= counter_f f, :rate, :class => "input-mini", :label => _('Rate limit'), :label_size => "col-md-2" %>
|
32
|
+
<%= select_f f, :bridge, compute_resource.bridges(node_id), :iface, :iface, { }, :label => _('Bridge'), :label_size => "col-md-2" %>
|
33
|
+
<% end %>
|